| 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_state_delegate.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" |
| 11 #include "ash/common/wm/window_cycle_list.h" | 11 #include "ash/common/wm/window_cycle_list.h" |
| 12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
| 15 #include "ash/public/cpp/shell_window_ids.h" | 15 #include "ash/public/cpp/shell_window_ids.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 31 // WindowCycleController, public: | 31 // WindowCycleController, public: |
| 32 | 32 |
| 33 WindowCycleController::WindowCycleController() {} | 33 WindowCycleController::WindowCycleController() {} |
| 34 | 34 |
| 35 WindowCycleController::~WindowCycleController() {} | 35 WindowCycleController::~WindowCycleController() {} |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 bool WindowCycleController::CanCycle() { | 38 bool WindowCycleController::CanCycle() { |
| 39 // Prevent window cycling if the screen is locked or a modal dialog is open. | 39 // Prevent window cycling if the screen is locked or a modal dialog is open. |
| 40 WmShell* wm_shell = WmShell::Get(); | 40 WmShell* wm_shell = WmShell::Get(); |
| 41 return !wm_shell->GetSessionStateDelegate()->IsScreenLocked() && | 41 return !wm_shell->session_controller()->IsScreenLocked() && |
| 42 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned(); | 42 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void WindowCycleController::HandleCycleWindow(Direction direction) { | 45 void WindowCycleController::HandleCycleWindow(Direction direction) { |
| 46 if (!CanCycle()) | 46 if (!CanCycle()) |
| 47 return; | 47 return; |
| 48 | 48 |
| 49 if (!IsCycling()) | 49 if (!IsCycling()) |
| 50 StartCycling(); | 50 StartCycling(); |
| 51 | 51 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 if (active_window_after_window_cycle != nullptr && | 118 if (active_window_after_window_cycle != nullptr && |
| 119 active_window_before_window_cycle_ != active_window_after_window_cycle) { | 119 active_window_before_window_cycle_ != active_window_after_window_cycle) { |
| 120 WmShell::Get()->RecordTaskSwitchMetric( | 120 WmShell::Get()->RecordTaskSwitchMetric( |
| 121 TaskSwitchSource::WINDOW_CYCLE_CONTROLLER); | 121 TaskSwitchSource::WINDOW_CYCLE_CONTROLLER); |
| 122 } | 122 } |
| 123 active_window_before_window_cycle_ = nullptr; | 123 active_window_before_window_cycle_ = nullptr; |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace ash | 126 } // namespace ash |
| OLD | NEW |