OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/wm/window_manager_impl.h" | 5 #include "athena/wm/window_manager_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "athena/screen/public/screen_manager.h" | 9 #include "athena/screen/public/screen_manager.h" |
10 #include "athena/util/container_priorities.h" | 10 #include "athena/util/container_priorities.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void WindowManagerImpl::SetInOverview(bool active) { | 177 void WindowManagerImpl::SetInOverview(bool active) { |
178 bool in_overview = !!overview_; | 178 bool in_overview = !!overview_; |
179 if (active == in_overview) | 179 if (active == in_overview) |
180 return; | 180 return; |
181 | 181 |
182 bezel_controller_->set_left_right_delegate( | 182 bezel_controller_->set_left_right_delegate( |
183 active ? NULL : split_view_controller_.get()); | 183 active ? NULL : split_view_controller_.get()); |
184 if (active) { | 184 if (active) { |
185 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); | 185 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); |
186 | 186 |
187 // Re-stack all windows in the order defined by window_list_provider_. | 187 // Note: The window_list_provider_ resembles the exact window list of the |
188 aura::Window::Windows window_list = window_list_provider_->GetWindowList(); | 188 // container, so no re-stacking is required before showing the OverviewMode. |
189 aura::Window::Windows::iterator it; | |
190 for (it = window_list.begin(); it != window_list.end(); ++it) | |
191 container_->StackChildAtTop(*it); | |
192 overview_ = WindowOverviewMode::Create( | 189 overview_ = WindowOverviewMode::Create( |
193 container_.get(), window_list_provider_.get(), | 190 container_.get(), window_list_provider_.get(), |
194 split_view_controller_.get(), this); | 191 split_view_controller_.get(), this); |
195 } else { | 192 } else { |
196 overview_.reset(); | 193 overview_.reset(); |
197 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); | 194 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); |
198 } | 195 } |
199 } | 196 } |
200 | 197 |
201 void WindowManagerImpl::InstallAccelerators() { | 198 void WindowManagerImpl::InstallAccelerators() { |
(...skipping 12 matching lines...) Expand all Loading... |
214 } | 211 } |
215 | 212 |
216 void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) { | 213 void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) { |
217 observers_.RemoveObserver(observer); | 214 observers_.RemoveObserver(observer); |
218 } | 215 } |
219 | 216 |
220 void WindowManagerImpl::ToggleSplitViewForTest() { | 217 void WindowManagerImpl::ToggleSplitViewForTest() { |
221 ToggleSplitview(); | 218 ToggleSplitview(); |
222 } | 219 } |
223 | 220 |
| 221 WindowListProvider* WindowManagerImpl::GetWindowListProvider() { |
| 222 return window_list_provider_.get(); |
| 223 } |
| 224 |
224 void WindowManagerImpl::OnSelectWindow(aura::Window* window) { | 225 void WindowManagerImpl::OnSelectWindow(aura::Window* window) { |
225 if (split_view_controller_->IsSplitViewModeActive()) { | 226 if (split_view_controller_->IsSplitViewModeActive()) { |
226 split_view_controller_->DeactivateSplitMode(); | 227 split_view_controller_->DeactivateSplitMode(); |
227 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeExit()); | 228 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeExit()); |
228 } | 229 } |
229 wm::ActivateWindow(window); | 230 wm::ActivateWindow(window); |
230 SetInOverview(false); | 231 SetInOverview(false); |
231 // If |window| does not have the size of the work-area, then make sure it is | 232 // If |window| does not have the size of the work-area, then make sure it is |
232 // resized. | 233 // resized. |
233 const gfx::Size work_area = | 234 const gfx::Size work_area = |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 DCHECK(!instance); | 402 DCHECK(!instance); |
402 } | 403 } |
403 | 404 |
404 // static | 405 // static |
405 WindowManager* WindowManager::GetInstance() { | 406 WindowManager* WindowManager::GetInstance() { |
406 DCHECK(instance); | 407 DCHECK(instance); |
407 return instance; | 408 return instance; |
408 } | 409 } |
409 | 410 |
410 } // namespace athena | 411 } // namespace athena |
OLD | NEW |