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_CONTENT_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ | 5 #ifndef ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ |
6 #define ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ | 6 #define ASH_CONTENT_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 | 63 |
64 // True if |rotation_lock_| has been set and accelerometer updates should not | 64 // True if |rotation_lock_| has been set and accelerometer updates should not |
65 // rotate the display. | 65 // rotate the display. |
66 bool rotation_locked() const { return rotation_locked_; } | 66 bool rotation_locked() const { return rotation_locked_; } |
67 | 67 |
68 // If |rotation_locked| future accelerometer updates should not change the | 68 // If |rotation_locked| future accelerometer updates should not change the |
69 // display rotation. | 69 // display rotation. |
70 void SetRotationLocked(bool rotation_locked); | 70 void SetRotationLocked(bool rotation_locked); |
71 | 71 |
72 // Sets the display rotation and suppresses display notifications. | 72 // Sets the display rotation for the given |source|. The new |rotation| will |
73 void SetDisplayRotation(gfx::Display::Rotation rotation); | 73 // also become active. Display changed notifications are surpressed for this |
| 74 // change. |
| 75 void SetDisplayRotation(gfx::Display::Rotation rotation, |
| 76 gfx::Display::RotationSource source); |
74 | 77 |
75 // aura::client::ActivationChangeObserver: | 78 // aura::client::ActivationChangeObserver: |
76 void OnWindowActivated(aura::Window* gained_active, | 79 void OnWindowActivated(aura::Window* gained_active, |
77 aura::Window* lost_active) override; | 80 aura::Window* lost_active) override; |
78 | 81 |
79 // aura::WindowObserver: | 82 // aura::WindowObserver: |
80 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; | 83 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
81 void OnWindowDestroying(aura::Window* window) override; | 84 void OnWindowDestroying(aura::Window* window) override; |
82 | 85 |
83 // chromeos::AccelerometerReader::Observer: | 86 // chromeos::AccelerometerReader::Observer: |
(...skipping 11 matching lines...) Expand all Loading... |
95 void OnDisplayConfigurationChanged() override; | 98 void OnDisplayConfigurationChanged() override; |
96 | 99 |
97 // ShellObserver: | 100 // ShellObserver: |
98 void OnMaximizeModeStarted() override; | 101 void OnMaximizeModeStarted() override; |
99 void OnMaximizeModeEnded() override; | 102 void OnMaximizeModeEnded() override; |
100 | 103 |
101 private: | 104 private: |
102 // Sets the display rotation to |rotation|. Future accelerometer updates | 105 // Sets the display rotation to |rotation|. Future accelerometer updates |
103 // should not be used to change the rotation. SetRotationLocked(false) removes | 106 // should not be used to change the rotation. SetRotationLocked(false) removes |
104 // the rotation lock. | 107 // the rotation lock. |
105 void LockRotation(gfx::Display::Rotation rotation); | 108 void LockRotation(gfx::Display::Rotation rotation, |
| 109 gfx::Display::RotationSource source); |
106 | 110 |
107 // Sets the display rotation based on |lock_orientation|. Future accelerometer | 111 // Sets the display rotation based on |lock_orientation|. Future accelerometer |
108 // updates should not be used to change the rotation. SetRotationLocked(false) | 112 // updates should not be used to change the rotation. SetRotationLocked(false) |
109 // removes the rotation lock. | 113 // removes the rotation lock. |
110 void LockRotationToOrientation( | 114 void LockRotationToOrientation( |
111 blink::WebScreenOrientationLockType lock_orientation); | 115 blink::WebScreenOrientationLockType lock_orientation); |
112 | 116 |
113 // Locks rotation to the angle matching the primary orientation for | 117 // Locks rotation to the angle matching the primary orientation for |
114 // |lock_orientation|. | 118 // |lock_orientation|. |
115 void LockRotationToPrimaryOrientation( | 119 void LockRotationToPrimaryOrientation( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Tracks all windows that have requested a lock, as well as the requested | 184 // Tracks all windows that have requested a lock, as well as the requested |
181 // orientation. | 185 // orientation. |
182 std::map<aura::Window*, blink::WebScreenOrientationLockType> locking_windows_; | 186 std::map<aura::Window*, blink::WebScreenOrientationLockType> locking_windows_; |
183 | 187 |
184 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); | 188 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); |
185 }; | 189 }; |
186 | 190 |
187 } // namespace ash | 191 } // namespace ash |
188 | 192 |
189 #endif // ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ | 193 #endif // ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ |
OLD | NEW |