Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / ash / wm / maximize_mode / maximize_mode_controller.h
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
7
8 #include "ash/accelerometer/accelerometer_observer.h"
9 #include "base/macros.h"
10
11 namespace ash {
12
13 // MaximizeModeController listens to accelerometer events and automatically
14 // 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.
16 class MaximizeModeController : public AccelerometerObserver {
17  public:
18   MaximizeModeController();
19   virtual ~MaximizeModeController();
20
21   virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base,
22                                       const gfx::Vector3dF& lid) OVERRIDE;
23  private:
24   // Detect hinge rotation from |base| and |lid| accelerometers and
25   // automatically start / stop maximize mode.
26   void HandleHingeRotation(const gfx::Vector3dF& base,
27                            const gfx::Vector3dF& lid);
28
29   // Detect screen rotation from |lid| accelerometer and automatically rotate
30   // screen.
31   void HandleScreenRotation(const gfx::Vector3dF& lid);
32
33   DISALLOW_COPY_AND_ASSIGN(MaximizeModeController);
34 };
35
36 }  // namespace ash
37
38 #endif  // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_