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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 return; | 206 return; |
207 | 207 |
208 bezel_controller_->set_left_right_delegate(NULL); | 208 bezel_controller_->set_left_right_delegate(NULL); |
209 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); | 209 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); |
210 | 210 |
211 // Note: The window_list_provider_ resembles the exact window list of the | 211 // Note: The window_list_provider_ resembles the exact window list of the |
212 // container, so no re-stacking is required before showing the OverviewMode. | 212 // container, so no re-stacking is required before showing the OverviewMode. |
213 overview_ = WindowOverviewMode::Create( | 213 overview_ = WindowOverviewMode::Create( |
214 container_.get(), window_list_provider_.get(), | 214 container_.get(), window_list_provider_.get(), |
215 split_view_controller_.get(), this); | 215 split_view_controller_.get(), this); |
| 216 AcceleratorManager::Get()->RegisterAccelerator(kEscAcceleratorData, this); |
216 } | 217 } |
217 | 218 |
218 void WindowManagerImpl::ExitOverview() { | 219 void WindowManagerImpl::ExitOverview() { |
219 if (!IsOverviewModeActive()) | 220 if (!IsOverviewModeActive()) |
220 return; | 221 return; |
221 | 222 |
222 ExitOverviewNoActivate(); | 223 ExitOverviewNoActivate(); |
223 | 224 |
224 // Activate the window which was active prior to entering overview. | 225 // Activate the window which was active prior to entering overview. |
225 const aura::Window::Windows windows = window_list_provider_->GetWindowList(); | 226 const aura::Window::Windows windows = window_list_provider_->GetWindowList(); |
(...skipping 11 matching lines...) Expand all Loading... |
237 return overview_; | 238 return overview_; |
238 } | 239 } |
239 | 240 |
240 void WindowManagerImpl::ExitOverviewNoActivate() { | 241 void WindowManagerImpl::ExitOverviewNoActivate() { |
241 if (!IsOverviewModeActive()) | 242 if (!IsOverviewModeActive()) |
242 return; | 243 return; |
243 | 244 |
244 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); | 245 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
245 overview_.reset(); | 246 overview_.reset(); |
246 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); | 247 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); |
| 248 AcceleratorManager::Get()->UnregisterAccelerator(kEscAcceleratorData, this); |
247 } | 249 } |
248 | 250 |
249 void WindowManagerImpl::InstallAccelerators() { | 251 void WindowManagerImpl::InstallAccelerators() { |
250 const AcceleratorData accelerator_data[] = { | 252 const AcceleratorData accelerator_data[] = { |
251 {TRIGGER_ON_PRESS, | 253 {TRIGGER_ON_PRESS, |
252 ui::VKEY_F6, | 254 ui::VKEY_F6, |
253 ui::EF_NONE, | 255 ui::EF_NONE, |
254 CMD_TOGGLE_OVERVIEW, | 256 CMD_TOGGLE_OVERVIEW, |
255 AF_NONE}, | 257 AF_NONE}, |
256 {TRIGGER_ON_PRESS, | 258 {TRIGGER_ON_PRESS, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 container_.reset(); | 337 container_.reset(); |
336 } | 338 } |
337 | 339 |
338 bool WindowManagerImpl::IsCommandEnabled(int command_id) const { | 340 bool WindowManagerImpl::IsCommandEnabled(int command_id) const { |
339 return true; | 341 return true; |
340 } | 342 } |
341 | 343 |
342 bool WindowManagerImpl::OnAcceleratorFired(int command_id, | 344 bool WindowManagerImpl::OnAcceleratorFired(int command_id, |
343 const ui::Accelerator& accelerator) { | 345 const ui::Accelerator& accelerator) { |
344 switch (command_id) { | 346 switch (command_id) { |
| 347 case CMD_EXIT_OVERVIEW: |
| 348 ExitOverview(); |
| 349 break; |
345 case CMD_TOGGLE_OVERVIEW: | 350 case CMD_TOGGLE_OVERVIEW: |
346 if (IsOverviewModeActive()) | 351 if (IsOverviewModeActive()) |
347 ExitOverview(); | 352 ExitOverview(); |
348 else | 353 else |
349 EnterOverview(); | 354 EnterOverview(); |
350 break; | 355 break; |
351 case CMD_TOGGLE_SPLIT_VIEW: | 356 case CMD_TOGGLE_SPLIT_VIEW: |
352 ToggleSplitView(); | 357 ToggleSplitView(); |
353 break; | 358 break; |
354 } | 359 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 DCHECK(!instance); | 453 DCHECK(!instance); |
449 } | 454 } |
450 | 455 |
451 // static | 456 // static |
452 WindowManager* WindowManager::Get() { | 457 WindowManager* WindowManager::Get() { |
453 DCHECK(instance); | 458 DCHECK(instance); |
454 return instance; | 459 return instance; |
455 } | 460 } |
456 | 461 |
457 } // namespace athena | 462 } // namespace athena |
OLD | NEW |