| 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 "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 class EventHandler; | 15 class EventHandler; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 | 19 |
| 20 class MaximizeModeControllerTest; |
| 20 class MaximizeModeEventBlocker; | 21 class MaximizeModeEventBlocker; |
| 21 | 22 |
| 22 // MaximizeModeController listens to accelerometer events and automatically | 23 // MaximizeModeController listens to accelerometer events and automatically |
| 23 // enters and exits maximize mode when the lid is opened beyond the triggering | 24 // enters and exits maximize mode when the lid is opened beyond the triggering |
| 24 // angle and rotates the display to match the device when in maximize mode. | 25 // angle and rotates the display to match the device when in maximize mode. |
| 25 class ASH_EXPORT MaximizeModeController : public AccelerometerObserver { | 26 class ASH_EXPORT MaximizeModeController : public AccelerometerObserver { |
| 26 public: | 27 public: |
| 27 MaximizeModeController(); | 28 MaximizeModeController(); |
| 28 virtual ~MaximizeModeController(); | 29 virtual ~MaximizeModeController(); |
| 29 | 30 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 46 // True if it is possible to enter maximize mode in the current | 47 // True if it is possible to enter maximize mode in the current |
| 47 // configuration. If this returns false, it should never be the case that | 48 // configuration. If this returns false, it should never be the case that |
| 48 // maximize mode becomes enabled. | 49 // maximize mode becomes enabled. |
| 49 bool CanEnterMaximizeMode(); | 50 bool CanEnterMaximizeMode(); |
| 50 | 51 |
| 51 // AccelerometerObserver: | 52 // AccelerometerObserver: |
| 52 virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base, | 53 virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base, |
| 53 const gfx::Vector3dF& lid) OVERRIDE; | 54 const gfx::Vector3dF& lid) OVERRIDE; |
| 54 | 55 |
| 55 private: | 56 private: |
| 57 friend class MaximizeModeControllerTest; |
| 58 |
| 56 // Detect hinge rotation from |base| and |lid| accelerometers and | 59 // Detect hinge rotation from |base| and |lid| accelerometers and |
| 57 // automatically start / stop maximize mode. | 60 // automatically start / stop maximize mode. |
| 58 void HandleHingeRotation(const gfx::Vector3dF& base, | 61 void HandleHingeRotation(const gfx::Vector3dF& base, |
| 59 const gfx::Vector3dF& lid); | 62 const gfx::Vector3dF& lid); |
| 60 | 63 |
| 61 // Detect screen rotation from |lid| accelerometer and automatically rotate | 64 // Detect screen rotation from |lid| accelerometer and automatically rotate |
| 62 // screen. | 65 // screen. |
| 63 void HandleScreenRotation(const gfx::Vector3dF& lid); | 66 void HandleScreenRotation(const gfx::Vector3dF& lid); |
| 64 | 67 |
| 65 // Sets the display rotation and suppresses display notifications. | 68 // Sets the display rotation and suppresses display notifications. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 | 84 |
| 82 // True when the screen's orientation is being changed. | 85 // True when the screen's orientation is being changed. |
| 83 bool in_set_screen_rotation_; | 86 bool in_set_screen_rotation_; |
| 84 | 87 |
| 85 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 88 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 } // namespace ash | 91 } // namespace ash |
| 89 | 92 |
| 90 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 93 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |