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

Side by Side Diff: ash/system/chromeos/power/tablet_power_button_controller.cc

Issue 2766543002: Move even more from WmShell to Shell (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « ash/shell.cc ('k') | ash/system/chromeos/power/tablet_power_button_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/system/chromeos/power/tablet_power_button_controller.h" 5 #include "ash/system/chromeos/power/tablet_power_button_controller.h"
6 6
7 #include "ash/common/accessibility_delegate.h" 7 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/session/session_controller.h" 8 #include "ash/common/session/session_controller.h"
9 #include "ash/common/shell_delegate.h" 9 #include "ash/common/shell_delegate.h"
10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
(...skipping 25 matching lines...) Expand all
36 constexpr int kIgnorePowerButtonAfterResumeMs = 2000; 36 constexpr int kIgnorePowerButtonAfterResumeMs = 2000;
37 37
38 // Ignore button-up events occurring within this many milliseconds of the 38 // Ignore button-up events occurring within this many milliseconds of the
39 // previous button-up event. This prevents us from falling behind if the power 39 // previous button-up event. This prevents us from falling behind if the power
40 // button is pressed repeatedly. 40 // button is pressed repeatedly.
41 constexpr int kIgnoreRepeatedButtonUpMs = 500; 41 constexpr int kIgnoreRepeatedButtonUpMs = 500;
42 42
43 // Returns true if device is a convertible/tablet device, otherwise false. 43 // Returns true if device is a convertible/tablet device, otherwise false.
44 bool IsTabletModeSupported() { 44 bool IsTabletModeSupported() {
45 MaximizeModeController* maximize_mode_controller = 45 MaximizeModeController* maximize_mode_controller =
46 WmShell::Get()->maximize_mode_controller(); 46 Shell::Get()->maximize_mode_controller();
47 return maximize_mode_controller && 47 return maximize_mode_controller &&
48 maximize_mode_controller->CanEnterMaximizeMode(); 48 maximize_mode_controller->CanEnterMaximizeMode();
49 } 49 }
50 50
51 // Returns true if device is currently in tablet/maximize mode, otherwise false. 51 // Returns true if device is currently in tablet/maximize mode, otherwise false.
52 bool IsTabletModeActive() { 52 bool IsTabletModeActive() {
53 MaximizeModeController* maximize_mode_controller = 53 MaximizeModeController* maximize_mode_controller =
54 WmShell::Get()->maximize_mode_controller(); 54 Shell::Get()->maximize_mode_controller();
55 return maximize_mode_controller && 55 return maximize_mode_controller &&
56 maximize_mode_controller->IsMaximizeModeWindowManagerEnabled(); 56 maximize_mode_controller->IsMaximizeModeWindowManagerEnabled();
57 } 57 }
58 58
59 } // namespace 59 } // namespace
60 60
61 TabletPowerButtonController::TestApi::TestApi( 61 TabletPowerButtonController::TestApi::TestApi(
62 TabletPowerButtonController* controller) 62 TabletPowerButtonController* controller)
63 : controller_(controller) {} 63 : controller_(controller) {}
64 64
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 SessionController* session_controller = WmShell::Get()->session_controller(); 255 SessionController* session_controller = WmShell::Get()->session_controller();
256 if (session_controller->ShouldLockScreenAutomatically() && 256 if (session_controller->ShouldLockScreenAutomatically() &&
257 session_controller->CanLockScreen() && 257 session_controller->CanLockScreen() &&
258 !session_controller->IsUserSessionBlocked() && 258 !session_controller->IsUserSessionBlocked() &&
259 !controller_->LockRequested()) { 259 !controller_->LockRequested()) {
260 session_controller->LockScreen(); 260 session_controller->LockScreen();
261 } 261 }
262 } 262 }
263 263
264 } // namespace ash 264 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/system/chromeos/power/tablet_power_button_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698