Chromium Code Reviews| 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/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace ash { | 30 namespace ash { |
| 31 | 31 |
| 32 class MaximizeModeControllerTest; | 32 class MaximizeModeControllerTest; |
| 33 class ScopedDisableInternalMouseAndKeyboard; | 33 class ScopedDisableInternalMouseAndKeyboard; |
| 34 class MaximizeModeWindowManager; | 34 class MaximizeModeWindowManager; |
| 35 class MaximizeModeWindowManagerTest; | 35 class MaximizeModeWindowManagerTest; |
| 36 namespace test { | 36 namespace test { |
| 37 class MultiUserWindowManagerChromeOSTest; | 37 class MultiUserWindowManagerChromeOSTest; |
| 38 class VirtualKeyboardControllerTest; | |
| 38 } | 39 } |
| 39 | 40 |
| 40 // MaximizeModeController listens to accelerometer events and automatically | 41 // MaximizeModeController listens to accelerometer events and automatically |
| 41 // enters and exits maximize mode when the lid is opened beyond the triggering | 42 // enters and exits maximize mode when the lid is opened beyond the triggering |
| 42 // angle and rotates the display to match the device when in maximize mode. | 43 // angle and rotates the display to match the device when in maximize mode. |
| 43 class ASH_EXPORT MaximizeModeController | 44 class ASH_EXPORT MaximizeModeController |
| 44 : public ShellObserver, | 45 : public ShellObserver, |
| 45 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
| 46 public chromeos::AccelerometerReader::Observer, | 47 public chromeos::AccelerometerReader::Observer, |
| 47 public chromeos::PowerManagerClient::Observer, | 48 public chromeos::PowerManagerClient::Observer, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 // PowerManagerClient::Observer: | 129 // PowerManagerClient::Observer: |
| 129 void LidEventReceived(bool open, const base::TimeTicks& time) override; | 130 void LidEventReceived(bool open, const base::TimeTicks& time) override; |
| 130 void SuspendImminent() override; | 131 void SuspendImminent() override; |
| 131 void SuspendDone(const base::TimeDelta& sleep_duration) override; | 132 void SuspendDone(const base::TimeDelta& sleep_duration) override; |
| 132 #endif // OS_CHROMEOS | 133 #endif // OS_CHROMEOS |
| 133 | 134 |
| 134 private: | 135 private: |
| 135 friend class MaximizeModeControllerTest; | 136 friend class MaximizeModeControllerTest; |
| 136 friend class MaximizeModeWindowManagerTest; | 137 friend class MaximizeModeWindowManagerTest; |
| 137 friend class test::MultiUserWindowManagerChromeOSTest; | 138 friend class test::MultiUserWindowManagerChromeOSTest; |
| 139 friend class test::VirtualKeyboardControllerTest; | |
| 138 | 140 |
| 139 // Set the TickClock. This is only to be used by tests that need to | 141 // Set the TickClock. This is only to be used by tests that need to |
| 140 // artificially and deterministically control the current time. | 142 // artificially and deterministically control the current time. |
| 141 void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock); | 143 void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock); |
| 142 | 144 |
| 145 // Set the event blocker for testing. | |
| 146 void InstallEventBlockerForTest( | |
|
sky
2015/01/07 16:01:52
Not that your test is a friend you don't need this
rsadam
2015/01/07 16:04:32
That was my first approach, however I got errors t
rsadam
2015/01/07 16:13:02
Done.
| |
| 147 scoped_ptr<ScopedDisableInternalMouseAndKeyboard> blocker); | |
| 148 | |
| 143 // Detect hinge rotation from |base| and |lid| accelerometers and | 149 // Detect hinge rotation from |base| and |lid| accelerometers and |
| 144 // automatically start / stop maximize mode. | 150 // automatically start / stop maximize mode. |
| 145 void HandleHingeRotation(const gfx::Vector3dF& base, | 151 void HandleHingeRotation(const gfx::Vector3dF& base, |
| 146 const gfx::Vector3dF& lid); | 152 const gfx::Vector3dF& lid); |
| 147 | 153 |
| 148 // Detect screen rotation from |lid| accelerometer and automatically rotate | 154 // Detect screen rotation from |lid| accelerometer and automatically rotate |
| 149 // screen. | 155 // screen. |
| 150 void HandleScreenRotation(const gfx::Vector3dF& lid); | 156 void HandleScreenRotation(const gfx::Vector3dF& lid); |
| 151 | 157 |
| 152 // Sets the display rotation and suppresses display notifications. | 158 // Sets the display rotation and suppresses display notifications. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 | 229 |
| 224 // Tracks when the lid is closed. Used to prevent entering maximize mode. | 230 // Tracks when the lid is closed. Used to prevent entering maximize mode. |
| 225 bool lid_is_closed_; | 231 bool lid_is_closed_; |
| 226 | 232 |
| 227 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 233 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 228 }; | 234 }; |
| 229 | 235 |
| 230 } // namespace ash | 236 } // namespace ash |
| 231 | 237 |
| 232 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 238 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |