| 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/common/wm/window_cycle_controller.h" | 5 #include "ash/common/wm/window_cycle_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/metrics/task_switch_source.h" | 7 #include "ash/common/metrics/task_switch_source.h" |
| 8 #include "ash/common/session/session_controller.h" | 8 #include "ash/common/session/session_controller.h" |
| 9 #include "ash/common/wm/mru_window_tracker.h" | 9 #include "ash/common/wm/mru_window_tracker.h" |
| 10 #include "ash/common/wm/window_cycle_event_filter.h" | 10 #include "ash/common/wm/window_cycle_event_filter.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // WindowCycleController, public: | 32 // WindowCycleController, public: |
| 33 | 33 |
| 34 WindowCycleController::WindowCycleController() {} | 34 WindowCycleController::WindowCycleController() {} |
| 35 | 35 |
| 36 WindowCycleController::~WindowCycleController() {} | 36 WindowCycleController::~WindowCycleController() {} |
| 37 | 37 |
| 38 // static | 38 // static |
| 39 bool WindowCycleController::CanCycle() { | 39 bool WindowCycleController::CanCycle() { |
| 40 // Prevent window cycling if the screen is locked or a modal dialog is open. | 40 // Prevent window cycling if the screen is locked or a modal dialog is open. |
| 41 WmShell* wm_shell = WmShell::Get(); | 41 WmShell* wm_shell = WmShell::Get(); |
| 42 return !wm_shell->session_controller()->IsScreenLocked() && | 42 return !Shell::Get()->session_controller()->IsScreenLocked() && |
| 43 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned(); | 43 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void WindowCycleController::HandleCycleWindow(Direction direction) { | 46 void WindowCycleController::HandleCycleWindow(Direction direction) { |
| 47 if (!CanCycle()) | 47 if (!CanCycle()) |
| 48 return; | 48 return; |
| 49 | 49 |
| 50 if (!IsCycling()) | 50 if (!IsCycling()) |
| 51 StartCycling(); | 51 StartCycling(); |
| 52 | 52 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 if (active_window_after_window_cycle != nullptr && | 119 if (active_window_after_window_cycle != nullptr && |
| 120 active_window_before_window_cycle_ != active_window_after_window_cycle) { | 120 active_window_before_window_cycle_ != active_window_after_window_cycle) { |
| 121 WmShell::Get()->RecordTaskSwitchMetric( | 121 WmShell::Get()->RecordTaskSwitchMetric( |
| 122 TaskSwitchSource::WINDOW_CYCLE_CONTROLLER); | 122 TaskSwitchSource::WINDOW_CYCLE_CONTROLLER); |
| 123 } | 123 } |
| 124 active_window_before_window_cycle_ = nullptr; | 124 active_window_before_window_cycle_ = nullptr; |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace ash | 127 } // namespace ash |
| OLD | NEW |