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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 aura::Window* dst_container = Shell::GetContainer(dst, id); | 67 aura::Window* dst_container = Shell::GetContainer(dst, id); |
68 aura::Window::Windows children = src_container->children(); | 68 aura::Window::Windows children = src_container->children(); |
69 for (aura::Window::Windows::iterator iter = children.begin(); | 69 for (aura::Window::Windows::iterator iter = children.begin(); |
70 iter != children.end(); ++iter) { | 70 iter != children.end(); ++iter) { |
71 aura::Window* window = *iter; | 71 aura::Window* window = *iter; |
72 // Don't move modal screen. | 72 // Don't move modal screen. |
73 if (internal::SystemModalContainerLayoutManager::IsModalScreen(window)) | 73 if (internal::SystemModalContainerLayoutManager::IsModalScreen(window)) |
74 continue; | 74 continue; |
75 | 75 |
76 // Update the restore bounds to make it relative to the display. | 76 // Update the restore bounds to make it relative to the display. |
77 gfx::Rect restore_bounds; | 77 gfx::Rect restore_bounds(GetRestoreBoundsInParent(window)); |
78 if (internal::DisplayController::IsVirtualScreenCoordinatesEnabled()) | |
79 restore_bounds = GetRestoreBoundsInParent(window); | |
80 dst_container->AddChild(window); | 78 dst_container->AddChild(window); |
81 if (!restore_bounds.IsEmpty()) | 79 if (!restore_bounds.IsEmpty()) |
82 SetRestoreBoundsInParent(window, restore_bounds); | 80 SetRestoreBoundsInParent(window, restore_bounds); |
83 } | 81 } |
84 } | 82 } |
85 } | 83 } |
86 | 84 |
87 // Mark the container window so that a widget added to this container will | 85 // Mark the container window so that a widget added to this container will |
88 // use the virtual screeen coordinates instead of parent. | 86 // use the virtual screeen coordinates instead of parent. |
89 void SetUsesScreenCoordinates(aura::Window* container) { | 87 void SetUsesScreenCoordinates(aura::Window* container) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 231 |
234 RootWindowController::RootWindowController(aura::RootWindow* root_window) | 232 RootWindowController::RootWindowController(aura::RootWindow* root_window) |
235 : root_window_(root_window) { | 233 : root_window_(root_window) { |
236 SetRootWindowController(root_window, this); | 234 SetRootWindowController(root_window, this); |
237 | 235 |
238 event_client_.reset(new internal::EventClientImpl(root_window)); | 236 event_client_.reset(new internal::EventClientImpl(root_window)); |
239 screen_dimmer_.reset(new internal::ScreenDimmer(root_window)); | 237 screen_dimmer_.reset(new internal::ScreenDimmer(root_window)); |
240 } | 238 } |
241 | 239 |
242 RootWindowController::~RootWindowController() { | 240 RootWindowController::~RootWindowController() { |
| 241 if (Shell::GetActiveRootWindow() == root_window_.get()) { |
| 242 Shell::GetInstance()->set_active_root_window( |
| 243 Shell::GetPrimaryRootWindow() == root_window_.get() ? |
| 244 NULL : Shell::GetPrimaryRootWindow()); |
| 245 } |
243 SetRootWindowController(root_window_.get(), NULL); | 246 SetRootWindowController(root_window_.get(), NULL); |
244 event_client_.reset(); | 247 event_client_.reset(); |
245 screen_dimmer_.reset(); | 248 screen_dimmer_.reset(); |
246 workspace_controller_.reset(); | 249 workspace_controller_.reset(); |
247 root_window_.reset(); | 250 root_window_.reset(); |
248 } | 251 } |
249 | 252 |
250 aura::Window* RootWindowController::GetContainer(int container_id) { | 253 aura::Window* RootWindowController::GetContainer(int container_id) { |
251 return root_window_->GetChildById(container_id); | 254 return root_window_->GetChildById(container_id); |
252 } | 255 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // Restore focused or active window if it's still alive. | 313 // Restore focused or active window if it's still alive. |
311 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { | 314 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { |
312 dst->GetFocusManager()->SetFocusedWindow(focused, NULL); | 315 dst->GetFocusManager()->SetFocusedWindow(focused, NULL); |
313 } else if (active && tracker.Contains(active) && dst->Contains(active)) { | 316 } else if (active && tracker.Contains(active) && dst->Contains(active)) { |
314 activation_client->ActivateWindow(active); | 317 activation_client->ActivateWindow(active); |
315 } | 318 } |
316 } | 319 } |
317 | 320 |
318 } // namespace internal | 321 } // namespace internal |
319 } // namespace ash | 322 } // namespace ash |
OLD | NEW |