| 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_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| 6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/shell_observer.h" | 9 #include "ash/shell_observer.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void AddWindow(aura::Window* window); | 76 void AddWindow(aura::Window* window); |
| 77 | 77 |
| 78 // ShellObserver: | 78 // ShellObserver: |
| 79 void OnAppTerminating() override; | 79 void OnAppTerminating() override; |
| 80 void OnMaximizeModeStarted() override; | 80 void OnMaximizeModeStarted() override; |
| 81 void OnMaximizeModeEnded() override; | 81 void OnMaximizeModeEnded() override; |
| 82 | 82 |
| 83 #if defined(OS_CHROMEOS) | 83 #if defined(OS_CHROMEOS) |
| 84 // chromeos::AccelerometerReader::Observer: | 84 // chromeos::AccelerometerReader::Observer: |
| 85 void OnAccelerometerUpdated( | 85 void OnAccelerometerUpdated( |
| 86 const chromeos::AccelerometerUpdate& update) override; | 86 scoped_refptr<const chromeos::AccelerometerUpdate> update) override; |
| 87 | 87 |
| 88 // PowerManagerClient::Observer: | 88 // PowerManagerClient::Observer: |
| 89 void LidEventReceived(bool open, const base::TimeTicks& time) override; | 89 void LidEventReceived(bool open, const base::TimeTicks& time) override; |
| 90 void SuspendImminent() override; | 90 void SuspendImminent() override; |
| 91 void SuspendDone(const base::TimeDelta& sleep_duration) override; | 91 void SuspendDone(const base::TimeDelta& sleep_duration) override; |
| 92 #endif // OS_CHROMEOS | 92 #endif // OS_CHROMEOS |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 friend class MaximizeModeControllerTest; | 95 friend class MaximizeModeControllerTest; |
| 96 friend class MaximizeModeWindowManagerTest; | 96 friend class MaximizeModeWindowManagerTest; |
| 97 friend class test::MultiUserWindowManagerChromeOSTest; | 97 friend class test::MultiUserWindowManagerChromeOSTest; |
| 98 friend class test::VirtualKeyboardControllerTest; | 98 friend class test::VirtualKeyboardControllerTest; |
| 99 | 99 |
| 100 // Used for recording metrics for intervals of time spent in | 100 // Used for recording metrics for intervals of time spent in |
| 101 // and out of TouchView. | 101 // and out of TouchView. |
| 102 enum TouchViewIntervalType { | 102 enum TouchViewIntervalType { |
| 103 TOUCH_VIEW_INTERVAL_INACTIVE, | 103 TOUCH_VIEW_INTERVAL_INACTIVE, |
| 104 TOUCH_VIEW_INTERVAL_ACTIVE | 104 TOUCH_VIEW_INTERVAL_ACTIVE |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 // Set the TickClock. This is only to be used by tests that need to | 107 // Set the TickClock. This is only to be used by tests that need to |
| 108 // artificially and deterministically control the current time. | 108 // artificially and deterministically control the current time. |
| 109 void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock); | 109 void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock); |
| 110 | 110 |
| 111 #if defined(OS_CHROMEOS) | 111 #if defined(OS_CHROMEOS) |
| 112 // Detect hinge rotation from base and lid accelerometers and automatically | 112 // Detect hinge rotation from base and lid accelerometers and automatically |
| 113 // start / stop maximize mode. | 113 // start / stop maximize mode. |
| 114 void HandleHingeRotation(const chromeos::AccelerometerUpdate& update); | 114 void HandleHingeRotation(const chromeos::AccelerometerUpdate* update); |
| 115 #endif | 115 #endif |
| 116 | 116 |
| 117 // Returns true if the lid was recently opened. | 117 // Returns true if the lid was recently opened. |
| 118 bool WasLidOpenedRecently() const; | 118 bool WasLidOpenedRecently() const; |
| 119 | 119 |
| 120 // Enables MaximizeModeWindowManager, and determines the current state of | 120 // Enables MaximizeModeWindowManager, and determines the current state of |
| 121 // rotation lock. | 121 // rotation lock. |
| 122 void EnterMaximizeMode(); | 122 void EnterMaximizeMode(); |
| 123 | 123 |
| 124 // Removes MaximizeModeWindowManager and resets the display rotation if there | 124 // Removes MaximizeModeWindowManager and resets the display rotation if there |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 // Tracks when the lid is closed. Used to prevent entering maximize mode. | 165 // Tracks when the lid is closed. Used to prevent entering maximize mode. |
| 166 bool lid_is_closed_; | 166 bool lid_is_closed_; |
| 167 | 167 |
| 168 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 168 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 } // namespace ash | 171 } // namespace ash |
| 172 | 172 |
| 173 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 173 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |