| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef ASH_WM_POWER_BUTTON_CONTROLLER_H_ | 5 #ifndef ASH_WM_POWER_BUTTON_CONTROLLER_H_ |
| 6 #define ASH_WM_POWER_BUTTON_CONTROLLER_H_ | 6 #define ASH_WM_POWER_BUTTON_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "base/timer.h" | 13 #include "base/timer.h" |
| 14 #include "ui/aura/root_window_observer.h" | 14 #include "ui/aura/root_window_observer.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Size; | 17 class Size; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 class Layer; | 21 class Layer; |
| 22 class LayerDelegate; | |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace ash { | 24 namespace ash { |
| 26 | 25 |
| 27 // Performs system-related functions on behalf of PowerButtonController. | 26 // Performs system-related functions on behalf of PowerButtonController. |
| 28 class ASH_EXPORT PowerButtonControllerDelegate { | 27 class ASH_EXPORT PowerButtonControllerDelegate { |
| 29 public: | 28 public: |
| 30 PowerButtonControllerDelegate() {} | 29 PowerButtonControllerDelegate() {} |
| 31 virtual ~PowerButtonControllerDelegate() {} | 30 virtual ~PowerButtonControllerDelegate() {} |
| 32 | 31 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 void OnStartingLock(); | 146 void OnStartingLock(); |
| 148 | 147 |
| 149 // Called when the power or lock buttons are pressed or released. | 148 // Called when the power or lock buttons are pressed or released. |
| 150 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); | 149 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); |
| 151 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); | 150 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); |
| 152 | 151 |
| 153 // aura::RootWindowObserver overrides: | 152 // aura::RootWindowObserver overrides: |
| 154 virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE; | 153 virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE; |
| 155 | 154 |
| 156 private: | 155 private: |
| 157 class BackgroundLayerDelegate; | |
| 158 | |
| 159 // Requests that the screen be locked and starts |lock_fail_timer_|. | 156 // Requests that the screen be locked and starts |lock_fail_timer_|. |
| 160 void OnLockTimeout(); | 157 void OnLockTimeout(); |
| 161 | 158 |
| 162 // Aborts the pre-lock animation. | 159 // Aborts the pre-lock animation. |
| 163 void OnLockFailTimeout(); | 160 void OnLockFailTimeout(); |
| 164 | 161 |
| 165 // Displays the pre-shutdown animation and starts |shutdown_timer_|. | 162 // Displays the pre-shutdown animation and starts |shutdown_timer_|. |
| 166 void OnLockToShutdownTimeout(); | 163 void OnLockToShutdownTimeout(); |
| 167 | 164 |
| 168 // Displays the shutdown animation and starts |real_shutdown_timer_|. | 165 // Displays the shutdown animation and starts |real_shutdown_timer_|. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 196 bool shutting_down_; | 193 bool shutting_down_; |
| 197 | 194 |
| 198 // Should we start |shutdown_timer_| when we receive notification that the | 195 // Should we start |shutdown_timer_| when we receive notification that the |
| 199 // screen has been locked? | 196 // screen has been locked? |
| 200 bool should_start_shutdown_timer_after_lock_; | 197 bool should_start_shutdown_timer_after_lock_; |
| 201 | 198 |
| 202 // Was a command-line switch set telling us that we're running on hardware | 199 // Was a command-line switch set telling us that we're running on hardware |
| 203 // that misreports power button releases? | 200 // that misreports power button releases? |
| 204 bool has_legacy_power_button_; | 201 bool has_legacy_power_button_; |
| 205 | 202 |
| 206 // Responsible for painting |background_layer_|. | |
| 207 scoped_ptr<BackgroundLayerDelegate> background_layer_delegate_; | |
| 208 | |
| 209 // Layer that's stacked under all of the root window's children to provide a | 203 // Layer that's stacked under all of the root window's children to provide a |
| 210 // black background when we're scaling all of the other windows down. | 204 // black background when we're scaling all of the other windows down. |
| 211 scoped_ptr<ui::Layer> background_layer_; | 205 scoped_ptr<ui::Layer> background_layer_; |
| 212 | 206 |
| 213 // Started when the user first presses the power button while in a | 207 // Started when the user first presses the power button while in a |
| 214 // logged-in-as-a-non-guest-user, unlocked state. When it fires, we lock the | 208 // logged-in-as-a-non-guest-user, unlocked state. When it fires, we lock the |
| 215 // screen. | 209 // screen. |
| 216 base::OneShotTimer<PowerButtonController> lock_timer_; | 210 base::OneShotTimer<PowerButtonController> lock_timer_; |
| 217 | 211 |
| 218 // Started when we request that the screen be locked. When it fires, we | 212 // Started when we request that the screen be locked. When it fires, we |
| (...skipping 18 matching lines...) Expand all Loading... |
| 237 // |background_layer_|, as the desktop background is now covering the whole | 231 // |background_layer_|, as the desktop background is now covering the whole |
| 238 // screen. | 232 // screen. |
| 239 base::OneShotTimer<PowerButtonController> hide_background_layer_timer_; | 233 base::OneShotTimer<PowerButtonController> hide_background_layer_timer_; |
| 240 | 234 |
| 241 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); | 235 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); |
| 242 }; | 236 }; |
| 243 | 237 |
| 244 } // namespace ash | 238 } // namespace ash |
| 245 | 239 |
| 246 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ | 240 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ |
| OLD | NEW |