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

Unified Diff: ash/wm/maximize_mode/maximize_mode_controller.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/wm/maximize_mode/maximize_mode_controller.h
diff --git a/ash/wm/maximize_mode/maximize_mode_controller.h b/ash/wm/maximize_mode/maximize_mode_controller.h
index e103548178e153344057d0911bf09e4e5721e319..27691c85f07619e5ad5600c77597a849fd0812cc 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller.h
+++ b/ash/wm/maximize_mode/maximize_mode_controller.h
@@ -8,14 +8,13 @@
#include "ash/accelerometer/accelerometer_observer.h"
#include "ash/ash_export.h"
#include "ash/display/display_controller.h"
-#include "ash/display/display_manager.h"
#include "ash/shell_observer.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
-#include "base/observer_list.h"
#include "ui/gfx/display.h"
#if defined(OS_CHROMEOS)
+#include "ash/content/display/screen_orientation_delegate_chromeos.h"
#include "chromeos/dbus/power_manager_client.h"
#endif // OS_CHROMEOS
@@ -44,47 +43,13 @@ class ASH_EXPORT MaximizeModeController
: public AccelerometerObserver,
#if defined(OS_CHROMEOS)
public chromeos::PowerManagerClient::Observer,
+ public DisplayController::Observer,
#endif // OS_CHROMEOS
- public ShellObserver,
- public DisplayController::Observer {
+ public ShellObserver {
public:
- // Observer that reports changes to the state of MaximizeModeController's
- // rotation lock.
- class Observer {
- public:
- // Invoked whenever |rotation_locked_| is changed.
- virtual void OnRotationLockChanged(bool rotation_locked) {}
-
- protected:
- virtual ~Observer() {}
- };
-
MaximizeModeController();
~MaximizeModeController() override;
- bool ignore_display_configuration_updates() const {
- return ignore_display_configuration_updates_;
- }
-
- // True if |rotation_lock_| has been set, and OnAccelerometerUpdated will not
- // change the display rotation.
- bool rotation_locked() {
- return rotation_locked_;
- }
-
- // If |rotation_locked| future calls to OnAccelerometerUpdated will not
- // change the display rotation.
- void SetRotationLocked(bool rotation_locked);
-
- // Sets the display rotation to |rotation| and prevents future calls to
- // OnAccelerometerUpdated from changing the rotation. SetRotationLocked(false)
- // removes the rotation lock.
- void LockRotation(gfx::Display::Rotation rotation);
-
- // Add/Remove observers.
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
-
// True if it is possible to enter maximize mode in the current
// configuration. If this returns false, it should never be the case that
// maximize mode becomes enabled.
@@ -121,10 +86,10 @@ class ASH_EXPORT MaximizeModeController
void OnMaximizeModeStarted() override;
void OnMaximizeModeEnded() override;
+#if defined(OS_CHROMEOS)
// DisplayController::Observer:
void OnDisplayConfigurationChanged() override;
-#if defined(OS_CHROMEOS)
// PowerManagerClient::Observer:
virtual void LidEventReceived(bool open,
const base::TimeTicks& time) override;
@@ -146,14 +111,6 @@ class ASH_EXPORT MaximizeModeController
void HandleHingeRotation(const gfx::Vector3dF& base,
const gfx::Vector3dF& lid);
- // Detect screen rotation from |lid| accelerometer and automatically rotate
- // screen.
- void HandleScreenRotation(const gfx::Vector3dF& lid);
-
- // Sets the display rotation and suppresses display notifications.
- void SetDisplayRotation(DisplayManager* display_manager,
- gfx::Display::Rotation rotation);
-
// Returns true if the lid was recently opened.
bool WasLidOpenedRecently() const;
@@ -168,9 +125,18 @@ class ASH_EXPORT MaximizeModeController
// Record UMA stats tracking touchview usage.
void RecordTouchViewStateTransition();
+#if defined(OS_CHROMEOS)
+ // Detect screen rotation from |lid| accelerometer and automatically rotate
+ // screen.
+ void HandleScreenRotation(const gfx::Vector3dF& lid);
+
+ // Sets the display rotation and suppresses display notifications.
+ void SetDisplayRotation(gfx::Display::Rotation rotation);
+
// Checks DisplayManager for registered rotation lock, and rotation,
// preferences. These are then applied.
void LoadDisplayRotationProperties();
+#endif // OS_CHROMEOS
// The maximized window manager (if enabled).
scoped_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_;
@@ -179,16 +145,9 @@ class ASH_EXPORT MaximizeModeController
// internal keyboard and touchpad.
scoped_ptr<ScopedDisableInternalMouseAndKeyboard> event_blocker_;
- // When true calls to OnAccelerometerUpdated will not rotate the display.
- bool rotation_locked_;
-
// Whether we have ever seen accelerometer data.
bool have_seen_accelerometer_data_;
- // True when changes being applied cause OnDisplayConfigurationChanged() to be
- // called, and for which these changes should be ignored.
- bool ignore_display_configuration_updates_;
-
// True when the hinge angle has been detected past 180 degrees.
bool lid_open_past_180_;
@@ -206,9 +165,6 @@ class ASH_EXPORT MaximizeModeController
// display setting changes.
gfx::Display::Rotation current_rotation_;
- // Rotation Lock observers.
- ObserverList<Observer> observers_;
-
// Tracks time spent in (and out of) touchview mode.
base::Time last_touchview_transition_time_;
base::TimeDelta total_touchview_time_;

Powered by Google App Engine
This is Rietveld 408576698