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 // aura::client::ActivationChangeObserver: | 85 // aura::client::ActivationChangeObserver: |
83 void OnWindowActivated(ActivationReason reason, | 86 void OnWindowActivated(ActivationReason reason, |
84 aura::Window* gained_active, | 87 aura::Window* gained_active, |
85 aura::Window* lost_active) override; | 88 aura::Window* lost_active) override; |
86 | 89 |
87 // aura::WindowObserver: | 90 // aura::WindowObserver: |
88 void OnWindowDestroying(aura::Window* window) override; | 91 void OnWindowDestroying(aura::Window* window) override; |
89 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; | 92 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
90 | 93 |
91 // chromeos::AccelerometerReader::Observer: | 94 // chromeos::AccelerometerReader::Observer: |
(...skipping 11 matching lines...) Expand all Loading... |
103 friend class test::ScreenOrientationControllerTestApi; | 106 friend class test::ScreenOrientationControllerTestApi; |
104 | 107 |
105 // Sets the display rotation for the given |source|. The new |rotation| will | 108 // Sets the display rotation for the given |source|. The new |rotation| will |
106 // also become active. Display changed notifications are surpressed for this | 109 // also become active. Display changed notifications are surpressed for this |
107 // change. | 110 // change. |
108 void SetDisplayRotation(display::Display::Rotation rotation, | 111 void SetDisplayRotation(display::Display::Rotation rotation, |
109 display::Display::RotationSource source); | 112 display::Display::RotationSource source); |
110 | 113 |
111 void SetRotationLockedInternal(bool rotation_locked); | 114 void SetRotationLockedInternal(bool rotation_locked); |
112 | 115 |
| 116 // A helper method that set locked to the given |orientation| and save it. |
| 117 void SetLockToOrientation(blink::WebScreenOrientationLockType orientation); |
| 118 |
113 // Sets the display rotation to |rotation|. Future accelerometer updates | 119 // Sets the display rotation to |rotation|. Future accelerometer updates |
114 // should not be used to change the rotation. SetRotationLocked(false) removes | 120 // should not be used to change the rotation. SetRotationLocked(false) removes |
115 // the rotation lock. | 121 // the rotation lock. |
116 void LockRotation(display::Display::Rotation rotation, | 122 void LockRotation(display::Display::Rotation rotation, |
117 display::Display::RotationSource source); | 123 display::Display::RotationSource source); |
118 | 124 |
119 // Sets the display rotation based on |lock_orientation|. Future accelerometer | 125 // Sets the display rotation based on |lock_orientation|. Future accelerometer |
120 // updates should not be used to change the rotation. SetRotationLocked(false) | 126 // updates should not be used to change the rotation. SetRotationLocked(false) |
121 // removes the rotation lock. | 127 // removes the rotation lock. |
122 void LockRotationToOrientation( | 128 void LockRotationToOrientation( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // Tracks all windows that have requested a lock, as well as the requested | 199 // Tracks all windows that have requested a lock, as well as the requested |
194 // orientation. | 200 // orientation. |
195 std::map<WmWindow*, blink::WebScreenOrientationLockType> locking_windows_; | 201 std::map<WmWindow*, blink::WebScreenOrientationLockType> locking_windows_; |
196 | 202 |
197 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); | 203 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); |
198 }; | 204 }; |
199 | 205 |
200 } // namespace ash | 206 } // namespace ash |
201 | 207 |
202 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ | 208 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ |
OLD | NEW |