Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Side by Side Diff: ash/display/screen_orientation_controller_chromeos.h

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "ash/display/window_tree_host_manager.h" 11 #include "ash/display/window_tree_host_manager.h"
12 #include "ash/shell_observer.h" 12 #include "ash/shell_observer.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "chromeos/accelerometer/accelerometer_reader.h" 15 #include "chromeos/accelerometer/accelerometer_reader.h"
16 #include "chromeos/accelerometer/accelerometer_types.h" 16 #include "chromeos/accelerometer/accelerometer_types.h"
17 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h" 17 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h"
18 #include "ui/aura/window_observer.h" 18 #include "ui/aura/window_observer.h"
19 #include "ui/gfx/display.h" 19 #include "ui/display/display.h"
20 #include "ui/wm/public/activation_change_observer.h" 20 #include "ui/wm/public/activation_change_observer.h"
21 21
22 namespace aura { 22 namespace aura {
23 class Window; 23 class Window;
24 } 24 }
25 25
26 namespace ash { 26 namespace ash {
27 27
28 // Implements ChromeOS specific functionality for ScreenOrientationProvider. 28 // Implements ChromeOS specific functionality for ScreenOrientationProvider.
29 class ASH_EXPORT ScreenOrientationController 29 class ASH_EXPORT ScreenOrientationController
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // rotate the display. 67 // rotate the display.
68 bool rotation_locked() const { return rotation_locked_; } 68 bool rotation_locked() const { return rotation_locked_; }
69 69
70 // If |rotation_locked| future accelerometer updates should not change the 70 // If |rotation_locked| future accelerometer updates should not change the
71 // display rotation. 71 // display rotation.
72 void SetRotationLocked(bool rotation_locked); 72 void SetRotationLocked(bool rotation_locked);
73 73
74 // Sets the display rotation for the given |source|. The new |rotation| will 74 // Sets the display rotation for the given |source|. The new |rotation| will
75 // also become active. Display changed notifications are surpressed for this 75 // also become active. Display changed notifications are surpressed for this
76 // change. 76 // change.
77 void SetDisplayRotation(gfx::Display::Rotation rotation, 77 void SetDisplayRotation(display::Display::Rotation rotation,
78 gfx::Display::RotationSource source); 78 display::Display::RotationSource source);
79 79
80 // aura::client::ActivationChangeObserver: 80 // aura::client::ActivationChangeObserver:
81 void OnWindowActivated( 81 void OnWindowActivated(
82 aura::client::ActivationChangeObserver::ActivationReason reason, 82 aura::client::ActivationChangeObserver::ActivationReason reason,
83 aura::Window* gained_active, 83 aura::Window* gained_active,
84 aura::Window* lost_active) override; 84 aura::Window* lost_active) override;
85 85
86 // aura::WindowObserver: 86 // aura::WindowObserver:
87 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; 87 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;
88 void OnWindowDestroying(aura::Window* window) override; 88 void OnWindowDestroying(aura::Window* window) override;
89 89
90 // chromeos::AccelerometerReader::Observer: 90 // chromeos::AccelerometerReader::Observer:
91 void OnAccelerometerUpdated( 91 void OnAccelerometerUpdated(
92 scoped_refptr<const chromeos::AccelerometerUpdate> update) override; 92 scoped_refptr<const chromeos::AccelerometerUpdate> update) override;
93 93
94 // WindowTreeHostManager::Observer: 94 // WindowTreeHostManager::Observer:
95 void OnDisplayConfigurationChanged() override; 95 void OnDisplayConfigurationChanged() override;
96 96
97 // ShellObserver: 97 // ShellObserver:
98 void OnMaximizeModeStarted() override; 98 void OnMaximizeModeStarted() override;
99 void OnMaximizeModeEnded() override; 99 void OnMaximizeModeEnded() override;
100 100
101 private: 101 private:
102 // Sets the display rotation to |rotation|. Future accelerometer updates 102 // Sets the display rotation to |rotation|. Future accelerometer updates
103 // should not be used to change the rotation. SetRotationLocked(false) removes 103 // should not be used to change the rotation. SetRotationLocked(false) removes
104 // the rotation lock. 104 // the rotation lock.
105 void LockRotation(gfx::Display::Rotation rotation, 105 void LockRotation(display::Display::Rotation rotation,
106 gfx::Display::RotationSource source); 106 display::Display::RotationSource source);
107 107
108 // Sets the display rotation based on |lock_orientation|. Future accelerometer 108 // Sets the display rotation based on |lock_orientation|. Future accelerometer
109 // updates should not be used to change the rotation. SetRotationLocked(false) 109 // updates should not be used to change the rotation. SetRotationLocked(false)
110 // removes the rotation lock. 110 // removes the rotation lock.
111 void LockRotationToOrientation( 111 void LockRotationToOrientation(
112 blink::WebScreenOrientationLockType lock_orientation); 112 blink::WebScreenOrientationLockType lock_orientation);
113 113
114 // Locks rotation to the angle matching the primary orientation for 114 // Locks rotation to the angle matching the primary orientation for
115 // |lock_orientation|. 115 // |lock_orientation|.
116 void LockRotationToPrimaryOrientation( 116 void LockRotationToPrimaryOrientation(
(...skipping 20 matching lines...) Expand all
137 137
138 // Determines the rotation lock, and orientation, for the currently active 138 // Determines the rotation lock, and orientation, for the currently active
139 // window, and applies it. If there is none, rotation lock will be removed. 139 // window, and applies it. If there is none, rotation lock will be removed.
140 void ApplyLockForActiveWindow(); 140 void ApplyLockForActiveWindow();
141 141
142 // Both |blink::WebScreenOrientationLockLandscape| and 142 // Both |blink::WebScreenOrientationLockLandscape| and
143 // |blink::WebScreenOrientationLockPortrait| allow for rotation between the 143 // |blink::WebScreenOrientationLockPortrait| allow for rotation between the
144 // two angles of the same screen orientation 144 // two angles of the same screen orientation
145 // (http://www.w3.org/TR/screen-orientation/). Returns true if |rotation| is 145 // (http://www.w3.org/TR/screen-orientation/). Returns true if |rotation| is
146 // supported for the current |rotation_locked_orientation_|. 146 // supported for the current |rotation_locked_orientation_|.
147 bool IsRotationAllowedInLockedState(gfx::Display::Rotation rotation); 147 bool IsRotationAllowedInLockedState(display::Display::Rotation rotation);
148 148
149 // Certain orientation locks allow for rotation between the two angles of the 149 // Certain orientation locks allow for rotation between the two angles of the
150 // same screen orientation. Returns true if |rotation_locked_orientation_| 150 // same screen orientation. Returns true if |rotation_locked_orientation_|
151 // allows rotation. 151 // allows rotation.
152 bool CanRotateInLockedState(); 152 bool CanRotateInLockedState();
153 153
154 // The orientation of the display when at a rotation of 0. 154 // The orientation of the display when at a rotation of 0.
155 blink::WebScreenOrientationLockType natural_orientation_; 155 blink::WebScreenOrientationLockType natural_orientation_;
156 156
157 // True when changes being applied cause OnDisplayConfigurationChanged() to be 157 // True when changes being applied cause OnDisplayConfigurationChanged() to be
158 // called, and for which these changes should be ignored. 158 // called, and for which these changes should be ignored.
159 bool ignore_display_configuration_updates_; 159 bool ignore_display_configuration_updates_;
160 160
161 // When true then accelerometer updates should not rotate the display. 161 // When true then accelerometer updates should not rotate the display.
162 bool rotation_locked_; 162 bool rotation_locked_;
163 163
164 // The orientation to which the current |rotation_locked_| was applied. 164 // The orientation to which the current |rotation_locked_| was applied.
165 blink::WebScreenOrientationLockType rotation_locked_orientation_; 165 blink::WebScreenOrientationLockType rotation_locked_orientation_;
166 166
167 // The rotation of the display set by the user. This rotation will be 167 // The rotation of the display set by the user. This rotation will be
168 // restored upon exiting maximize mode. 168 // restored upon exiting maximize mode.
169 gfx::Display::Rotation user_rotation_; 169 display::Display::Rotation user_rotation_;
170 170
171 // The current rotation set by ScreenOrientationController for the internal 171 // The current rotation set by ScreenOrientationController for the internal
172 // display. 172 // display.
173 gfx::Display::Rotation current_rotation_; 173 display::Display::Rotation current_rotation_;
174 174
175 // Rotation Lock observers. 175 // Rotation Lock observers.
176 base::ObserverList<Observer> observers_; 176 base::ObserverList<Observer> observers_;
177 177
178 // Tracks all windows that have requested a lock, as well as the requested 178 // Tracks all windows that have requested a lock, as well as the requested
179 // orientation. 179 // orientation.
180 std::map<aura::Window*, blink::WebScreenOrientationLockType> locking_windows_; 180 std::map<aura::Window*, blink::WebScreenOrientationLockType> locking_windows_;
181 181
182 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); 182 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController);
183 }; 183 };
184 184
185 } // namespace ash 185 } // namespace ash
186 186
187 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ 187 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_
OLDNEW
« no previous file with comments | « ash/display/screen_ash_unittest.cc ('k') | ash/display/screen_orientation_controller_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698