Chromium Code Reviews| Index: ash/content/display/screen_orientation_delegate_chromeos.h |
| diff --git a/ash/content/display/screen_orientation_delegate_chromeos.h b/ash/content/display/screen_orientation_delegate_chromeos.h |
| index d1f445572d3e1580adfb905245f3fa142f832cc8..a3070f145a2705f639f1815fbef933222778f402 100644 |
| --- a/ash/content/display/screen_orientation_delegate_chromeos.h |
| +++ b/ash/content/display/screen_orientation_delegate_chromeos.h |
| @@ -5,9 +5,12 @@ |
| #ifndef ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_ |
| #define ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_ |
| +#include "ash/ash_export.h" |
| #include "base/macros.h" |
| +#include "base/observer_list.h" |
| #include "content/public/browser/screen_orientation_delegate.h" |
| #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" |
| +#include "ui/gfx/display.h" |
| namespace aura { |
| class Window; |
| @@ -20,11 +23,42 @@ class WebContents; |
| namespace ash { |
| // Implements ChromeOS specific functionality for ScreenOrientationProvider. |
| -class ScreenOrientationDelegate : public content::ScreenOrientationDelegate { |
| +class ASH_EXPORT ScreenOrientationDelegate |
| + : public content::ScreenOrientationDelegate { |
| public: |
| + // Observer that reports changes to the state of ScreenOrientationProvider's |
| + // rotation lock. |
| + class Observer { |
| + public: |
| + // Invoked whenever |rotation_locked_| is changed. |
|
flackr
2014/11/27 15:39:15
Since |rotation_locked_| isn't a member of the obs
jonross
2014/12/10 17:57:30
Done.
|
| + virtual void OnRotationLockChanged(bool rotation_locked) {} |
| + |
| + protected: |
| + virtual ~Observer() {} |
| + }; |
| + |
| ScreenOrientationDelegate(); |
| virtual ~ScreenOrientationDelegate(); |
| + // Add/Remove observers. |
| + void AddObserver(Observer* observer); |
| + void RemoveObserver(Observer* observer); |
| + |
| + bool ignore_display_configuration_updates() const { |
| + return ignore_display_configuration_updates_; |
| + } |
| + |
| + // True if |rotation_lock_| has been set and accelerometer updates should not |
| + // rotate the display. |
| + bool rotation_locked() { return rotation_locked_; } |
| + |
| + // If |rotation_locked| future accelerometer updates should not change the |
| + // display rotation. |
| + void SetRotationLocked(bool rotation_locked); |
| + |
| + // Sets the display rotation and suppresses display notifications. |
| + void SetDisplayRotation(gfx::Display::Rotation rotation); |
| + |
| // content::ScreenOrientationDelegate: |
| bool FullScreenRequired(content::WebContents* web_contents) override; |
| void Lock(content::WebContents* web_contents, |
| @@ -33,6 +67,11 @@ class ScreenOrientationDelegate : public content::ScreenOrientationDelegate { |
| void Unlock(content::WebContents* web_contents) override; |
| private: |
| + // Sets the display rotation to |rotation|. Future calls to |
| + // OnAccelerometerUpdated should not be used to change the rotation. |
|
flackr
2014/11/27 15:39:15
Can you update this comment? OnAccelerometerUpdate
jonross
2014/12/10 17:57:30
Done.
|
| + // SetRotationLocked(false) removes the rotation lock. |
| + void LockRotation(gfx::Display::Rotation rotation); |
| + |
| // Locks rotation to the angle matching the primary orientation for |
| // |lock_orientation|. |
| void LockRotationToPrimaryOrientation( |
| @@ -56,6 +95,16 @@ class ScreenOrientationDelegate : public content::ScreenOrientationDelegate { |
| // The orientation of the display when at a rotation of 0. |
| blink::WebScreenOrientationLockType natural_orientation_; |
| + // True when changes being applied cause OnDisplayConfigurationChanged() to be |
| + // called, and for which these changes should be ignored. |
| + bool ignore_display_configuration_updates_; |
| + |
| + // When true then accelerometer updates should not rotate the display. |
| + bool rotation_locked_; |
| + |
| + // Rotation Lock observers. |
| + ObserverList<Observer> observers_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDelegate); |
| }; |