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