diff options
author | mfomitchev@chromium.org <mfomitchev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-08 22:42:08 +0000 |
---|---|---|
committer | mfomitchev@chromium.org <mfomitchev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-08 22:43:50 +0000 |
commit | bebe14163854e8795e040cc0d8614f879fed0eab (patch) | |
tree | 74389c72d57d7e60a36a00199d6deb59e1672451 /ui/wm | |
parent | 2df1ae8e7b2d831306a819fa9d774dad6fc6819d (diff) | |
download | chromium_src-bebe14163854e8795e040cc0d8614f879fed0eab.zip chromium_src-bebe14163854e8795e040cc0d8614f879fed0eab.tar.gz chromium_src-bebe14163854e8795e040cc0d8614f879fed0eab.tar.bz2 |
Moving coordinate conversion methods from ash/wm to ui/wm.
Re-submit of https://codereview.chromium.org/425363002/
TBR=sky, oshima
BUG=NONE
Review URL: https://codereview.chromium.org/445173002
Cr-Commit-Position: refs/heads/master@{#288449}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288449 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/wm')
-rw-r--r-- | ui/wm/core/coordinate_conversion.cc | 29 | ||||
-rw-r--r-- | ui/wm/core/coordinate_conversion.h | 32 | ||||
-rw-r--r-- | ui/wm/wm.gyp | 2 |
3 files changed, 63 insertions, 0 deletions
diff --git a/ui/wm/core/coordinate_conversion.cc b/ui/wm/core/coordinate_conversion.cc new file mode 100644 index 0000000..6227b37 --- /dev/null +++ b/ui/wm/core/coordinate_conversion.cc @@ -0,0 +1,29 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/wm/core/coordinate_conversion.h" + +#include "ui/aura/client/screen_position_client.h" +#include "ui/gfx/point.h" + +namespace wm { + +void ConvertPointToScreen(const aura::Window* window, gfx::Point* point) { + DCHECK(window); + DCHECK(window->GetRootWindow()); + DCHECK(aura::client::GetScreenPositionClient(window->GetRootWindow())); + aura::client::GetScreenPositionClient(window->GetRootWindow())-> + ConvertPointToScreen(window, point); +} + +void ConvertPointFromScreen(const aura::Window* window, + gfx::Point* point_in_screen) { + DCHECK(window); + DCHECK(window->GetRootWindow()); + DCHECK(aura::client::GetScreenPositionClient(window->GetRootWindow())); + aura::client::GetScreenPositionClient(window->GetRootWindow())-> + ConvertPointFromScreen(window, point_in_screen); +} + +} // namespace wm diff --git a/ui/wm/core/coordinate_conversion.h b/ui/wm/core/coordinate_conversion.h new file mode 100644 index 0000000..acc6a46 --- /dev/null +++ b/ui/wm/core/coordinate_conversion.h @@ -0,0 +1,32 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_WM_CORE_COORDINATE_CONVERSION_H_ +#define UI_WM_CORE_COORDINATE_CONVERSION_H_ + +#include "ui/wm/wm_export.h" + +namespace aura { +class Window; +} // namespace aura + +namespace gfx { +class Point; +} // namespace gfx + +namespace wm { + +// Converts the |point| from a given |window|'s coordinates into the screen +// coordinates. +WM_EXPORT void ConvertPointToScreen(const aura::Window* window, + gfx::Point* point); + +// Converts the |point| from the screen coordinates to a given |window|'s +// coordinates. +WM_EXPORT void ConvertPointFromScreen(const aura::Window* window, + gfx::Point* point_in_screen); + +} // namespace wm + +#endif // UI_WM_CORE_COORDINATE_CONVERSION_H_ diff --git a/ui/wm/wm.gyp b/ui/wm/wm.gyp index 6a0c928..cfdc937 100644 --- a/ui/wm/wm.gyp +++ b/ui/wm/wm.gyp @@ -37,6 +37,8 @@ 'core/capture_controller.h', 'core/compound_event_filter.cc', 'core/compound_event_filter.h', + 'core/coordinate_conversion.cc', + 'core/coordinate_conversion.h', 'core/cursor_manager.cc', 'core/cursor_manager.h', 'core/default_activation_client.cc', |