| 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" |
| 11 #include "ash/common/shell_observer.h" | 11 #include "ash/common/shell_observer.h" |
| 12 #include "ash/common/wm_activation_observer.h" | |
| 13 #include "ash/common/wm_display_observer.h" | 12 #include "ash/common/wm_display_observer.h" |
| 14 #include "base/macros.h" | 13 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 16 #include "chromeos/accelerometer/accelerometer_reader.h" | 15 #include "chromeos/accelerometer/accelerometer_reader.h" |
| 17 #include "chromeos/accelerometer/accelerometer_types.h" | 16 #include "chromeos/accelerometer/accelerometer_types.h" |
| 18 #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" |
| 19 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 20 #include "ui/display/display.h" | 19 #include "ui/display/display.h" |
| 20 #include "ui/wm/public/activation_change_observer.h" |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 | 23 |
| 24 // Implements ChromeOS specific functionality for ScreenOrientationProvider. | 24 // Implements ChromeOS specific functionality for ScreenOrientationProvider. |
| 25 class ASH_EXPORT ScreenOrientationController | 25 class ASH_EXPORT ScreenOrientationController |
| 26 : public WmActivationObserver, | 26 : public aura::client::ActivationChangeObserver, |
| 27 public aura::WindowObserver, | 27 public aura::WindowObserver, |
| 28 public chromeos::AccelerometerReader::Observer, | 28 public chromeos::AccelerometerReader::Observer, |
| 29 public WmDisplayObserver, | 29 public WmDisplayObserver, |
| 30 public ShellObserver { | 30 public ShellObserver { |
| 31 public: | 31 public: |
| 32 // Observer that reports changes to the state of ScreenOrientationProvider's | 32 // Observer that reports changes to the state of ScreenOrientationProvider's |
| 33 // rotation lock. | 33 // rotation lock. |
| 34 class Observer { | 34 class Observer { |
| 35 public: | 35 public: |
| 36 // Invoked when rotation is locked or unlocked. | 36 // Invoked when rotation is locked or unlocked. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // If |rotation_locked| future accelerometer updates should not change the | 69 // If |rotation_locked| future accelerometer updates should not change the |
| 70 // display rotation. | 70 // display rotation. |
| 71 void SetRotationLocked(bool rotation_locked); | 71 void SetRotationLocked(bool rotation_locked); |
| 72 | 72 |
| 73 // Sets the display rotation for the given |source|. The new |rotation| will | 73 // Sets the display rotation for the given |source|. The new |rotation| will |
| 74 // also become active. Display changed notifications are surpressed for this | 74 // also become active. Display changed notifications are surpressed for this |
| 75 // change. | 75 // change. |
| 76 void SetDisplayRotation(display::Display::Rotation rotation, | 76 void SetDisplayRotation(display::Display::Rotation rotation, |
| 77 display::Display::RotationSource source); | 77 display::Display::RotationSource source); |
| 78 | 78 |
| 79 // WmActivationObserver: | 79 // aura::client::ActivationChangeObserver: |
| 80 void OnWindowActivated(WmWindow* gained_active, | 80 void OnWindowActivated(ActivationReason reason, |
| 81 WmWindow* lost_active) override; | 81 aura::Window* gained_active, |
| 82 aura::Window* lost_active) override; |
| 82 | 83 |
| 83 // aura::WindowObserver: | 84 // aura::WindowObserver: |
| 84 void OnWindowDestroying(aura::Window* window) override; | 85 void OnWindowDestroying(aura::Window* window) override; |
| 85 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; | 86 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
| 86 | 87 |
| 87 // chromeos::AccelerometerReader::Observer: | 88 // chromeos::AccelerometerReader::Observer: |
| 88 void OnAccelerometerUpdated( | 89 void OnAccelerometerUpdated( |
| 89 scoped_refptr<const chromeos::AccelerometerUpdate> update) override; | 90 scoped_refptr<const chromeos::AccelerometerUpdate> update) override; |
| 90 | 91 |
| 91 // WmDisplayObserver: | 92 // WmDisplayObserver: |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Tracks all windows that have requested a lock, as well as the requested | 176 // Tracks all windows that have requested a lock, as well as the requested |
| 176 // orientation. | 177 // orientation. |
| 177 std::map<WmWindow*, blink::WebScreenOrientationLockType> locking_windows_; | 178 std::map<WmWindow*, blink::WebScreenOrientationLockType> locking_windows_; |
| 178 | 179 |
| 179 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); | 180 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationController); |
| 180 }; | 181 }; |
| 181 | 182 |
| 182 } // namespace ash | 183 } // namespace ash |
| 183 | 184 |
| 184 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ | 185 #endif // ASH_DISPLAY_SCREEN_ORIENTATION_CONTROLLER_CHROMEOS_H_ |
| OLD | NEW |