| 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 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 class EventHandler; | 16 class EventHandler; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 | 20 |
| 20 class MaximizeModeControllerTest; | 21 class MaximizeModeControllerTest; |
| 21 class MaximizeModeEventBlocker; | 22 class MaximizeModeEventBlocker; |
| 22 | 23 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 const gfx::Vector3dF& lid); | 63 const gfx::Vector3dF& lid); |
| 63 | 64 |
| 64 // Detect screen rotation from |lid| accelerometer and automatically rotate | 65 // Detect screen rotation from |lid| accelerometer and automatically rotate |
| 65 // screen. | 66 // screen. |
| 66 void HandleScreenRotation(const gfx::Vector3dF& lid); | 67 void HandleScreenRotation(const gfx::Vector3dF& lid); |
| 67 | 68 |
| 68 // Sets the display rotation and suppresses display notifications. | 69 // Sets the display rotation and suppresses display notifications. |
| 69 void SetDisplayRotation(DisplayManager* display_manager, | 70 void SetDisplayRotation(DisplayManager* display_manager, |
| 70 gfx::Display::Rotation rotation); | 71 gfx::Display::Rotation rotation); |
| 71 | 72 |
| 73 // Enables MaximizeModeWindowManager, and determines the current state of |
| 74 // rotation lock. |
| 75 void EnterMaximizeMode(); |
| 76 |
| 77 // Removes MaximizeModeWindowManager and resets the display rotation if there |
| 78 // is no rotation lock. |
| 79 void LeaveMaximizeMode(); |
| 80 |
| 72 // An event targeter controller which traps mouse and keyboard events while | 81 // An event targeter controller which traps mouse and keyboard events while |
| 73 // maximize mode is engaged. | 82 // maximize mode is engaged. |
| 74 scoped_ptr<MaximizeModeEventBlocker> event_blocker_; | 83 scoped_ptr<MaximizeModeEventBlocker> event_blocker_; |
| 75 | 84 |
| 76 // An event handler used to detect screenshot actions while in maximize mode. | 85 // An event handler used to detect screenshot actions while in maximize mode. |
| 77 scoped_ptr<ui::EventHandler> event_handler_; | 86 scoped_ptr<ui::EventHandler> event_handler_; |
| 78 | 87 |
| 79 // When true calls to OnAccelerometerUpdated will not rotate the display. | 88 // When true calls to OnAccelerometerUpdated will not rotate the display. |
| 80 bool rotation_locked_; | 89 bool rotation_locked_; |
| 81 | 90 |
| 82 // Whether we have ever seen accelerometer data. | 91 // Whether we have ever seen accelerometer data. |
| 83 bool have_seen_accelerometer_data_; | 92 bool have_seen_accelerometer_data_; |
| 84 | 93 |
| 85 // True when the screen's orientation is being changed. | 94 // True when the screen's orientation is being changed. |
| 86 bool in_set_screen_rotation_; | 95 bool in_set_screen_rotation_; |
| 87 | 96 |
| 97 // The rotation of the display set by the user. This rotation will be |
| 98 // restored upon exiting maximize mode. |
| 99 gfx::Display::Rotation user_rotation_; |
| 100 |
| 88 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 101 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 89 }; | 102 }; |
| 90 | 103 |
| 91 } // namespace ash | 104 } // namespace ash |
| 92 | 105 |
| 93 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 106 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |