Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / ash / wm / maximize_mode / maximize_mode_controller.h
blob02778a7136051cff6e1918a9673bc25905a2e165
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.
5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
8 #include "ash/accelerometer/accelerometer_observer.h"
9 #include "ash/ash_export.h"
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
13 namespace ash {
15 class MaximizeModeEventBlocker;
17 // MaximizeModeController listens to accelerometer events and automatically
18 // enters and exits maximize mode when the lid is opened beyond the triggering
19 // angle and rotates the display to match the device when in maximize mode.
20 class ASH_EXPORT MaximizeModeController : public AccelerometerObserver {
21 public:
22 MaximizeModeController();
23 virtual ~MaximizeModeController();
25 // True if |rotation_lock_| has been set, and OnAccelerometerUpdated will not
26 // change the display rotation.
27 bool rotation_locked() {
28 return rotation_locked_;
31 // If |rotation_locked| future calls to OnAccelerometerUpdated will not
32 // change the display rotation.
33 void set_rotation_locked(bool rotation_locked) {
34 rotation_locked_ = rotation_locked;
37 // AccelerometerObserver:
38 virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base,
39 const gfx::Vector3dF& lid) OVERRIDE;
41 private:
42 // Detect hinge rotation from |base| and |lid| accelerometers and
43 // automatically start / stop maximize mode.
44 void HandleHingeRotation(const gfx::Vector3dF& base,
45 const gfx::Vector3dF& lid);
47 // Detect screen rotation from |lid| accelerometer and automatically rotate
48 // screen.
49 void HandleScreenRotation(const gfx::Vector3dF& lid);
51 // An event handler which traps mouse and keyboard events while maximize
52 // mode is engaged.
53 scoped_ptr<MaximizeModeEventBlocker> event_blocker_;
55 // When true calls to OnAccelerometerUpdated will not rotate the display.
56 bool rotation_locked_;
58 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController);
61 } // namespace ash
63 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_