Chromium Code Reviews| 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 f6c7fedb5e427cbee977e82b61cfa4cd85f83a6b..38c368c069d551678ab9a131c90042f5e09b25c4 100644 |
| --- a/ash/wm/maximize_mode/maximize_mode_controller.h |
| +++ b/ash/wm/maximize_mode/maximize_mode_controller.h |
| @@ -6,13 +6,12 @@ |
| #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_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 "base/time/time.h" |
| #include "ui/gfx/display.h" |
| +#include "ui/gfx/geometry/vector3d_f.h" |
|
oshima
2015/01/09 21:23:55
forward decl?
jonross
2015/01/12 14:46:49
Removed
|
| #if defined(OS_CHROMEOS) |
| #include "chromeos/accelerometer/accelerometer_reader.h" |
| @@ -40,51 +39,16 @@ class MultiUserWindowManagerChromeOSTest; |
| // MaximizeModeController listens to accelerometer events and automatically |
| // enters and exits maximize mode when the lid is opened beyond the triggering |
| // angle and rotates the display to match the device when in maximize mode. |
| -class ASH_EXPORT MaximizeModeController |
| - : public ShellObserver, |
| +class ASH_EXPORT MaximizeModeController : |
| #if defined(OS_CHROMEOS) |
| - public chromeos::AccelerometerReader::Observer, |
| - public chromeos::PowerManagerClient::Observer, |
| + public chromeos::AccelerometerReader::Observer, |
| + public chromeos::PowerManagerClient::Observer, |
| #endif // OS_CHROMEOS |
| - 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. |
| @@ -106,21 +70,11 @@ class ASH_EXPORT MaximizeModeController |
| // If the maximize mode is not enabled no action will be performed. |
| void AddWindow(aura::Window* window); |
| - // TODO(jonross): move this into the destructor. Currently separated as |
| - // ShellOberver notifies of maximize mode ending, and the observers end up |
| - // attempting to access MaximizeModeController via the Shell. If done in |
| - // destructor the controller is null, and the observers segfault. |
| - // Shuts down down the MaximizeModeWindowManager and notifies all observers. |
| - void Shutdown(); |
| - |
| // ShellObserver: |
| void OnAppTerminating() override; |
| void OnMaximizeModeStarted() override; |
| void OnMaximizeModeEnded() override; |
| - // DisplayController::Observer: |
| - void OnDisplayConfigurationChanged() override; |
| - |
| #if defined(OS_CHROMEOS) |
| // chromeos::AccelerometerReader::Observer: |
| void OnAccelerometerUpdated(const ui::AccelerometerUpdate& update) override; |
| @@ -145,14 +99,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; |
| @@ -167,10 +113,6 @@ class ASH_EXPORT MaximizeModeController |
| // Record UMA stats tracking touchview usage. |
| void RecordTouchViewStateTransition(); |
| - // Checks DisplayManager for registered rotation lock, and rotation, |
| - // preferences. These are then applied. |
| - void LoadDisplayRotationProperties(); |
| - |
| // The maximized window manager (if enabled). |
| scoped_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_; |
| @@ -178,36 +120,12 @@ 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_; |
| - // True when Shutdown has been called. When shutting down the non maximize |
| - // mode state should be restored, however user preferences should not be |
| - // altered. |
| - bool shutting_down_; |
| - |
| - // The rotation of the display set by the user. This rotation will be |
| - // restored upon exiting maximize mode. |
| - gfx::Display::Rotation user_rotation_; |
| - |
| - // The current rotation set by MaximizeModeController for the internal |
| - // display. Compared in OnDisplayConfigurationChanged to determine user |
| - // 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_; |