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_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ | 5 #ifndef ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ |
6 #define ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ | 6 #define ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool user_rotation_locked() const { | 72 bool user_rotation_locked() const { |
73 return user_locked_orientation_ != blink::WebScreenOrientationLockAny; | 73 return user_locked_orientation_ != blink::WebScreenOrientationLockAny; |
74 } | 74 } |
75 | 75 |
76 // Trun on/off the user rotation lock. When turned on, it will lock | 76 // Trun on/off the user rotation lock. When turned on, it will lock |
77 // the orientation to the current orientation. | 77 // the orientation to the current orientation. |
78 // |user_rotation_locked()| method returns the current state of the | 78 // |user_rotation_locked()| method returns the current state of the |
79 // user rotation lock. | 79 // user rotation lock. |
80 void ToggleUserRotationLock(); | 80 void ToggleUserRotationLock(); |
81 | 81 |
| 82 // Set locked to the given |rotation| and save it. |
| 83 void SetLockToRotation(display::Display::Rotation rotation); |
| 84 |
82 // WmActivationObserver: | 85 // WmActivationObserver: |
83 void OnWindowActivated(WmWindow* gained_active, | 86 void OnWindowActivated(WmWindow* gained_active, |
84 WmWindow* lost_active) override; | 87 WmWindow* lost_active) override; |
85 | 88 |
86 // aura::WindowObserver: | 89 // aura::WindowObserver: |
87 void OnWindowDestroying(aura::Window* window) override; | 90 void OnWindowDestroying(aura::Window* window) override; |
88 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; | 91 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
89 | 92 |
90 // chromeos::AccelerometerReader::Observer: | 93 // chromeos::AccelerometerReader::Observer: |
91 void OnAccelerometerUpdated( | 94 void OnAccelerometerUpdated( |
(...skipping 10 matching lines...) Expand all Loading... |
102 friend class test::ScreenOrientationControllerTestApi; | 105 friend class test::ScreenOrientationControllerTestApi; |
103 | 106 |
104 // Sets the display rotation for the given |source|. The new |rotation| will | 107 // Sets the display rotation for the given |source|. The new |rotation| will |
105 // also become active. Display changed notifications are surpressed for this | 108 // also become active. Display changed notifications are surpressed for this |
106 // change. | 109 // change. |
107 void SetDisplayRotation(display::Display::Rotation rotation, | 110 void SetDisplayRotation(display::Display::Rotation rotation, |
108 display::Display::RotationSource source); | 111 display::Display::RotationSource source); |
109 | 112 |
110 void SetRotationLockedInternal(bool rotation_locked); | 113 void SetRotationLockedInternal(bool rotation_locked); |
111 | 114 |
| 115 // A helper method that set locked to the given |orientation| and save it. |
| 116 void SetLockToOrientation(blink::WebScreenOrientationLockType orientation); |
| 117 |
112 // Sets the display rotation to |rotation|. Future accelerometer updates | 118 // Sets the display rotation to |rotation|. Future accelerometer updates |
113 // should not be used to change the rotation. SetRotationLocked(false) removes | 119 // should not be used to change the rotation. SetRotationLocked(false) removes |
114 // the rotation lock. | 120 // the rotation lock. |
115 void LockRotation(display::Display::Rotation rotation, | 121 void LockRotation(display::Display::Rotation rotation, |
116 display::Display::RotationSource source); | 122 display::Display::RotationSource source); |
117 | 123 |
118 // Sets the display rotation based on |lock_orientation|. Future accelerometer | 124 // Sets the display rotation based on |lock_orientation|. Future accelerometer |
119 // updates should not be used to change the rotation. SetRotationLocked(false) | 125 // updates should not be used to change the rotation. SetRotationLocked(false) |
120 // removes the rotation lock. | 126 // removes the rotation lock. |
121 void LockRotationToOrientation( | 127 void LockRotationToOrientation( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Tracks all windows that have requested a lock, as well as the requested | 198 // Tracks all windows that have requested a lock, as well as the requested |
193 // orientation. | 199 // orientation. |
194 std::map<WmWindow*, blink::WebScreenOrientationLockType> locking_windows_; | 200 std::map<WmWindow*, blink::WebScreenOrientationLockType> locking_windows_; |
195 | 201 |
196 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); | 202 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); |
197 }; | 203 }; |
198 | 204 |
199 } // namespace ash | 205 } // namespace ash |
200 | 206 |
201 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ | 207 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ |
OLD | NEW |