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

Unified Diff: ash/content/display/screen_orientation_delegate_chromeos.h

Issue 759063002: Move Screen Rotation from MaximizeModeController to ScreenOrientationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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);
};

Powered by Google App Engine
This is Rietveld 408576698