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 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
7 | 7 |
8 #include "ash/accelerometer/accelerometer_observer.h" | 8 #include "ash/accelerometer/accelerometer_observer.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" |
10 | 11 |
11 namespace ash { | 12 namespace ash { |
12 | 13 |
| 14 class MaximizeModeEventBlocker; |
| 15 |
13 // MaximizeModeController listens to accelerometer events and automatically | 16 // MaximizeModeController listens to accelerometer events and automatically |
14 // enters and exits maximize mode when the lid is opened beyond the triggering | 17 // enters and exits maximize mode when the lid is opened beyond the triggering |
15 // angle and rotates the display to match the device when in maximize mode. | 18 // angle and rotates the display to match the device when in maximize mode. |
16 class MaximizeModeController : public AccelerometerObserver { | 19 class MaximizeModeController : public AccelerometerObserver { |
17 public: | 20 public: |
18 MaximizeModeController(); | 21 MaximizeModeController(); |
19 virtual ~MaximizeModeController(); | 22 virtual ~MaximizeModeController(); |
20 | 23 |
| 24 // AccelerometerObserver: |
21 virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base, | 25 virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base, |
22 const gfx::Vector3dF& lid) OVERRIDE; | 26 const gfx::Vector3dF& lid) OVERRIDE; |
23 private: | 27 private: |
24 // Detect hinge rotation from |base| and |lid| accelerometers and | 28 // Detect hinge rotation from |base| and |lid| accelerometers and |
25 // automatically start / stop maximize mode. | 29 // automatically start / stop maximize mode. |
26 void HandleHingeRotation(const gfx::Vector3dF& base, | 30 void HandleHingeRotation(const gfx::Vector3dF& base, |
27 const gfx::Vector3dF& lid); | 31 const gfx::Vector3dF& lid); |
28 | 32 |
29 // Detect screen rotation from |lid| accelerometer and automatically rotate | 33 // Detect screen rotation from |lid| accelerometer and automatically rotate |
30 // screen. | 34 // screen. |
31 void HandleScreenRotation(const gfx::Vector3dF& lid); | 35 void HandleScreenRotation(const gfx::Vector3dF& lid); |
32 | 36 |
| 37 // An event handler which traps mouse and keyboard events while maximize |
| 38 // mode is engaged. |
| 39 scoped_ptr<MaximizeModeEventBlocker> event_blocker_; |
| 40 |
33 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 41 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
34 }; | 42 }; |
35 | 43 |
36 } // namespace ash | 44 } // namespace ash |
37 | 45 |
38 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 46 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
OLD | NEW |