| 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 "ash/wm/window_cycle_controller.h" | 5 #include "ash/wm/window_cycle_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
| 8 #include "ash/common/wm/mru_window_tracker.h" | 8 #include "ash/common/wm/mru_window_tracker.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 Shell::GetInstance()->window_cycle_controller()->StopCycling(); | 55 Shell::GetInstance()->window_cycle_controller()->StopCycling(); |
| 56 // Warning: |this| will be deleted from here on. | 56 // Warning: |this| will be deleted from here on. |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 ////////////////////////////////////////////////////////////////////////////// | 62 ////////////////////////////////////////////////////////////////////////////// |
| 63 // WindowCycleController, public: | 63 // WindowCycleController, public: |
| 64 | 64 |
| 65 WindowCycleController::WindowCycleController() { | 65 WindowCycleController::WindowCycleController() {} |
| 66 } | |
| 67 | 66 |
| 68 WindowCycleController::~WindowCycleController() { | 67 WindowCycleController::~WindowCycleController() {} |
| 69 } | |
| 70 | 68 |
| 71 // static | 69 // static |
| 72 bool WindowCycleController::CanCycle() { | 70 bool WindowCycleController::CanCycle() { |
| 73 // Prevent window cycling if the screen is locked or a modal dialog is open. | 71 // Prevent window cycling if the screen is locked or a modal dialog is open. |
| 74 WmShell* wm_shell = WmShell::Get(); | 72 WmShell* wm_shell = WmShell::Get(); |
| 75 return !wm_shell->GetSessionStateDelegate()->IsScreenLocked() && | 73 return !wm_shell->GetSessionStateDelegate()->IsScreenLocked() && |
| 76 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned(); | 74 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned(); |
| 77 } | 75 } |
| 78 | 76 |
| 79 void WindowCycleController::HandleCycleWindow(Direction direction) { | 77 void WindowCycleController::HandleCycleWindow(Direction direction) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 active_window_before_window_cycle_ != active_window_after_window_cycle) { | 119 active_window_before_window_cycle_ != active_window_after_window_cycle) { |
| 122 Shell::GetInstance() | 120 Shell::GetInstance() |
| 123 ->metrics() | 121 ->metrics() |
| 124 ->task_switch_metrics_recorder() | 122 ->task_switch_metrics_recorder() |
| 125 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER); | 123 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER); |
| 126 } | 124 } |
| 127 active_window_before_window_cycle_ = nullptr; | 125 active_window_before_window_cycle_ = nullptr; |
| 128 } | 126 } |
| 129 | 127 |
| 130 } // namespace ash | 128 } // namespace ash |
| OLD | NEW |