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/desktop_background/desktop_background_widget_controller.h" | 9 #include "ash/desktop_background/desktop_background_widget_controller.h" |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // Set of windows to move. | 100 // Set of windows to move. |
101 const int kContainerIdsToMove[] = { | 101 const int kContainerIdsToMove[] = { |
102 internal::kShellWindowId_DefaultContainer, | 102 internal::kShellWindowId_DefaultContainer, |
103 internal::kShellWindowId_AlwaysOnTopContainer, | 103 internal::kShellWindowId_AlwaysOnTopContainer, |
104 internal::kShellWindowId_SystemModalContainer, | 104 internal::kShellWindowId_SystemModalContainer, |
105 internal::kShellWindowId_LockSystemModalContainer, | 105 internal::kShellWindowId_LockSystemModalContainer, |
106 internal::kShellWindowId_InputMethodContainer, | 106 internal::kShellWindowId_InputMethodContainer, |
107 }; | 107 }; |
108 // For Workspace2 we need to manually reparent the windows. This way | 108 // For Workspace2 we need to manually reparent the windows. This way |
109 // Workspace2 can move the windows to the appropriate workspace. | 109 // Workspace2 can move the windows to the appropriate workspace. |
110 if (internal::WorkspaceController::IsWorkspace2Enabled()) { | 110 std::vector<aura::Window*> windows(GetWorkspaceWindows(src)); |
111 std::vector<aura::Window*> windows(GetWorkspaceWindows(src)); | 111 internal::WorkspaceController* workspace_controller = |
112 internal::WorkspaceController* workspace_controller = | 112 GetRootWindowController(dst)->workspace_controller(); |
113 GetRootWindowController(dst)->workspace_controller(); | 113 for (size_t i = 0; i < windows.size(); ++i) { |
114 for (size_t i = 0; i < windows.size(); ++i) { | 114 aura::Window* new_parent = |
115 aura::Window* new_parent = | 115 workspace_controller->GetParentForNewWindow(windows[i]); |
116 workspace_controller->GetParentForNewWindow(windows[i]); | 116 ReparentWindow(windows[i], new_parent); |
117 ReparentWindow(windows[i], new_parent); | |
118 } | |
119 } | 117 } |
120 for (size_t i = 0; i < arraysize(kContainerIdsToMove); i++) { | 118 for (size_t i = 0; i < arraysize(kContainerIdsToMove); i++) { |
121 int id = kContainerIdsToMove[i]; | 119 int id = kContainerIdsToMove[i]; |
122 if (id == internal::kShellWindowId_DefaultContainer && | 120 if (id == internal::kShellWindowId_DefaultContainer) |
123 internal::WorkspaceController::IsWorkspace2Enabled()) | |
124 continue; | 121 continue; |
125 | 122 |
126 aura::Window* src_container = Shell::GetContainer(src, id); | 123 aura::Window* src_container = Shell::GetContainer(src, id); |
127 aura::Window* dst_container = Shell::GetContainer(dst, id); | 124 aura::Window* dst_container = Shell::GetContainer(dst, id); |
128 aura::Window::Windows children = src_container->children(); | 125 aura::Window::Windows children = src_container->children(); |
129 for (aura::Window::Windows::iterator iter = children.begin(); | 126 for (aura::Window::Windows::iterator iter = children.begin(); |
130 iter != children.end(); ++iter) { | 127 iter != children.end(); ++iter) { |
131 aura::Window* window = *iter; | 128 aura::Window* window = *iter; |
132 // Don't move modal screen. | 129 // Don't move modal screen. |
133 if (internal::SystemModalContainerLayoutManager::IsModalBackground( | 130 if (internal::SystemModalContainerLayoutManager::IsModalBackground( |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 343 |
347 while (!root_window_->children().empty()) { | 344 while (!root_window_->children().empty()) { |
348 aura::Window* child = root_window_->children()[0]; | 345 aura::Window* child = root_window_->children()[0]; |
349 delete child; | 346 delete child; |
350 } | 347 } |
351 | 348 |
352 // All containers are deleted, so reset shelf_. | 349 // All containers are deleted, so reset shelf_. |
353 shelf_ = NULL; | 350 shelf_ = NULL; |
354 } | 351 } |
355 | 352 |
356 bool RootWindowController::IsInMaximizedMode() const { | |
357 return workspace_controller_->IsInMaximizedMode(); | |
358 } | |
359 | |
360 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 353 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
361 aura::Window* focused = dst->GetFocusManager()->GetFocusedWindow(); | 354 aura::Window* focused = dst->GetFocusManager()->GetFocusedWindow(); |
362 aura::WindowTracker tracker; | 355 aura::WindowTracker tracker; |
363 if (focused) | 356 if (focused) |
364 tracker.Add(focused); | 357 tracker.Add(focused); |
365 aura::client::ActivationClient* activation_client = | 358 aura::client::ActivationClient* activation_client = |
366 aura::client::GetActivationClient(dst); | 359 aura::client::GetActivationClient(dst); |
367 aura::Window* active = activation_client->GetActiveWindow(); | 360 aura::Window* active = activation_client->GetActiveWindow(); |
368 if (active && focused != active) | 361 if (active && focused != active) |
369 tracker.Add(active); | 362 tracker.Add(active); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 root_window); | 447 root_window); |
455 | 448 |
456 CreateContainer(kShellWindowId_UnparentedControlContainer, | 449 CreateContainer(kShellWindowId_UnparentedControlContainer, |
457 "UnparentedControlContainer", | 450 "UnparentedControlContainer", |
458 non_lock_screen_containers); | 451 non_lock_screen_containers); |
459 | 452 |
460 aura::Window* default_container = CreateContainer( | 453 aura::Window* default_container = CreateContainer( |
461 kShellWindowId_DefaultContainer, | 454 kShellWindowId_DefaultContainer, |
462 "DefaultContainer", | 455 "DefaultContainer", |
463 non_lock_screen_containers); | 456 non_lock_screen_containers); |
464 if (!WorkspaceController::IsWorkspace2Enabled()) { | |
465 default_container_handler_.reset( | |
466 new ToplevelWindowEventHandler(default_container)); | |
467 } | |
468 SetChildWindowVisibilityChangesAnimated(default_container); | 457 SetChildWindowVisibilityChangesAnimated(default_container); |
469 SetUsesScreenCoordinates(default_container); | 458 SetUsesScreenCoordinates(default_container); |
470 | 459 |
471 aura::Window* always_on_top_container = CreateContainer( | 460 aura::Window* always_on_top_container = CreateContainer( |
472 kShellWindowId_AlwaysOnTopContainer, | 461 kShellWindowId_AlwaysOnTopContainer, |
473 "AlwaysOnTopContainer", | 462 "AlwaysOnTopContainer", |
474 non_lock_screen_containers); | 463 non_lock_screen_containers); |
475 always_on_top_container_handler_.reset( | 464 always_on_top_container_handler_.reset( |
476 new ToplevelWindowEventHandler(always_on_top_container)); | 465 new ToplevelWindowEventHandler(always_on_top_container)); |
477 SetChildWindowVisibilityChangesAnimated(always_on_top_container); | 466 SetChildWindowVisibilityChangesAnimated(always_on_top_container); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 552 |
564 aura::Window* overlay_container = CreateContainer( | 553 aura::Window* overlay_container = CreateContainer( |
565 kShellWindowId_OverlayContainer, | 554 kShellWindowId_OverlayContainer, |
566 "OverlayContainer", | 555 "OverlayContainer", |
567 lock_screen_related_containers); | 556 lock_screen_related_containers); |
568 SetUsesScreenCoordinates(overlay_container); | 557 SetUsesScreenCoordinates(overlay_container); |
569 } | 558 } |
570 | 559 |
571 } // namespace internal | 560 } // namespace internal |
572 } // namespace ash | 561 } // namespace ash |
OLD | NEW |