OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/widget/desktop_aura/desktop_screen_position_client.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
6 | 6 |
7 #include "ui/aura/root_window.h" | 7 #include "ui/aura/root_window.h" |
8 #include "ui/gfx/display.h" | 8 #include "ui/gfx/display.h" |
9 #include "ui/gfx/point_conversions.h" | 9 #include "ui/gfx/point_conversions.h" |
10 #include "ui/gfx/screen.h" | 10 #include "ui/gfx/screen.h" |
11 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 11 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 gfx::Point GetOrigin(const aura::Window* root_window) { | 17 gfx::Point GetOrigin(const aura::Window* root_window) { |
18 gfx::Point origin_in_pixels = root_window->GetDispatcher()->GetHostOrigin(); | 18 gfx::Point origin_in_pixels = |
| 19 root_window->GetDispatcher()->host()->GetBounds().origin(); |
19 aura::Window* window = const_cast<aura::Window*>(root_window); | 20 aura::Window* window = const_cast<aura::Window*>(root_window); |
20 float scale = gfx::Screen::GetScreenFor(window)-> | 21 float scale = gfx::Screen::GetScreenFor(window)-> |
21 GetDisplayNearestWindow(window).device_scale_factor(); | 22 GetDisplayNearestWindow(window).device_scale_factor(); |
22 return gfx::ToFlooredPoint( | 23 return gfx::ToFlooredPoint( |
23 gfx::ScalePoint(origin_in_pixels, 1 / scale)); | 24 gfx::ScalePoint(origin_in_pixels, 1 / scale)); |
24 } | 25 } |
25 | 26 |
26 // Returns true if bounds passed to window are treated as though they are in | 27 // Returns true if bounds passed to window are treated as though they are in |
27 // screen coordinates. | 28 // screen coordinates. |
28 bool PositionWindowInScreenCoordinates(aura::Window* window) { | 29 bool PositionWindowInScreenCoordinates(aura::Window* window) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 DesktopNativeWidgetAura::ForWindow(window); | 90 DesktopNativeWidgetAura::ForWindow(window); |
90 if (desktop_native_widget) { | 91 if (desktop_native_widget) { |
91 root->GetDispatcher()->SetHostBounds(bounds); | 92 root->GetDispatcher()->SetHostBounds(bounds); |
92 // Setting bounds of root resizes |window|. | 93 // Setting bounds of root resizes |window|. |
93 } else { | 94 } else { |
94 window->SetBounds(bounds); | 95 window->SetBounds(bounds); |
95 } | 96 } |
96 } | 97 } |
97 | 98 |
98 } // namespace views | 99 } // namespace views |
OLD | NEW |