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 28 matching lines...) Expand all Loading... | |
39 // Invoked when rotation is locked or unlocked by a user. | 39 // Invoked when rotation is locked or unlocked by a user. |
40 virtual void OnUserRotationLockChanged() {} | 40 virtual void OnUserRotationLockChanged() {} |
41 | 41 |
42 protected: | 42 protected: |
43 virtual ~Observer() {} | 43 virtual ~Observer() {} |
44 }; | 44 }; |
45 | 45 |
46 ScreenOrientationController(); | 46 ScreenOrientationController(); |
47 ~ScreenOrientationController() override; | 47 ~ScreenOrientationController() override; |
48 | 48 |
49 static blink::WebScreenOrientationLockType RotationToOrientation( | |
50 display::Display::Rotation rotation); | |
51 | |
49 // Add/Remove observers. | 52 // Add/Remove observers. |
50 void AddObserver(Observer* observer); | 53 void AddObserver(Observer* observer); |
51 void RemoveObserver(Observer* observer); | 54 void RemoveObserver(Observer* observer); |
52 | 55 |
53 // Allows/unallows a window to lock the screen orientation. | 56 // Allows/unallows a window to lock the screen orientation. |
54 void LockOrientationForWindow( | 57 void LockOrientationForWindow( |
55 WmWindow* requesting_window, | 58 WmWindow* requesting_window, |
56 blink::WebScreenOrientationLockType lock_orientation); | 59 blink::WebScreenOrientationLockType lock_orientation); |
57 void UnlockOrientationForWindow(WmWindow* window); | 60 void UnlockOrientationForWindow(WmWindow* window); |
58 | 61 |
(...skipping 13 matching lines...) Expand all Loading... | |
72 bool user_rotation_locked() const { | 75 bool user_rotation_locked() const { |
73 return user_locked_orientation_ != blink::WebScreenOrientationLockAny; | 76 return user_locked_orientation_ != blink::WebScreenOrientationLockAny; |
74 } | 77 } |
75 | 78 |
76 // Trun on/off the user rotation lock. When turned on, it will lock | 79 // Trun on/off the user rotation lock. When turned on, it will lock |
77 // the orientation to the current orientation. | 80 // the orientation to the current orientation. |
78 // |user_rotation_locked()| method returns the current state of the | 81 // |user_rotation_locked()| method returns the current state of the |
79 // user rotation lock. | 82 // user rotation lock. |
80 void ToggleUserRotationLock(); | 83 void ToggleUserRotationLock(); |
81 | 84 |
85 // Set Locked to the given |orientation|. | |
oshima
2017/03/30 00:44:37
mention that this will be saved
Qiang(Joe) Xu
2017/03/30 01:15:14
Done.
| |
86 void SetLockToOrientation(blink::WebScreenOrientationLockType orientation); | |
oshima
2017/03/30 00:44:37
can you just take the rotation, and do conversion
Qiang(Joe) Xu
2017/03/30 01:15:14
Done.
| |
87 | |
82 // aura::client::ActivationChangeObserver: | 88 // aura::client::ActivationChangeObserver: |
83 void OnWindowActivated(ActivationReason reason, | 89 void OnWindowActivated(ActivationReason reason, |
84 aura::Window* gained_active, | 90 aura::Window* gained_active, |
85 aura::Window* lost_active) override; | 91 aura::Window* lost_active) override; |
86 | 92 |
87 // aura::WindowObserver: | 93 // aura::WindowObserver: |
88 void OnWindowDestroying(aura::Window* window) override; | 94 void OnWindowDestroying(aura::Window* window) override; |
89 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; | 95 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
90 | 96 |
91 // chromeos::AccelerometerReader::Observer: | 97 // chromeos::AccelerometerReader::Observer: |
(...skipping 101 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 |