| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/wm/core/default_screen_position_client.h" | 5 #include "ui/wm/core/default_screen_position_client.h" |
| 6 | 6 |
| 7 #include "ui/aura/window_tree_host.h" | 7 #include "ui/aura/window_tree_host.h" |
| 8 #include "ui/gfx/display.h" | 8 #include "ui/display/screen.h" |
| 9 #include "ui/gfx/geometry/point_conversions.h" | 9 #include "ui/gfx/geometry/point_conversions.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| 11 #include "ui/gfx/screen.h" | |
| 12 | 11 |
| 13 namespace wm { | 12 namespace wm { |
| 14 | 13 |
| 15 DefaultScreenPositionClient::DefaultScreenPositionClient() { | 14 DefaultScreenPositionClient::DefaultScreenPositionClient() { |
| 16 } | 15 } |
| 17 | 16 |
| 18 DefaultScreenPositionClient::~DefaultScreenPositionClient() { | 17 DefaultScreenPositionClient::~DefaultScreenPositionClient() { |
| 19 } | 18 } |
| 20 | 19 |
| 21 gfx::Point DefaultScreenPositionClient::GetOriginInScreen( | 20 gfx::Point DefaultScreenPositionClient::GetOriginInScreen( |
| 22 const aura::Window* root_window) { | 21 const aura::Window* root_window) { |
| 23 aura::Window* window = const_cast<aura::Window*>(root_window); | 22 aura::Window* window = const_cast<aura::Window*>(root_window); |
| 24 gfx::Screen* screen = gfx::Screen::GetScreen(); | 23 display::Screen* screen = display::Screen::GetScreen(); |
| 25 gfx::Rect screen_bounds = root_window->GetHost()->GetBounds(); | 24 gfx::Rect screen_bounds = root_window->GetHost()->GetBounds(); |
| 26 gfx::Rect dip_bounds = screen->ScreenToDIPRectInWindow(window, screen_bounds); | 25 gfx::Rect dip_bounds = screen->ScreenToDIPRectInWindow(window, screen_bounds); |
| 27 return dip_bounds.origin(); | 26 return dip_bounds.origin(); |
| 28 } | 27 } |
| 29 | 28 |
| 30 void DefaultScreenPositionClient::ConvertPointToScreen( | 29 void DefaultScreenPositionClient::ConvertPointToScreen( |
| 31 const aura::Window* window, | 30 const aura::Window* window, |
| 32 gfx::Point* point) { | 31 gfx::Point* point) { |
| 33 const aura::Window* root_window = window->GetRootWindow(); | 32 const aura::Window* root_window = window->GetRootWindow(); |
| 34 aura::Window::ConvertPointToTarget(window, root_window, point); | 33 aura::Window::ConvertPointToTarget(window, root_window, point); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 46 } | 45 } |
| 47 | 46 |
| 48 void DefaultScreenPositionClient::ConvertHostPointToScreen(aura::Window* window, | 47 void DefaultScreenPositionClient::ConvertHostPointToScreen(aura::Window* window, |
| 49 gfx::Point* point) { | 48 gfx::Point* point) { |
| 50 aura::Window* root_window = window->GetRootWindow(); | 49 aura::Window* root_window = window->GetRootWindow(); |
| 51 ConvertPointToScreen(root_window, point); | 50 ConvertPointToScreen(root_window, point); |
| 52 } | 51 } |
| 53 | 52 |
| 54 void DefaultScreenPositionClient::SetBounds(aura::Window* window, | 53 void DefaultScreenPositionClient::SetBounds(aura::Window* window, |
| 55 const gfx::Rect& bounds, | 54 const gfx::Rect& bounds, |
| 56 const gfx::Display& display) { | 55 const display::Display& display) { |
| 57 window->SetBounds(bounds); | 56 window->SetBounds(bounds); |
| 58 } | 57 } |
| 59 | 58 |
| 60 } // namespace wm | 59 } // namespace wm |
| OLD | NEW |