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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 // WindowTreeHostManager::Observer: | 86 // WindowTreeHostManager::Observer: |
| 87 void OnDisplayConfigurationChanged() override; | 87 void OnDisplayConfigurationChanged() override; |
| 88 | 88 |
| 89 #if defined(OS_CHROMEOS) | 89 #if defined(OS_CHROMEOS) |
| 90 // chromeos::AccelerometerReader::Observer: | 90 // chromeos::AccelerometerReader::Observer: |
| 91 void OnAccelerometerUpdated( | 91 void OnAccelerometerUpdated( |
| 92 scoped_refptr<const chromeos::AccelerometerUpdate> update) override; | 92 scoped_refptr<const chromeos::AccelerometerUpdate> update) override; |
| 93 | 93 |
| 94 // PowerManagerClient::Observer: | 94 // PowerManagerClient::Observer: |
| 95 void LidEventReceived(bool open, const base::TimeTicks& time) override; | 95 void LidEventReceived(bool open, const base::TimeTicks& time) override; |
| 96 void TabletModeEventReceived(bool on, const base::TimeTicks& time) override; | |
| 96 void SuspendImminent() override; | 97 void SuspendImminent() override; |
| 97 void SuspendDone(const base::TimeDelta& sleep_duration) override; | 98 void SuspendDone(const base::TimeDelta& sleep_duration) override; |
| 98 #endif // OS_CHROMEOS | 99 #endif // OS_CHROMEOS |
| 99 | 100 |
| 100 private: | 101 private: |
| 101 friend class MaximizeModeControllerTest; | 102 friend class MaximizeModeControllerTest; |
| 102 friend class MaximizeModeWindowManagerTest; | 103 friend class MaximizeModeWindowManagerTest; |
| 103 friend class test::MultiUserWindowManagerChromeOSTest; | 104 friend class test::MultiUserWindowManagerChromeOSTest; |
| 104 friend class test::VirtualKeyboardControllerTest; | 105 friend class test::VirtualKeyboardControllerTest; |
| 105 | 106 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 base::TimeDelta total_non_touchview_time_; | 163 base::TimeDelta total_non_touchview_time_; |
| 163 | 164 |
| 164 // Tracks the last time we received a lid open event. This is used to suppress | 165 // Tracks the last time we received a lid open event. This is used to suppress |
| 165 // erroneous accelerometer readings as the lid is opened but the accelerometer | 166 // erroneous accelerometer readings as the lid is opened but the accelerometer |
| 166 // reports readings that make the lid to appear near fully open. | 167 // reports readings that make the lid to appear near fully open. |
| 167 base::TimeTicks last_lid_open_time_; | 168 base::TimeTicks last_lid_open_time_; |
| 168 | 169 |
| 169 // Source for the current time in base::TimeTicks. | 170 // Source for the current time in base::TimeTicks. |
| 170 std::unique_ptr<base::TickClock> tick_clock_; | 171 std::unique_ptr<base::TickClock> tick_clock_; |
| 171 | 172 |
| 173 #if defined(OS_CHROMEOS) | |
| 174 // Set when tablet mode switch transitions from on to off. This is used to | |
| 175 // make HandleHingeRotation check whether we need to disable maximize mode. | |
| 176 bool tablet_mode_switch_was_on_; | |
|
Daniel Erat
2016/06/06 15:24:55
it would probably be better to track "is_on" inste
jcliang
2016/06/06 16:48:36
Yes I agree. This is improved after we remove lid_
| |
| 177 #endif | |
| 178 | |
| 172 // Tracks when the lid is closed. Used to prevent entering maximize mode. | 179 // Tracks when the lid is closed. Used to prevent entering maximize mode. |
| 173 bool lid_is_closed_; | 180 bool lid_is_closed_; |
| 174 | 181 |
| 175 // Tracks smoothed accelerometer data over time. This is done when the hinge | 182 // Tracks smoothed accelerometer data over time. This is done when the hinge |
| 176 // is approaching vertical to remove abrupt acceleration that can lead to | 183 // is approaching vertical to remove abrupt acceleration that can lead to |
| 177 // incorrect calculations of hinge angles. | 184 // incorrect calculations of hinge angles. |
| 178 gfx::Vector3dF base_smoothed_; | 185 gfx::Vector3dF base_smoothed_; |
| 179 gfx::Vector3dF lid_smoothed_; | 186 gfx::Vector3dF lid_smoothed_; |
| 180 | 187 |
| 181 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 188 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 182 }; | 189 }; |
| 183 | 190 |
| 184 } // namespace ash | 191 } // namespace ash |
| 185 | 192 |
| 186 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 193 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |