| OLD | NEW |
| 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_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.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 14 matching lines...) Expand all Loading... |
| 25 // animation when in tablet mode. | 25 // animation when in tablet mode. |
| 26 constexpr int kShutdownTimeoutMs = 500; | 26 constexpr int kShutdownTimeoutMs = 500; |
| 27 | 27 |
| 28 // Amount of time to delay locking screen after display is forced off. | 28 // Amount of time to delay locking screen after display is forced off. |
| 29 constexpr int kLockScreenTimeoutMs = 1000; | 29 constexpr int kLockScreenTimeoutMs = 1000; |
| 30 | 30 |
| 31 // Amount of time since last SuspendDone() that power button event needs to be | 31 // Amount of time since last SuspendDone() that power button event needs to be |
| 32 // ignored. | 32 // ignored. |
| 33 constexpr int kIgnorePowerButtonAfterResumeMs = 2000; | 33 constexpr int kIgnorePowerButtonAfterResumeMs = 2000; |
| 34 | 34 |
| 35 // Returns true if device is a convertible/tablet device or has | 35 // Returns true if device is a convertible/tablet device, otherwise false. |
| 36 // kAshEnableTouchViewTesting in test, otherwise false. | |
| 37 bool IsTabletModeSupported() { | 36 bool IsTabletModeSupported() { |
| 38 MaximizeModeController* maximize_mode_controller = | 37 MaximizeModeController* maximize_mode_controller = |
| 39 WmShell::Get()->maximize_mode_controller(); | 38 WmShell::Get()->maximize_mode_controller(); |
| 40 return maximize_mode_controller && | 39 return maximize_mode_controller && |
| 41 maximize_mode_controller->CanEnterMaximizeMode(); | 40 maximize_mode_controller->CanEnterMaximizeMode(); |
| 42 } | 41 } |
| 43 | 42 |
| 44 // Returns true if device is currently in tablet/maximize mode, otherwise false. | 43 // Returns true if device is currently in tablet/maximize mode, otherwise false. |
| 45 bool IsTabletModeActive() { | 44 bool IsTabletModeActive() { |
| 46 MaximizeModeController* maximize_mode_controller = | 45 MaximizeModeController* maximize_mode_controller = |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 FROM_HERE, base::TimeDelta::FromMilliseconds(kLockScreenTimeoutMs), | 256 FROM_HERE, base::TimeDelta::FromMilliseconds(kLockScreenTimeoutMs), |
| 258 this, &TabletPowerButtonController::OnLockScreenTimeout); | 257 this, &TabletPowerButtonController::OnLockScreenTimeout); |
| 259 } | 258 } |
| 260 } | 259 } |
| 261 | 260 |
| 262 void TabletPowerButtonController::OnLockScreenTimeout() { | 261 void TabletPowerButtonController::OnLockScreenTimeout() { |
| 263 WmShell::Get()->GetSessionStateDelegate()->LockScreen(); | 262 WmShell::Get()->GetSessionStateDelegate()->LockScreen(); |
| 264 } | 263 } |
| 265 | 264 |
| 266 } // namespace ash | 265 } // namespace ash |
| OLD | NEW |