| OLD | NEW |
| 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 "ash/display/display_manager.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/gfx/display.h" | 13 #include "ui/gfx/display.h" |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 class EventHandler; | 16 class EventHandler; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 | 20 |
| 21 class MaximizeModeControllerTest; | 21 class MaximizeModeControllerTest; |
| 22 class MaximizeModeEventBlocker; | 22 class ScopedDisableInternalMouseAndKeyboard; |
| 23 class MaximizeModeWindowManager; | 23 class MaximizeModeWindowManager; |
| 24 class MaximizeModeWindowManagerTest; | 24 class MaximizeModeWindowManagerTest; |
| 25 | 25 |
| 26 // MaximizeModeController listens to accelerometer events and automatically | 26 // MaximizeModeController listens to accelerometer events and automatically |
| 27 // enters and exits maximize mode when the lid is opened beyond the triggering | 27 // enters and exits maximize mode when the lid is opened beyond the triggering |
| 28 // angle and rotates the display to match the device when in maximize mode. | 28 // angle and rotates the display to match the device when in maximize mode. |
| 29 class ASH_EXPORT MaximizeModeController : public AccelerometerObserver { | 29 class ASH_EXPORT MaximizeModeController : public AccelerometerObserver { |
| 30 public: | 30 public: |
| 31 MaximizeModeController(); | 31 MaximizeModeController(); |
| 32 virtual ~MaximizeModeController(); | 32 virtual ~MaximizeModeController(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // rotation lock. | 94 // rotation lock. |
| 95 void EnterMaximizeMode(); | 95 void EnterMaximizeMode(); |
| 96 | 96 |
| 97 // Removes MaximizeModeWindowManager and resets the display rotation if there | 97 // Removes MaximizeModeWindowManager and resets the display rotation if there |
| 98 // is no rotation lock. | 98 // is no rotation lock. |
| 99 void LeaveMaximizeMode(); | 99 void LeaveMaximizeMode(); |
| 100 | 100 |
| 101 // The maximized window manager (if enabled). | 101 // The maximized window manager (if enabled). |
| 102 scoped_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_; | 102 scoped_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_; |
| 103 | 103 |
| 104 // An event targeter controller which traps mouse and keyboard events while | 104 // A helper class which when instantiated will block native events from the |
| 105 // maximize mode is engaged. | 105 // internal keyboard and touchpad. |
| 106 scoped_ptr<MaximizeModeEventBlocker> event_blocker_; | 106 scoped_ptr<ScopedDisableInternalMouseAndKeyboard> event_blocker_; |
| 107 | 107 |
| 108 // An event handler used to detect screenshot actions while in maximize mode. | 108 // An event handler used to detect screenshot actions while in maximize mode. |
| 109 scoped_ptr<ui::EventHandler> event_handler_; | 109 scoped_ptr<ui::EventHandler> event_handler_; |
| 110 | 110 |
| 111 // When true calls to OnAccelerometerUpdated will not rotate the display. | 111 // When true calls to OnAccelerometerUpdated will not rotate the display. |
| 112 bool rotation_locked_; | 112 bool rotation_locked_; |
| 113 | 113 |
| 114 // Whether we have ever seen accelerometer data. | 114 // Whether we have ever seen accelerometer data. |
| 115 bool have_seen_accelerometer_data_; | 115 bool have_seen_accelerometer_data_; |
| 116 | 116 |
| 117 // True when the screen's orientation is being changed. | 117 // True when the screen's orientation is being changed. |
| 118 bool in_set_screen_rotation_; | 118 bool in_set_screen_rotation_; |
| 119 | 119 |
| 120 // The rotation of the display set by the user. This rotation will be | 120 // The rotation of the display set by the user. This rotation will be |
| 121 // restored upon exiting maximize mode. | 121 // restored upon exiting maximize mode. |
| 122 gfx::Display::Rotation user_rotation_; | 122 gfx::Display::Rotation user_rotation_; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 124 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 } // namespace ash | 127 } // namespace ash |
| 128 | 128 |
| 129 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 129 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |