| 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/display/screen.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 | 11 |
| 12 namespace wm { | 12 namespace wm { |
| 13 | 13 |
| 14 DefaultScreenPositionClient::DefaultScreenPositionClient() { | 14 DefaultScreenPositionClient::DefaultScreenPositionClient() { |
| 15 } | 15 } |
| 16 | 16 |
| 17 DefaultScreenPositionClient::~DefaultScreenPositionClient() { | 17 DefaultScreenPositionClient::~DefaultScreenPositionClient() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 gfx::Point DefaultScreenPositionClient::GetOriginInScreen( | 20 gfx::Point DefaultScreenPositionClient::GetOriginInScreen( |
| 21 const aura::Window* root_window) { | 21 const aura::Window* root_window) { |
| 22 aura::Window* window = const_cast<aura::Window*>(root_window); | 22 aura::Window* window = const_cast<aura::Window*>(root_window); |
| 23 display::Screen* screen = display::Screen::GetScreen(); | 23 display::Screen* screen = display::Screen::GetScreen(); |
| 24 gfx::Rect screen_bounds = root_window->GetHost()->GetBounds(); | 24 gfx::Rect screen_bounds = root_window->GetHost()->GetBoundsInPixels(); |
| 25 gfx::Rect dip_bounds = screen->ScreenToDIPRectInWindow(window, screen_bounds); | 25 gfx::Rect dip_bounds = screen->ScreenToDIPRectInWindow(window, screen_bounds); |
| 26 return dip_bounds.origin(); | 26 return dip_bounds.origin(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void DefaultScreenPositionClient::ConvertPointToScreen( | 29 void DefaultScreenPositionClient::ConvertPointToScreen( |
| 30 const aura::Window* window, | 30 const aura::Window* window, |
| 31 gfx::Point* point) { | 31 gfx::Point* point) { |
| 32 const aura::Window* root_window = window->GetRootWindow(); | 32 const aura::Window* root_window = window->GetRootWindow(); |
| 33 aura::Window::ConvertPointToTarget(window, root_window, point); | 33 aura::Window::ConvertPointToTarget(window, root_window, point); |
| 34 gfx::Point origin = GetOriginInScreen(root_window); | 34 gfx::Point origin = GetOriginInScreen(root_window); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 ConvertPointToScreen(root_window, point); | 50 ConvertPointToScreen(root_window, point); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void DefaultScreenPositionClient::SetBounds(aura::Window* window, | 53 void DefaultScreenPositionClient::SetBounds(aura::Window* window, |
| 54 const gfx::Rect& bounds, | 54 const gfx::Rect& bounds, |
| 55 const display::Display& display) { | 55 const display::Display& display) { |
| 56 window->SetBounds(bounds); | 56 window->SetBounds(bounds); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace wm | 59 } // namespace wm |
| OLD | NEW |