Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_controller.h

Issue 267743010: Suppressed screen rotation notifications triggeres by the accelerometer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Rob's comments from patch set 11. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 13
13 namespace ui { 14 namespace ui {
14 class EventHandler; 15 class EventHandler;
15 } 16 }
16 17
17 namespace ash { 18 namespace ash {
18 19
19 class MaximizeModeEventBlocker; 20 class MaximizeModeEventBlocker;
20 21
21 // MaximizeModeController listens to accelerometer events and automatically 22 // MaximizeModeController listens to accelerometer events and automatically
22 // enters and exits maximize mode when the lid is opened beyond the triggering 23 // enters and exits maximize mode when the lid is opened beyond the triggering
23 // angle and rotates the display to match the device when in maximize mode. 24 // angle and rotates the display to match the device when in maximize mode.
24 class ASH_EXPORT MaximizeModeController : public AccelerometerObserver { 25 class ASH_EXPORT MaximizeModeController : public AccelerometerObserver {
25 public: 26 public:
26 MaximizeModeController(); 27 MaximizeModeController();
27 virtual ~MaximizeModeController(); 28 virtual ~MaximizeModeController();
28 29
30 // If true the screen's rotation is currently being changed.
flackr 2014/05/14 21:13:23 Probably only need the comment on the variable.
bruthig 2014/05/14 21:19:51 Done.
31 bool in_set_screen_rotation() const {
32 return in_set_screen_rotation_;
33 }
34
29 // True if |rotation_lock_| has been set, and OnAccelerometerUpdated will not 35 // True if |rotation_lock_| has been set, and OnAccelerometerUpdated will not
30 // change the display rotation. 36 // change the display rotation.
31 bool rotation_locked() { 37 bool rotation_locked() {
32 return rotation_locked_; 38 return rotation_locked_;
33 } 39 }
34 40
35 // If |rotation_locked| future calls to OnAccelerometerUpdated will not 41 // If |rotation_locked| future calls to OnAccelerometerUpdated will not
36 // change the display rotation. 42 // change the display rotation.
37 void set_rotation_locked(bool rotation_locked) { 43 void set_rotation_locked(bool rotation_locked) {
38 rotation_locked_ = rotation_locked; 44 rotation_locked_ = rotation_locked;
(...skipping 11 matching lines...) Expand all
50 private: 56 private:
51 // Detect hinge rotation from |base| and |lid| accelerometers and 57 // Detect hinge rotation from |base| and |lid| accelerometers and
52 // automatically start / stop maximize mode. 58 // automatically start / stop maximize mode.
53 void HandleHingeRotation(const gfx::Vector3dF& base, 59 void HandleHingeRotation(const gfx::Vector3dF& base,
54 const gfx::Vector3dF& lid); 60 const gfx::Vector3dF& lid);
55 61
56 // Detect screen rotation from |lid| accelerometer and automatically rotate 62 // Detect screen rotation from |lid| accelerometer and automatically rotate
57 // screen. 63 // screen.
58 void HandleScreenRotation(const gfx::Vector3dF& lid); 64 void HandleScreenRotation(const gfx::Vector3dF& lid);
59 65
66 // Sets the display rotation and suppresses display notifications.
67 void SetDisplayRotation(DisplayManager* display_manager,
68 gfx::Display::Rotation rotation);
69
60 // An event targeter controller which traps mouse and keyboard events while 70 // An event targeter controller which traps mouse and keyboard events while
61 // maximize mode is engaged. 71 // maximize mode is engaged.
62 scoped_ptr<MaximizeModeEventBlocker> event_blocker_; 72 scoped_ptr<MaximizeModeEventBlocker> event_blocker_;
63 73
64 // An event handler used to detect screenshot actions while in maximize mode. 74 // An event handler used to detect screenshot actions while in maximize mode.
65 scoped_ptr<ui::EventHandler> event_handler_; 75 scoped_ptr<ui::EventHandler> event_handler_;
66 76
67 // When true calls to OnAccelerometerUpdated will not rotate the display. 77 // When true calls to OnAccelerometerUpdated will not rotate the display.
68 bool rotation_locked_; 78 bool rotation_locked_;
69 79
70 // Whether we have ever seen accelerometer data. 80 // Whether we have ever seen accelerometer data.
71 bool have_seen_accelerometer_data_; 81 bool have_seen_accelerometer_data_;
72 82
83 // When true the screen's orientation is being changed.
flackr 2014/05/14 21:13:23 s/When true/True when
bruthig 2014/05/14 21:19:51 Done.
84 bool in_set_screen_rotation_;
85
73 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); 86 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController);
74 }; 87 };
75 88
76 } // namespace ash 89 } // namespace ash
77 90
78 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ 91 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698