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/wm/window_cycle_controller.h" | 5 #include "ash/wm/window_cycle_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 else | 81 else |
82 AddAllChildren(container, windows); | 82 AddAllChildren(container, windows); |
83 } | 83 } |
84 | 84 |
85 } // namespace | 85 } // namespace |
86 | 86 |
87 ////////////////////////////////////////////////////////////////////////////// | 87 ////////////////////////////////////////////////////////////////////////////// |
88 // WindowCycleController, public: | 88 // WindowCycleController, public: |
89 | 89 |
90 WindowCycleController::WindowCycleController( | 90 WindowCycleController::WindowCycleController( |
91 internal::ActivationController* activation_controller) | 91 aura::client::ActivationClient* activation_client) |
92 : activation_controller_(activation_controller) { | 92 : ActivationChangeShim(Shell::GetInstance()), |
93 activation_controller_->AddObserver(this); | 93 activation_client_(activation_client) { |
| 94 activation_client_->AddObserver(this); |
94 } | 95 } |
95 | 96 |
96 WindowCycleController::~WindowCycleController() { | 97 WindowCycleController::~WindowCycleController() { |
97 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 98 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
98 for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); | 99 for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
99 iter != root_windows.end(); ++iter) { | 100 iter != root_windows.end(); ++iter) { |
100 for (size_t i = 0; i < arraysize(kContainerIds); ++i) { | 101 for (size_t i = 0; i < arraysize(kContainerIds); ++i) { |
101 aura::Window* container = Shell::GetContainer(*iter, kContainerIds[i]); | 102 aura::Window* container = Shell::GetContainer(*iter, kContainerIds[i]); |
102 if (container) | 103 if (container) |
103 container->RemoveObserver(this); | 104 container->RemoveObserver(this); |
104 } | 105 } |
105 aura::Window* default_container = | 106 aura::Window* default_container = |
106 Shell::GetContainer(*iter, internal::kShellWindowId_DefaultContainer); | 107 Shell::GetContainer(*iter, internal::kShellWindowId_DefaultContainer); |
107 if (default_container) { | 108 if (default_container) { |
108 for (size_t i = 0; i < default_container->children().size(); ++i) { | 109 for (size_t i = 0; i < default_container->children().size(); ++i) { |
109 aura::Window* workspace_window = default_container->children()[i]; | 110 aura::Window* workspace_window = default_container->children()[i]; |
110 DCHECK_EQ(internal::kShellWindowId_WorkspaceContainer, | 111 DCHECK_EQ(internal::kShellWindowId_WorkspaceContainer, |
111 workspace_window->id()); | 112 workspace_window->id()); |
112 workspace_window->RemoveObserver(this); | 113 workspace_window->RemoveObserver(this); |
113 } | 114 } |
114 } | 115 } |
115 } | 116 } |
116 | 117 |
117 activation_controller_->RemoveObserver(this); | 118 activation_client_->RemoveObserver(this); |
118 StopCycling(); | 119 StopCycling(); |
119 } | 120 } |
120 | 121 |
121 // static | 122 // static |
122 bool WindowCycleController::CanCycle() { | 123 bool WindowCycleController::CanCycle() { |
123 // Don't allow window cycling if the screen is locked or a modal dialog is | 124 // Don't allow window cycling if the screen is locked or a modal dialog is |
124 // open. | 125 // open. |
125 return !Shell::GetInstance()->IsScreenLocked() && | 126 return !Shell::GetInstance()->IsScreenLocked() && |
126 !Shell::GetInstance()->IsSystemModalWindowOpen(); | 127 !Shell::GetInstance()->IsSystemModalWindowOpen(); |
127 } | 128 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 mru_windows_.remove(window); | 284 mru_windows_.remove(window); |
284 if (window->id() == internal::kShellWindowId_WorkspaceContainer) | 285 if (window->id() == internal::kShellWindowId_WorkspaceContainer) |
285 window->RemoveObserver(this); | 286 window->RemoveObserver(this); |
286 } | 287 } |
287 | 288 |
288 void WindowCycleController::OnWindowDestroying(aura::Window* window) { | 289 void WindowCycleController::OnWindowDestroying(aura::Window* window) { |
289 window->RemoveObserver(this); | 290 window->RemoveObserver(this); |
290 } | 291 } |
291 | 292 |
292 } // namespace ash | 293 } // namespace ash |
OLD | NEW |