| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // The maximized window manager (if enabled). | 147 // The maximized window manager (if enabled). |
| 147 std::unique_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_; | 148 std::unique_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_; |
| 148 | 149 |
| 149 // A helper class which when instantiated will block native events from the | 150 // A helper class which when instantiated will block native events from the |
| 150 // internal keyboard and touchpad. | 151 // internal keyboard and touchpad. |
| 151 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> event_blocker_; | 152 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> event_blocker_; |
| 152 | 153 |
| 153 // Whether we have ever seen accelerometer data. | 154 // Whether we have ever seen accelerometer data. |
| 154 bool have_seen_accelerometer_data_; | 155 bool have_seen_accelerometer_data_; |
| 155 | 156 |
| 156 // True when the hinge angle has been detected past 180 degrees. | |
| 157 bool lid_open_past_180_; | |
| 158 | |
| 159 // Tracks time spent in (and out of) touchview mode. | 157 // Tracks time spent in (and out of) touchview mode. |
| 160 base::Time touchview_usage_interval_start_time_; | 158 base::Time touchview_usage_interval_start_time_; |
| 161 base::TimeDelta total_touchview_time_; | 159 base::TimeDelta total_touchview_time_; |
| 162 base::TimeDelta total_non_touchview_time_; | 160 base::TimeDelta total_non_touchview_time_; |
| 163 | 161 |
| 164 // Tracks the last time we received a lid open event. This is used to suppress | 162 // 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 | 163 // erroneous accelerometer readings as the lid is opened but the accelerometer |
| 166 // reports readings that make the lid to appear near fully open. | 164 // reports readings that make the lid to appear near fully open. |
| 167 base::TimeTicks last_lid_open_time_; | 165 base::TimeTicks last_lid_open_time_; |
| 168 | 166 |
| 169 // Source for the current time in base::TimeTicks. | 167 // Source for the current time in base::TimeTicks. |
| 170 std::unique_ptr<base::TickClock> tick_clock_; | 168 std::unique_ptr<base::TickClock> tick_clock_; |
| 171 | 169 |
| 170 #if defined(OS_CHROMEOS) |
| 171 // Set when tablet mode switch is on. This is used to force maximize mode. |
| 172 bool tablet_mode_switch_is_on_; |
| 173 #endif |
| 174 |
| 172 // Tracks when the lid is closed. Used to prevent entering maximize mode. | 175 // Tracks when the lid is closed. Used to prevent entering maximize mode. |
| 173 bool lid_is_closed_; | 176 bool lid_is_closed_; |
| 174 | 177 |
| 175 // Tracks smoothed accelerometer data over time. This is done when the hinge | 178 // Tracks smoothed accelerometer data over time. This is done when the hinge |
| 176 // is approaching vertical to remove abrupt acceleration that can lead to | 179 // is approaching vertical to remove abrupt acceleration that can lead to |
| 177 // incorrect calculations of hinge angles. | 180 // incorrect calculations of hinge angles. |
| 178 gfx::Vector3dF base_smoothed_; | 181 gfx::Vector3dF base_smoothed_; |
| 179 gfx::Vector3dF lid_smoothed_; | 182 gfx::Vector3dF lid_smoothed_; |
| 180 | 183 |
| 181 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 184 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 182 }; | 185 }; |
| 183 | 186 |
| 184 } // namespace ash | 187 } // namespace ash |
| 185 | 188 |
| 186 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 189 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |