Move two utility functions from ash/screen_util.h to ui/wm/core/coordinate_conversion.h
|ash::ScreenUtil::ConvertRectToScreen| and
|ash::ScreenUtil::ConvertRectFromScreen| are moved.
BUG=624521
TEST=Added an unit test.
Review-Url: https://codereview.chromium.org/2660873002
Cr-Commit-Position: refs/heads/master@{#452450}
diff --git a/ash/screen_util.cc b/ash/screen_util.cc
index 29baadf4..ea11d87 100644
--- a/ash/screen_util.cc
+++ b/ash/screen_util.cc
@@ -14,6 +14,7 @@
#include "ui/display/manager/display_manager.h"
#include "ui/display/screen.h"
#include "ui/gfx/geometry/size_conversions.h"
+#include "ui/wm/core/coordinate_conversion.h"
namespace ash {
@@ -28,37 +29,18 @@
// static
gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) {
- return ConvertRectFromScreen(
- window->parent(),
- display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds());
+ gfx::Rect result =
+ display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds();
+ ::wm::ConvertRectFromScreen(window->parent(), &result);
+ return result;
}
// static
gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) {
- return ConvertRectFromScreen(window->parent(),
- display::Screen::GetScreen()
- ->GetDisplayNearestWindow(window)
- .work_area());
+ gfx::Rect result =
+ display::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area();
+ ::wm::ConvertRectFromScreen(window->parent(), &result);
+ return result;
}
-// static
-gfx::Rect ScreenUtil::ConvertRectToScreen(aura::Window* window,
- const gfx::Rect& rect) {
- gfx::Point point = rect.origin();
- aura::client::GetScreenPositionClient(window->GetRootWindow())
- ->ConvertPointToScreen(window, &point);
- return gfx::Rect(point, rect.size());
-}
-
-// static
-gfx::Rect ScreenUtil::ConvertRectFromScreen(aura::Window* window,
- const gfx::Rect& rect) {
- gfx::Point point = rect.origin();
- aura::client::GetScreenPositionClient(window->GetRootWindow())
- ->ConvertPointFromScreen(window, &point);
- return gfx::Rect(point, rect.size());
-}
-
-// static
-
} // namespace ash