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

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

Issue 2194353002: mash: Migrate ScopedTargetRootWindow to //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reflow comment Created 4 years, 4 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
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/aura/wm_window_aura.h"
7 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/common/wm_shell.h"
11 #include "ash/common/wm_window.h"
9 #include "ash/display/window_tree_host_manager.h" 12 #include "ash/display/window_tree_host_manager.h"
10 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
11 #include "ash/shell.h" 14 #include "ash/shell.h"
12 #include "ash/wm/system_modal_container_layout_manager.h" 15 #include "ash/wm/system_modal_container_layout_manager.h"
13 #include "ash/wm/window_properties.h" 16 #include "ash/wm/window_properties.h"
14 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
15 #include "ui/aura/client/focus_client.h" 18 #include "ui/aura/client/focus_client.h"
16 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
17 #include "ui/aura/window_event_dispatcher.h" 20 #include "ui/aura/window_event_dispatcher.h"
18 #include "ui/aura/window_tracker.h" 21 #include "ui/aura/window_tracker.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 window->SetBounds(new_bounds); 208 window->SetBounds(new_bounds);
206 209
207 dst_container->AddChild(window); 210 dst_container->AddChild(window);
208 211
209 MoveAllTransientChildrenToNewRoot(display, window); 212 MoveAllTransientChildrenToNewRoot(display, window);
210 213
211 // Restore focused/active window. 214 // Restore focused/active window.
212 if (tracker.Contains(focused)) { 215 if (tracker.Contains(focused)) {
213 aura::client::GetFocusClient(window)->FocusWindow(focused); 216 aura::client::GetFocusClient(window)->FocusWindow(focused);
214 // TODO(beng): replace with GetRootWindow(). 217 // TODO(beng): replace with GetRootWindow().
215 ash::Shell::GetInstance()->set_target_root_window( 218 WmShell::Get()->set_root_window_for_new_windows(
216 focused->GetRootWindow()); 219 WmWindowAura::Get(focused->GetRootWindow()));
217 } else if (tracker.Contains(active)) { 220 } else if (tracker.Contains(active)) {
218 activation_client->ActivateWindow(active); 221 activation_client->ActivateWindow(active);
219 } 222 }
220 // TODO(oshima): We should not have to update the bounds again 223 // TODO(oshima): We should not have to update the bounds again
221 // 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
222 // that assumes that the bounds will never be overridden by the 225 // that assumes that the bounds will never be overridden by the
223 // layout mananger. We should have more explicit control how 226 // layout mananger. We should have more explicit control how
224 // constraints are applied by the layout manager. 227 // constraints are applied by the layout manager.
225 } 228 }
226 } 229 }
227 gfx::Point origin(bounds.origin()); 230 gfx::Point origin(bounds.origin());
228 const gfx::Point display_origin = display::Screen::GetScreen() 231 const gfx::Point display_origin = display::Screen::GetScreen()
229 ->GetDisplayNearestWindow(window) 232 ->GetDisplayNearestWindow(window)
230 .bounds() 233 .bounds()
231 .origin(); 234 .origin();
232 origin.Offset(-display_origin.x(), -display_origin.y()); 235 origin.Offset(-display_origin.x(), -display_origin.y());
233 window->SetBounds(gfx::Rect(origin, bounds.size())); 236 window->SetBounds(gfx::Rect(origin, bounds.size()));
234 } 237 }
235 238
236 } // namespace ash 239 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698