| 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/common/container_priorities.h" | 9 #include "athena/common/container_priorities.h" |
| 10 #include "athena/screen/public/screen_manager.h" | 10 #include "athena/screen/public/screen_manager.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return overview_; | 174 return overview_; |
| 175 } | 175 } |
| 176 | 176 |
| 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 |
| 185 aura::Window::Windows window_list = window_list_provider_->GetWindowList(); |
| 184 if (active) { | 186 if (active) { |
| 185 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); | 187 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); |
| 186 | 188 |
| 187 // Re-stack all windows in the order defined by window_list_provider_. | 189 // Re-stack all windows in the order defined by window_list_provider_. |
| 188 aura::Window::Windows window_list = window_list_provider_->GetWindowList(); | 190 for (aura::Window::Windows::iterator it = window_list.begin(); |
| 189 aura::Window::Windows::iterator it; | 191 it != window_list.end(); |
| 190 for (it = window_list.begin(); it != window_list.end(); ++it) | 192 ++it) { |
| 191 container_->StackChildAtTop(*it); | 193 container_->StackChildAtTop(*it); |
| 194 |
| 195 if (wm::IsActiveWindow(*it)) |
| 196 wm::ActivateWindow(NULL); |
| 197 } |
| 192 overview_ = WindowOverviewMode::Create( | 198 overview_ = WindowOverviewMode::Create( |
| 193 container_.get(), window_list_provider_.get(), | 199 container_.get(), window_list_provider_.get(), |
| 194 split_view_controller_.get(), this); | 200 split_view_controller_.get(), this); |
| 195 } else { | 201 } else { |
| 202 // Select the topmost window in |window_list| if no member of |window_list| |
| 203 // is active upon exiting overview mode. |
| 204 aura::client::ActivationClient* activation_client = |
| 205 aura::client::GetActivationClient(container_->GetRootWindow()); |
| 206 aura::Window* active = activation_client->GetActiveWindow(); |
| 207 aura::Window::Windows::iterator it = |
| 208 std::find(window_list.begin(), window_list.end(), active); |
| 209 if (it == window_list.end()) |
| 210 OnSelectWindow(*window_list.rbegin()); |
| 211 |
| 196 overview_.reset(); | 212 overview_.reset(); |
| 197 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); | 213 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); |
| 198 } | 214 } |
| 199 } | 215 } |
| 200 | 216 |
| 201 void WindowManagerImpl::InstallAccelerators() { | 217 void WindowManagerImpl::InstallAccelerators() { |
| 202 const AcceleratorData accelerator_data[] = { | 218 const AcceleratorData accelerator_data[] = { |
| 203 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, CMD_TOGGLE_OVERVIEW, | 219 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, CMD_TOGGLE_OVERVIEW, |
| 204 AF_NONE}, | 220 AF_NONE}, |
| 205 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_CONTROL_DOWN, | 221 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_CONTROL_DOWN, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 DCHECK(!instance); | 415 DCHECK(!instance); |
| 400 } | 416 } |
| 401 | 417 |
| 402 // static | 418 // static |
| 403 WindowManager* WindowManager::GetInstance() { | 419 WindowManager* WindowManager::GetInstance() { |
| 404 DCHECK(instance); | 420 DCHECK(instance); |
| 405 return instance; | 421 return instance; |
| 406 } | 422 } |
| 407 | 423 |
| 408 } // namespace athena | 424 } // namespace athena |
| OLD | NEW |