| 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_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| 6 #define ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 6 #define ASH_COMMON_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" |
| 11 #include "ash/common/shell_observer.h" | 11 #include "ash/common/shell_observer.h" |
| 12 #include "ash/common/wm_display_observer.h" | 12 #include "ash/common/wm_display_observer.h" |
| 13 #include "ash/public/interfaces/touch_view.mojom.h" | 13 #include "ash/public/interfaces/touch_view.mojom.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 17 #include "chromeos/accelerometer/accelerometer_reader.h" | 18 #include "chromeos/accelerometer/accelerometer_reader.h" |
| 18 #include "chromeos/accelerometer/accelerometer_types.h" | 19 #include "chromeos/accelerometer/accelerometer_types.h" |
| 19 #include "chromeos/dbus/power_manager_client.h" | 20 #include "chromeos/dbus/power_manager_client.h" |
| 20 #include "mojo/public/cpp/bindings/binding_set.h" | 21 #include "mojo/public/cpp/bindings/binding_set.h" |
| 21 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | 22 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
| 22 #include "ui/gfx/geometry/vector3d_f.h" | 23 #include "ui/gfx/geometry/vector3d_f.h" |
| 23 | 24 |
| 24 namespace base { | 25 namespace base { |
| 25 class TickClock; | 26 class TickClock; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 114 |
| 114 // Set the TickClock. This is only to be used by tests that need to | 115 // Set the TickClock. This is only to be used by tests that need to |
| 115 // artificially and deterministically control the current time. | 116 // artificially and deterministically control the current time. |
| 116 void SetTickClockForTest(std::unique_ptr<base::TickClock> tick_clock); | 117 void SetTickClockForTest(std::unique_ptr<base::TickClock> tick_clock); |
| 117 | 118 |
| 118 // Detect hinge rotation from base and lid accelerometers and automatically | 119 // Detect hinge rotation from base and lid accelerometers and automatically |
| 119 // start / stop maximize mode. | 120 // start / stop maximize mode. |
| 120 void HandleHingeRotation( | 121 void HandleHingeRotation( |
| 121 scoped_refptr<const chromeos::AccelerometerUpdate> update); | 122 scoped_refptr<const chromeos::AccelerometerUpdate> update); |
| 122 | 123 |
| 124 void OnGetSwitchStates(chromeos::PowerManagerClient::LidState lid_state, |
| 125 chromeos::PowerManagerClient::TabletMode tablet_mode); |
| 126 |
| 123 // Returns true if the lid was recently opened. | 127 // Returns true if the lid was recently opened. |
| 124 bool WasLidOpenedRecently() const; | 128 bool WasLidOpenedRecently() const; |
| 125 | 129 |
| 126 // Enables MaximizeModeWindowManager, and determines the current state of | 130 // Enables MaximizeModeWindowManager, and determines the current state of |
| 127 // rotation lock. | 131 // rotation lock. |
| 128 void EnterMaximizeMode(); | 132 void EnterMaximizeMode(); |
| 129 | 133 |
| 130 // Removes MaximizeModeWindowManager and resets the display rotation if there | 134 // Removes MaximizeModeWindowManager and resets the display rotation if there |
| 131 // is no rotation lock. | 135 // is no rotation lock. |
| 132 void LeaveMaximizeMode(); | 136 void LeaveMaximizeMode(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // incorrect calculations of hinge angles. | 186 // incorrect calculations of hinge angles. |
| 183 gfx::Vector3dF base_smoothed_; | 187 gfx::Vector3dF base_smoothed_; |
| 184 gfx::Vector3dF lid_smoothed_; | 188 gfx::Vector3dF lid_smoothed_; |
| 185 | 189 |
| 186 // Bindings for the TouchViewManager interface. | 190 // Bindings for the TouchViewManager interface. |
| 187 mojo::BindingSet<mojom::TouchViewManager> bindings_; | 191 mojo::BindingSet<mojom::TouchViewManager> bindings_; |
| 188 | 192 |
| 189 // The set of touchview observers to be notified about mode changes. | 193 // The set of touchview observers to be notified about mode changes. |
| 190 mojo::InterfacePtrSet<mojom::TouchViewObserver> observers_; | 194 mojo::InterfacePtrSet<mojom::TouchViewObserver> observers_; |
| 191 | 195 |
| 196 base::WeakPtrFactory<MaximizeModeController> weak_factory_; |
| 197 |
| 192 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 198 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 193 }; | 199 }; |
| 194 | 200 |
| 195 } // namespace ash | 201 } // namespace ash |
| 196 | 202 |
| 197 #endif // ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 203 #endif // ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |