| 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 <unordered_map> | 8 #include <unordered_map> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/shell_observer.h" | 11 #include "ash/shell_observer.h" |
| 12 #include "ash/wm_display_observer.h" | 12 #include "ash/wm_display_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/display/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 { |
| 23 class Window; |
| 24 } |
| 25 |
| 22 namespace ash { | 26 namespace ash { |
| 23 namespace test { | 27 namespace test { |
| 24 class ScreenOrientationControllerTestApi; | 28 class ScreenOrientationControllerTestApi; |
| 25 } | 29 } |
| 26 | 30 |
| 27 // Implements ChromeOS specific functionality for ScreenOrientationProvider. | 31 // Implements ChromeOS specific functionality for ScreenOrientationProvider. |
| 28 class ASH_EXPORT ScreenOrientationController | 32 class ASH_EXPORT ScreenOrientationController |
| 29 : public aura::client::ActivationChangeObserver, | 33 : public aura::client::ActivationChangeObserver, |
| 30 public aura::WindowObserver, | 34 public aura::WindowObserver, |
| 31 public chromeos::AccelerometerReader::Observer, | 35 public chromeos::AccelerometerReader::Observer, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 57 | 61 |
| 58 ScreenOrientationController(); | 62 ScreenOrientationController(); |
| 59 ~ScreenOrientationController() override; | 63 ~ScreenOrientationController() override; |
| 60 | 64 |
| 61 // Add/Remove observers. | 65 // Add/Remove observers. |
| 62 void AddObserver(Observer* observer); | 66 void AddObserver(Observer* observer); |
| 63 void RemoveObserver(Observer* observer); | 67 void RemoveObserver(Observer* observer); |
| 64 | 68 |
| 65 // Allows/unallows a window to lock the screen orientation. | 69 // Allows/unallows a window to lock the screen orientation. |
| 66 void LockOrientationForWindow( | 70 void LockOrientationForWindow( |
| 67 WmWindow* requesting_window, | 71 aura::Window* requesting_window, |
| 68 blink::WebScreenOrientationLockType lock_orientation, | 72 blink::WebScreenOrientationLockType lock_orientation, |
| 69 LockCompletionBehavior lock_completion_behavior); | 73 LockCompletionBehavior lock_completion_behavior); |
| 70 void UnlockOrientationForWindow(WmWindow* window); | 74 void UnlockOrientationForWindow(aura::Window* window); |
| 71 | 75 |
| 72 // Unlock all and set the rotation back to the user specified rotation. | 76 // Unlock all and set the rotation back to the user specified rotation. |
| 73 void UnlockAll(); | 77 void UnlockAll(); |
| 74 | 78 |
| 75 bool ScreenOrientationProviderSupported() const; | 79 bool ScreenOrientationProviderSupported() const; |
| 76 | 80 |
| 77 bool ignore_display_configuration_updates() const { | 81 bool ignore_display_configuration_updates() const { |
| 78 return ignore_display_configuration_updates_; | 82 return ignore_display_configuration_updates_; |
| 79 } | 83 } |
| 80 | 84 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 223 |
| 220 // The current rotation set by ScreenOrientationController for the internal | 224 // The current rotation set by ScreenOrientationController for the internal |
| 221 // display. | 225 // display. |
| 222 display::Display::Rotation current_rotation_; | 226 display::Display::Rotation current_rotation_; |
| 223 | 227 |
| 224 // Rotation Lock observers. | 228 // Rotation Lock observers. |
| 225 base::ObserverList<Observer> observers_; | 229 base::ObserverList<Observer> observers_; |
| 226 | 230 |
| 227 // Tracks all windows that have requested a lock, as well as the requested | 231 // Tracks all windows that have requested a lock, as well as the requested |
| 228 // orientation. | 232 // orientation. |
| 229 std::unordered_map<WmWindow*, LockInfo> lock_info_map_; | 233 std::unordered_map<aura::Window*, LockInfo> lock_info_map_; |
| 230 | 234 |
| 231 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); | 235 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); |
| 232 }; | 236 }; |
| 233 | 237 |
| 234 } // namespace ash | 238 } // namespace ash |
| 235 | 239 |
| 236 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ | 240 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ |
| OLD | NEW |