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

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: Fixed maximize_mode_controller to use it's own SetDisplayRotation method. 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;
(...skipping 20 matching lines...) Expand all
40 41
41 // True if it is possible to enter maximize mode in the current 42 // True if it is possible to enter maximize mode in the current
42 // configuration. If this returns false, it should never be the case that 43 // configuration. If this returns false, it should never be the case that
43 // maximize mode becomes enabled. 44 // maximize mode becomes enabled.
44 bool CanEnterMaximizeMode(); 45 bool CanEnterMaximizeMode();
45 46
46 // AccelerometerObserver: 47 // AccelerometerObserver:
47 virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base, 48 virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base,
48 const gfx::Vector3dF& lid) OVERRIDE; 49 const gfx::Vector3dF& lid) OVERRIDE;
49 50
51 // Only show display notifications when true.
52 bool show_display_notifications() const {
53 return show_display_notifications_;
54 }
55
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 int64 display_id,
69 gfx::Display::Rotation rotation);
70
60 // An event targeter controller which traps mouse and keyboard events while 71 // An event targeter controller which traps mouse and keyboard events while
61 // maximize mode is engaged. 72 // maximize mode is engaged.
62 scoped_ptr<MaximizeModeEventBlocker> event_blocker_; 73 scoped_ptr<MaximizeModeEventBlocker> event_blocker_;
63 74
64 // An event handler used to detect screenshot actions while in maximize mode. 75 // An event handler used to detect screenshot actions while in maximize mode.
65 scoped_ptr<ui::EventHandler> event_handler_; 76 scoped_ptr<ui::EventHandler> event_handler_;
66 77
67 // When true calls to OnAccelerometerUpdated will not rotate the display. 78 // When true calls to OnAccelerometerUpdated will not rotate the display.
68 bool rotation_locked_; 79 bool rotation_locked_;
69 80
70 // Whether we have ever seen accelerometer data. 81 // Whether we have ever seen accelerometer data.
71 bool have_seen_accelerometer_data_; 82 bool have_seen_accelerometer_data_;
72 83
84 // When false MessageCenter display notifications will be suppressed.
85 bool show_display_notifications_;
flackr 2014/05/14 01:48:33 nit: this name describes the side effects of this
bruthig 2014/05/14 18:48:49 Done.
86
73 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); 87 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController);
74 }; 88 };
75 89
76 } // namespace ash 90 } // namespace ash
77 91
78 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ 92 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698