Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: ash/common/wm/window_cycle_controller.cc

Issue 2780943002: Enables ScreenPinningController for mash/mus (Closed)
Patch Set: local Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
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 "ash/shell.h" 16 #include "ash/shell.h"
17 #include "ash/wm/screen_pinning_controller.h"
17 #include "base/metrics/histogram_macros.h" 18 #include "base/metrics/histogram_macros.h"
18 19
19 namespace ash { 20 namespace ash {
20 21
21 namespace { 22 namespace {
22 23
23 // Returns the most recently active window from the |window_list| or nullptr 24 // Returns the most recently active window from the |window_list| or nullptr
24 // if the list is empty. 25 // if the list is empty.
25 WmWindow* GetActiveWindow(const MruWindowTracker::WindowList& window_list) { 26 WmWindow* GetActiveWindow(const MruWindowTracker::WindowList& window_list) {
26 return window_list.empty() ? nullptr : window_list[0]; 27 return window_list.empty() ? nullptr : window_list[0];
27 } 28 }
28 29
29 } // namespace 30 } // namespace
30 31
31 ////////////////////////////////////////////////////////////////////////////// 32 //////////////////////////////////////////////////////////////////////////////
32 // WindowCycleController, public: 33 // WindowCycleController, public:
33 34
34 WindowCycleController::WindowCycleController() {} 35 WindowCycleController::WindowCycleController() {}
35 36
36 WindowCycleController::~WindowCycleController() {} 37 WindowCycleController::~WindowCycleController() {}
37 38
38 // static 39 // static
39 bool WindowCycleController::CanCycle() { 40 bool WindowCycleController::CanCycle() {
40 // Prevent window cycling if the screen is locked or a modal dialog is open. 41 // Prevent window cycling if the screen is locked or a modal dialog is open.
41 WmShell* wm_shell = WmShell::Get(); 42 WmShell* wm_shell = WmShell::Get();
42 return !Shell::Get()->session_controller()->IsScreenLocked() && 43 return !Shell::Get()->session_controller()->IsScreenLocked() &&
43 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned(); 44 !wm_shell->IsSystemModalWindowOpen() &&
45 !Shell::Get()->screen_pinning_controller()->IsPinned();
44 } 46 }
45 47
46 void WindowCycleController::HandleCycleWindow(Direction direction) { 48 void WindowCycleController::HandleCycleWindow(Direction direction) {
47 if (!CanCycle()) 49 if (!CanCycle())
48 return; 50 return;
49 51
50 if (!IsCycling()) 52 if (!IsCycling())
51 StartCycling(); 53 StartCycling();
52 54
53 Step(direction); 55 Step(direction);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 120
119 if (active_window_after_window_cycle != nullptr && 121 if (active_window_after_window_cycle != nullptr &&
120 active_window_before_window_cycle_ != active_window_after_window_cycle) { 122 active_window_before_window_cycle_ != active_window_after_window_cycle) {
121 WmShell::Get()->RecordTaskSwitchMetric( 123 WmShell::Get()->RecordTaskSwitchMetric(
122 TaskSwitchSource::WINDOW_CYCLE_CONTROLLER); 124 TaskSwitchSource::WINDOW_CYCLE_CONTROLLER);
123 } 125 }
124 active_window_before_window_cycle_ = nullptr; 126 active_window_before_window_cycle_ = nullptr;
125 } 127 }
126 128
127 } // namespace ash 129 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/overview/window_selector_controller.cc ('k') | ash/common/wm/workspace/workspace_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698