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 <queue> | 7 #include <queue> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 gfx::Rect restore_bounds; | 103 gfx::Rect restore_bounds; |
104 bool has_restore_bounds = state->HasRestoreBounds(); | 104 bool has_restore_bounds = state->HasRestoreBounds(); |
105 if (has_restore_bounds) | 105 if (has_restore_bounds) |
106 restore_bounds = state->GetRestoreBoundsInParent(); | 106 restore_bounds = state->GetRestoreBoundsInParent(); |
107 new_parent->AddChild(window); | 107 new_parent->AddChild(window); |
108 if (has_restore_bounds) | 108 if (has_restore_bounds) |
109 state->SetRestoreBoundsInParent(restore_bounds); | 109 state->SetRestoreBoundsInParent(restore_bounds); |
110 } | 110 } |
111 | 111 |
112 // Reparents the appropriate set of windows from |src| to |dst|. | 112 // Reparents the appropriate set of windows from |src| to |dst|. |
113 void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) { | 113 void ReparentAllWindows(aura::Window* src, aura::Window* dst) { |
114 // Set of windows to move. | 114 // Set of windows to move. |
115 const int kContainerIdsToMove[] = { | 115 const int kContainerIdsToMove[] = { |
116 internal::kShellWindowId_DefaultContainer, | 116 internal::kShellWindowId_DefaultContainer, |
117 internal::kShellWindowId_DockedContainer, | 117 internal::kShellWindowId_DockedContainer, |
118 internal::kShellWindowId_PanelContainer, | 118 internal::kShellWindowId_PanelContainer, |
119 internal::kShellWindowId_AlwaysOnTopContainer, | 119 internal::kShellWindowId_AlwaysOnTopContainer, |
120 internal::kShellWindowId_SystemModalContainer, | 120 internal::kShellWindowId_SystemModalContainer, |
121 internal::kShellWindowId_LockSystemModalContainer, | 121 internal::kShellWindowId_LockSystemModalContainer, |
122 internal::kShellWindowId_InputMethodContainer, | 122 internal::kShellWindowId_InputMethodContainer, |
123 internal::kShellWindowId_UnparentedControlContainer, | 123 internal::kShellWindowId_UnparentedControlContainer, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 private: | 211 private: |
212 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate); | 212 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate); |
213 }; | 213 }; |
214 | 214 |
215 } // namespace | 215 } // namespace |
216 | 216 |
217 namespace internal { | 217 namespace internal { |
218 | 218 |
219 void RootWindowController::CreateForPrimaryDisplay( | 219 void RootWindowController::CreateForPrimaryDisplay( |
220 aura::RootWindow * root) { | 220 aura::RootWindow* root) { |
221 RootWindowController* controller = new RootWindowController(root); | 221 RootWindowController* controller = new RootWindowController(root); |
222 controller->Init(true /* primary */, | 222 controller->Init(true /* primary */, |
223 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); | 223 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); |
224 } | 224 } |
225 | 225 |
226 void RootWindowController::CreateForSecondaryDisplay(aura::RootWindow * root) { | 226 void RootWindowController::CreateForSecondaryDisplay(aura::RootWindow * root) { |
227 RootWindowController* controller = new RootWindowController(root); | 227 RootWindowController* controller = new RootWindowController(root); |
228 controller->Init(false /* secondary */, false /* first run */); | 228 controller->Init(false /* secondary */, false /* first run */); |
229 } | 229 } |
230 | 230 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 if (animating_wallpaper_controller_.get()) | 270 if (animating_wallpaper_controller_.get()) |
271 animating_wallpaper_controller_->StopAnimating(); | 271 animating_wallpaper_controller_->StopAnimating(); |
272 wallpaper_controller_.reset(); | 272 wallpaper_controller_.reset(); |
273 animating_wallpaper_controller_.reset(); | 273 animating_wallpaper_controller_.reset(); |
274 | 274 |
275 // Change the target root window before closing child windows. If any child | 275 // Change the target root window before closing child windows. If any child |
276 // being removed triggers a relayout of the shelf it will try to build a | 276 // being removed triggers a relayout of the shelf it will try to build a |
277 // window list adding windows from the target root window's containers which | 277 // window list adding windows from the target root window's containers which |
278 // may have already gone away. | 278 // may have already gone away. |
279 if (Shell::GetTargetRootWindow() == root_window_) { | 279 if (Shell::GetTargetRootWindow()->GetDispatcher() == root_window_) { |
280 Shell::GetInstance()->set_target_root_window( | 280 Shell::GetInstance()->set_target_root_window( |
281 Shell::GetPrimaryRootWindow() == root_window_.get() ? | 281 Shell::GetPrimaryRootWindow() == root_window_.get() ? |
282 NULL : Shell::GetPrimaryRootWindow()); | 282 NULL : Shell::GetPrimaryRootWindow()); |
283 } | 283 } |
284 | 284 |
285 CloseChildWindows(); | 285 CloseChildWindows(); |
286 GetRootWindowSettings(root_window_.get())->controller = NULL; | 286 GetRootWindowSettings(root_window_.get())->controller = NULL; |
287 screen_dimmer_.reset(); | 287 screen_dimmer_.reset(); |
288 workspace_controller_.reset(); | 288 workspace_controller_.reset(); |
289 // Forget with the display ID so that display lookup | 289 // Forget with the display ID so that display lookup |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 if (window->owned_by_parent()) { | 449 if (window->owned_by_parent()) { |
450 delete window; | 450 delete window; |
451 } else { | 451 } else { |
452 root_window_->RemoveChild(window); | 452 root_window_->RemoveChild(window); |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 shelf_.reset(NULL); | 456 shelf_.reset(NULL); |
457 } | 457 } |
458 | 458 |
459 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 459 void RootWindowController::MoveWindowsTo(aura::Window* dst) { |
460 // Forget the shelf early so that shelf don't update itself using wrong | 460 // Forget the shelf early so that shelf don't update itself using wrong |
461 // display info. | 461 // display info. |
462 workspace_controller_->SetShelf(NULL); | 462 workspace_controller_->SetShelf(NULL); |
463 ReparentAllWindows(root_window_.get(), dst); | 463 ReparentAllWindows(root_window_.get(), dst); |
464 } | 464 } |
465 | 465 |
466 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { | 466 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
467 return shelf_->shelf_layout_manager(); | 467 return shelf_->shelf_layout_manager(); |
468 } | 468 } |
469 | 469 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 } | 889 } |
890 | 890 |
891 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { | 891 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
892 if (enabled) | 892 if (enabled) |
893 EnableTouchHudProjection(); | 893 EnableTouchHudProjection(); |
894 else | 894 else |
895 DisableTouchHudProjection(); | 895 DisableTouchHudProjection(); |
896 } | 896 } |
897 | 897 |
898 RootWindowController* GetRootWindowController( | 898 RootWindowController* GetRootWindowController( |
899 const aura::RootWindow* root_window) { | 899 const aura::Window* root_window) { |
900 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 900 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
901 } | 901 } |
902 | 902 |
903 } // namespace internal | 903 } // namespace internal |
904 } // namespace ash | 904 } // namespace ash |
OLD | NEW |