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 "ash/display/screen_position_controller.h" | 5 #include "ash/display/screen_position_controller.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 const aura::Window* window, | 129 const aura::Window* window, |
130 gfx::Point* point) { | 130 gfx::Point* point) { |
131 const aura::RootWindow* root = window->GetRootWindow(); | 131 const aura::RootWindow* root = window->GetRootWindow(); |
132 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( | 132 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
133 const_cast<aura::RootWindow*>(root)).bounds().origin(); | 133 const_cast<aura::RootWindow*>(root)).bounds().origin(); |
134 point->Offset(-display_origin.x(), -display_origin.y()); | 134 point->Offset(-display_origin.x(), -display_origin.y()); |
135 aura::Window::ConvertPointToTarget(root, window, point); | 135 aura::Window::ConvertPointToTarget(root, window, point); |
136 } | 136 } |
137 | 137 |
138 void ScreenPositionController::ConvertHostPointToScreen( | 138 void ScreenPositionController::ConvertHostPointToScreen( |
139 aura::RootWindow* root_window, | 139 aura::Window* root_window, |
140 gfx::Point* point) { | 140 gfx::Point* point) { |
141 root_window->ConvertPointFromHost(point); | 141 aura::RootWindow* root = root_window->GetRootWindow(); |
| 142 root->ConvertPointFromHost(point); |
142 std::pair<aura::RootWindow*, gfx::Point> pair = | 143 std::pair<aura::RootWindow*, gfx::Point> pair = |
143 GetRootWindowRelativeToWindow(root_window, *point); | 144 GetRootWindowRelativeToWindow(root, *point); |
144 *point = pair.second; | 145 *point = pair.second; |
145 ConvertPointToScreen(pair.first, point); | 146 ConvertPointToScreen(pair.first, point); |
146 } | 147 } |
147 | 148 |
148 void ScreenPositionController::SetBounds(aura::Window* window, | 149 void ScreenPositionController::SetBounds(aura::Window* window, |
149 const gfx::Rect& bounds, | 150 const gfx::Rect& bounds, |
150 const gfx::Display& display) { | 151 const gfx::Display& display) { |
151 DCHECK_NE(-1, display.id()); | 152 DCHECK_NE(-1, display.id()); |
152 if (!window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { | 153 if (!window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { |
153 window->SetBounds(bounds); | 154 window->SetBounds(bounds); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 207 |
207 gfx::Point origin(bounds.origin()); | 208 gfx::Point origin(bounds.origin()); |
208 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( | 209 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
209 window).bounds().origin(); | 210 window).bounds().origin(); |
210 origin.Offset(-display_origin.x(), -display_origin.y()); | 211 origin.Offset(-display_origin.x(), -display_origin.y()); |
211 window->SetBounds(gfx::Rect(origin, bounds.size())); | 212 window->SetBounds(gfx::Rect(origin, bounds.size())); |
212 } | 213 } |
213 | 214 |
214 } // internal | 215 } // internal |
215 } // ash | 216 } // ash |
OLD | NEW |