Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: ash/display/screen_position_controller.cc

Issue 1608053002: Remove now-unnecessary wrappers around gfx::Screen::GetScreen() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-5
Patch Set: cros Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/display/screen_ash_unittest.cc ('k') | ash/display/screen_position_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/window_tree_host_manager.h" 7 #include "ash/display/window_tree_host_manager.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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 #endif 116 #endif
117 *target_root = root_window; 117 *target_root = root_window;
118 *point = point_in_root; 118 *point = point_in_root;
119 } 119 }
120 120
121 void ScreenPositionController::ConvertPointToScreen( 121 void ScreenPositionController::ConvertPointToScreen(
122 const aura::Window* window, 122 const aura::Window* window,
123 gfx::Point* point) { 123 gfx::Point* point) {
124 const aura::Window* root = window->GetRootWindow(); 124 const aura::Window* root = window->GetRootWindow();
125 aura::Window::ConvertPointToTarget(window, root, point); 125 aura::Window::ConvertPointToTarget(window, root, point);
126 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( 126 const gfx::Point display_origin =
127 const_cast<aura::Window*>(root)).bounds().origin(); 127 gfx::Screen::GetScreen()
128 ->GetDisplayNearestWindow(const_cast<aura::Window*>(root))
129 .bounds()
130 .origin();
128 point->Offset(display_origin.x(), display_origin.y()); 131 point->Offset(display_origin.x(), display_origin.y());
129 } 132 }
130 133
131 void ScreenPositionController::ConvertPointFromScreen( 134 void ScreenPositionController::ConvertPointFromScreen(
132 const aura::Window* window, 135 const aura::Window* window,
133 gfx::Point* point) { 136 gfx::Point* point) {
134 const aura::Window* root = window->GetRootWindow(); 137 const aura::Window* root = window->GetRootWindow();
135 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( 138 const gfx::Point display_origin =
136 const_cast<aura::Window*>(root)).bounds().origin(); 139 gfx::Screen::GetScreen()
140 ->GetDisplayNearestWindow(const_cast<aura::Window*>(root))
141 .bounds()
142 .origin();
137 point->Offset(-display_origin.x(), -display_origin.y()); 143 point->Offset(-display_origin.x(), -display_origin.y());
138 aura::Window::ConvertPointToTarget(root, window, point); 144 aura::Window::ConvertPointToTarget(root, window, point);
139 } 145 }
140 146
141 void ScreenPositionController::ConvertHostPointToScreen( 147 void ScreenPositionController::ConvertHostPointToScreen(
142 aura::Window* root_window, 148 aura::Window* root_window,
143 gfx::Point* point) { 149 gfx::Point* point) {
144 aura::Window* root = root_window->GetRootWindow(); 150 aura::Window* root = root_window->GetRootWindow();
145 aura::Window* target_root = nullptr; 151 aura::Window* target_root = nullptr;
146 ConvertHostPointToRelativeToRootWindow(root, Shell::GetAllRootWindows(), 152 ConvertHostPointToRelativeToRootWindow(root, Shell::GetAllRootWindows(),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 activation_client->ActivateWindow(active); 221 activation_client->ActivateWindow(active);
216 } 222 }
217 // TODO(oshima): We should not have to update the bounds again 223 // TODO(oshima): We should not have to update the bounds again
218 // below in theory, but we currently do need as there is a code 224 // below in theory, but we currently do need as there is a code
219 // that assumes that the bounds will never be overridden by the 225 // that assumes that the bounds will never be overridden by the
220 // layout mananger. We should have more explicit control how 226 // layout mananger. We should have more explicit control how
221 // constraints are applied by the layout manager. 227 // constraints are applied by the layout manager.
222 } 228 }
223 } 229 }
224 gfx::Point origin(bounds.origin()); 230 gfx::Point origin(bounds.origin());
225 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( 231 const gfx::Point display_origin = gfx::Screen::GetScreen()
226 window).bounds().origin(); 232 ->GetDisplayNearestWindow(window)
233 .bounds()
234 .origin();
227 origin.Offset(-display_origin.x(), -display_origin.y()); 235 origin.Offset(-display_origin.x(), -display_origin.y());
228 window->SetBounds(gfx::Rect(origin, bounds.size())); 236 window->SetBounds(gfx::Rect(origin, bounds.size()));
229 } 237 }
230 238
231 } // namespace ash 239 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/screen_ash_unittest.cc ('k') | ash/display/screen_position_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698