| 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 "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 bool rotation_locked() { | 27 bool rotation_locked() { |
| 28 return rotation_locked_; | 28 return rotation_locked_; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // If |rotation_locked| future calls to OnAccelerometerUpdated will not | 31 // If |rotation_locked| future calls to OnAccelerometerUpdated will not |
| 32 // change the display rotation. | 32 // change the display rotation. |
| 33 void set_rotation_locked(bool rotation_locked) { | 33 void set_rotation_locked(bool rotation_locked) { |
| 34 rotation_locked_ = rotation_locked; | 34 rotation_locked_ = rotation_locked; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // True if it is possible to enter maximize mode in the current |
| 38 // configuration. If this returns false, it should never be the case that |
| 39 // maximize mode becomes enabled. |
| 40 bool CanEnterMaximizeMode(); |
| 41 |
| 37 // AccelerometerObserver: | 42 // AccelerometerObserver: |
| 38 virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base, | 43 virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base, |
| 39 const gfx::Vector3dF& lid) OVERRIDE; | 44 const gfx::Vector3dF& lid) OVERRIDE; |
| 40 | 45 |
| 41 private: | 46 private: |
| 42 // Detect hinge rotation from |base| and |lid| accelerometers and | 47 // Detect hinge rotation from |base| and |lid| accelerometers and |
| 43 // automatically start / stop maximize mode. | 48 // automatically start / stop maximize mode. |
| 44 void HandleHingeRotation(const gfx::Vector3dF& base, | 49 void HandleHingeRotation(const gfx::Vector3dF& base, |
| 45 const gfx::Vector3dF& lid); | 50 const gfx::Vector3dF& lid); |
| 46 | 51 |
| 47 // Detect screen rotation from |lid| accelerometer and automatically rotate | 52 // Detect screen rotation from |lid| accelerometer and automatically rotate |
| 48 // screen. | 53 // screen. |
| 49 void HandleScreenRotation(const gfx::Vector3dF& lid); | 54 void HandleScreenRotation(const gfx::Vector3dF& lid); |
| 50 | 55 |
| 51 // Enables MaximizeModeWindowManager, and determines the current state of | 56 // Enables MaximizeModeWindowManager, and determines the current state of |
| 52 // rotation lock. | 57 // rotation lock. |
| 53 void EnterMaximizeMode(); | 58 void EnterMaximizeMode(); |
| 54 | 59 |
| 55 // Removes MaximizeModeWindowManager and resets the display rotation if there | 60 // Removes MaximizeModeWindowManager and resets the display rotation if there |
| 56 // is no rotation lock. | 61 // is no rotation lock. |
| 57 void LeaveMaximizeMode(); | 62 void LeaveMaximizeMode(); |
| 58 | 63 |
| 59 // An event handler which traps mouse and keyboard events while maximize | 64 // An event handler which traps mouse and keyboard events while maximize |
| 60 // mode is engaged. | 65 // mode is engaged. |
| 61 scoped_ptr<MaximizeModeEventBlocker> event_blocker_; | 66 scoped_ptr<MaximizeModeEventBlocker> event_blocker_; |
| 62 | 67 |
| 63 // When true calls to OnAccelerometerUpdated will not rotate the display. | 68 // When true calls to OnAccelerometerUpdated will not rotate the display. |
| 64 bool rotation_locked_; | 69 bool rotation_locked_; |
| 65 | 70 |
| 71 // Whether we have ever seen accelerometer data. |
| 72 bool have_seen_accelerometer_data_; |
| 73 |
| 66 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 74 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 67 }; | 75 }; |
| 68 | 76 |
| 69 } // namespace ash | 77 } // namespace ash |
| 70 | 78 |
| 71 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 79 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |