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

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

Issue 291233002: Re-landing "Suppressed screen rotation notifications triggeres by the accelerometer." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ifdef'ed BlockRotationNotification test so it only runs on ChromeOS. 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
« no previous file with comments | « ash/system/chromeos/tray_display.cc ('k') | ash/wm/maximize_mode/maximize_mode_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bool in_set_screen_rotation() const {
31 return in_set_screen_rotation_;
32 }
33
29 // True if |rotation_lock_| has been set, and OnAccelerometerUpdated will not 34 // True if |rotation_lock_| has been set, and OnAccelerometerUpdated will not
30 // change the display rotation. 35 // change the display rotation.
31 bool rotation_locked() { 36 bool rotation_locked() {
32 return rotation_locked_; 37 return rotation_locked_;
33 } 38 }
34 39
35 // If |rotation_locked| future calls to OnAccelerometerUpdated will not 40 // If |rotation_locked| future calls to OnAccelerometerUpdated will not
36 // change the display rotation. 41 // change the display rotation.
37 void set_rotation_locked(bool rotation_locked) { 42 void set_rotation_locked(bool rotation_locked) {
38 rotation_locked_ = rotation_locked; 43 rotation_locked_ = rotation_locked;
(...skipping 11 matching lines...) Expand all
50 private: 55 private:
51 // Detect hinge rotation from |base| and |lid| accelerometers and 56 // Detect hinge rotation from |base| and |lid| accelerometers and
52 // automatically start / stop maximize mode. 57 // automatically start / stop maximize mode.
53 void HandleHingeRotation(const gfx::Vector3dF& base, 58 void HandleHingeRotation(const gfx::Vector3dF& base,
54 const gfx::Vector3dF& lid); 59 const gfx::Vector3dF& lid);
55 60
56 // Detect screen rotation from |lid| accelerometer and automatically rotate 61 // Detect screen rotation from |lid| accelerometer and automatically rotate
57 // screen. 62 // screen.
58 void HandleScreenRotation(const gfx::Vector3dF& lid); 63 void HandleScreenRotation(const gfx::Vector3dF& lid);
59 64
65 // Sets the display rotation and suppresses display notifications.
66 void SetDisplayRotation(DisplayManager* display_manager,
67 gfx::Display::Rotation rotation);
68
60 // An event targeter controller which traps mouse and keyboard events while 69 // An event targeter controller which traps mouse and keyboard events while
61 // maximize mode is engaged. 70 // maximize mode is engaged.
62 scoped_ptr<MaximizeModeEventBlocker> event_blocker_; 71 scoped_ptr<MaximizeModeEventBlocker> event_blocker_;
63 72
64 // An event handler used to detect screenshot actions while in maximize mode. 73 // An event handler used to detect screenshot actions while in maximize mode.
65 scoped_ptr<ui::EventHandler> event_handler_; 74 scoped_ptr<ui::EventHandler> event_handler_;
66 75
67 // When true calls to OnAccelerometerUpdated will not rotate the display. 76 // When true calls to OnAccelerometerUpdated will not rotate the display.
68 bool rotation_locked_; 77 bool rotation_locked_;
69 78
70 // Whether we have ever seen accelerometer data. 79 // Whether we have ever seen accelerometer data.
71 bool have_seen_accelerometer_data_; 80 bool have_seen_accelerometer_data_;
72 81
82 // True when the screen's orientation is being changed.
83 bool in_set_screen_rotation_;
84
73 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); 85 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController);
74 }; 86 };
75 87
76 } // namespace ash 88 } // namespace ash
77 89
78 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ 90 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/system/chromeos/tray_display.cc ('k') | ash/wm/maximize_mode/maximize_mode_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698