| 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // MaximizeModeController listens to accelerometer events and automatically | 45 // MaximizeModeController listens to accelerometer events and automatically |
| 46 // enters and exits maximize mode when the lid is opened beyond the triggering | 46 // enters and exits maximize mode when the lid is opened beyond the triggering |
| 47 // angle and rotates the display to match the device when in maximize mode. | 47 // angle and rotates the display to match the device when in maximize mode. |
| 48 class ASH_EXPORT MaximizeModeController : | 48 class ASH_EXPORT MaximizeModeController : |
| 49 public chromeos::AccelerometerReader::Observer, | 49 public chromeos::AccelerometerReader::Observer, |
| 50 public chromeos::PowerManagerClient::Observer, | 50 public chromeos::PowerManagerClient::Observer, |
| 51 NON_EXPORTED_BASE(public mojom::TouchViewManager), | 51 NON_EXPORTED_BASE(public mojom::TouchViewManager), |
| 52 public ShellObserver, | 52 public ShellObserver, |
| 53 public WmDisplayObserver { | 53 public WmDisplayObserver { |
| 54 public: | 54 public: |
| 55 // Used for keeping track if the user wants the machine to behave as a |
| 56 // clamshell/touchview regardless of hardware orientation. |
| 57 enum class ForceTabletMode { |
| 58 NONE = 0, |
| 59 CLAMSHELL, |
| 60 TOUCHVIEW, |
| 61 }; |
| 62 |
| 55 MaximizeModeController(); | 63 MaximizeModeController(); |
| 56 ~MaximizeModeController() override; | 64 ~MaximizeModeController() override; |
| 57 | 65 |
| 58 // True if it is possible to enter maximize mode in the current | 66 // True if it is possible to enter maximize mode in the current |
| 59 // configuration. If this returns false, it should never be the case that | 67 // configuration. If this returns false, it should never be the case that |
| 60 // maximize mode becomes enabled. | 68 // maximize mode becomes enabled. |
| 61 bool CanEnterMaximizeMode(); | 69 bool CanEnterMaximizeMode(); |
| 62 | 70 |
| 63 // TODO(jonross): Merge this with EnterMaximizeMode. Currently these are | 71 // TODO(jonross): Merge this with EnterMaximizeMode. Currently these are |
| 64 // separate for several reasons: there is no internal display when running | 72 // separate for several reasons: there is no internal display when running |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 // If the maximize mode is not enabled no action will be performed. | 84 // If the maximize mode is not enabled no action will be performed. |
| 77 void AddWindow(WmWindow* window); | 85 void AddWindow(WmWindow* window); |
| 78 | 86 |
| 79 // Binds the mojom::TouchViewManager interface request to this object. | 87 // Binds the mojom::TouchViewManager interface request to this object. |
| 80 void BindRequest(mojom::TouchViewManagerRequest request); | 88 void BindRequest(mojom::TouchViewManagerRequest request); |
| 81 | 89 |
| 82 // ShellObserver: | 90 // ShellObserver: |
| 83 void OnAppTerminating() override; | 91 void OnAppTerminating() override; |
| 84 void OnMaximizeModeStarted() override; | 92 void OnMaximizeModeStarted() override; |
| 85 void OnMaximizeModeEnded() override; | 93 void OnMaximizeModeEnded() override; |
| 94 void OnShellInitialized() override; |
| 86 | 95 |
| 87 // WmDisplayObserver: | 96 // WmDisplayObserver: |
| 88 void OnDisplayConfigurationChanged() override; | 97 void OnDisplayConfigurationChanged() override; |
| 89 | 98 |
| 90 // chromeos::AccelerometerReader::Observer: | 99 // chromeos::AccelerometerReader::Observer: |
| 91 void OnAccelerometerUpdated( | 100 void OnAccelerometerUpdated( |
| 92 scoped_refptr<const chromeos::AccelerometerUpdate> update) override; | 101 scoped_refptr<const chromeos::AccelerometerUpdate> update) override; |
| 93 | 102 |
| 94 // chromeos::PowerManagerClient::Observer: | 103 // chromeos::PowerManagerClient::Observer: |
| 95 void LidEventReceived(chromeos::PowerManagerClient::LidState state, | 104 void LidEventReceived(chromeos::PowerManagerClient::LidState state, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // TOUCH_VIEW_INTERVAL_ACTIVE. | 151 // TOUCH_VIEW_INTERVAL_ACTIVE. |
| 143 void RecordTouchViewUsageInterval(TouchViewIntervalType type); | 152 void RecordTouchViewUsageInterval(TouchViewIntervalType type); |
| 144 | 153 |
| 145 // Returns TOUCH_VIEW_INTERVAL_ACTIVE if TouchView is currently active, | 154 // Returns TOUCH_VIEW_INTERVAL_ACTIVE if TouchView is currently active, |
| 146 // otherwise returns TOUCH_VIEW_INTERNAL_INACTIVE. | 155 // otherwise returns TOUCH_VIEW_INTERNAL_INACTIVE. |
| 147 TouchViewIntervalType CurrentTouchViewIntervalType(); | 156 TouchViewIntervalType CurrentTouchViewIntervalType(); |
| 148 | 157 |
| 149 // mojom::TouchViewManager: | 158 // mojom::TouchViewManager: |
| 150 void AddObserver(mojom::TouchViewObserverPtr observer) override; | 159 void AddObserver(mojom::TouchViewObserverPtr observer) override; |
| 151 | 160 |
| 161 // Checks whether we want to allow entering and exiting maximize mode. This |
| 162 // returns false if the user set a flag for the software to behave in a |
| 163 // certain way regardless of configuration. |
| 164 bool AllowEnterExitMaximizeMode() const; |
| 165 |
| 152 // The maximized window manager (if enabled). | 166 // The maximized window manager (if enabled). |
| 153 std::unique_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_; | 167 std::unique_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_; |
| 154 | 168 |
| 155 // A helper class which when instantiated will block native events from the | 169 // A helper class which when instantiated will block native events from the |
| 156 // internal keyboard and touchpad. | 170 // internal keyboard and touchpad. |
| 157 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> event_blocker_; | 171 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> event_blocker_; |
| 158 | 172 |
| 159 // Whether we have ever seen accelerometer data. | 173 // Whether we have ever seen accelerometer data. |
| 160 bool have_seen_accelerometer_data_; | 174 bool have_seen_accelerometer_data_; |
| 161 | 175 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 186 // incorrect calculations of hinge angles. | 200 // incorrect calculations of hinge angles. |
| 187 gfx::Vector3dF base_smoothed_; | 201 gfx::Vector3dF base_smoothed_; |
| 188 gfx::Vector3dF lid_smoothed_; | 202 gfx::Vector3dF lid_smoothed_; |
| 189 | 203 |
| 190 // Bindings for the TouchViewManager interface. | 204 // Bindings for the TouchViewManager interface. |
| 191 mojo::BindingSet<mojom::TouchViewManager> bindings_; | 205 mojo::BindingSet<mojom::TouchViewManager> bindings_; |
| 192 | 206 |
| 193 // The set of touchview observers to be notified about mode changes. | 207 // The set of touchview observers to be notified about mode changes. |
| 194 mojo::InterfacePtrSet<mojom::TouchViewObserver> observers_; | 208 mojo::InterfacePtrSet<mojom::TouchViewObserver> observers_; |
| 195 | 209 |
| 210 // Tracks whether a flag is used to force maximize mode. |
| 211 ForceTabletMode force_tablet_mode_ = ForceTabletMode::NONE; |
| 212 |
| 196 base::WeakPtrFactory<MaximizeModeController> weak_factory_; | 213 base::WeakPtrFactory<MaximizeModeController> weak_factory_; |
| 197 | 214 |
| 198 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); | 215 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); |
| 199 }; | 216 }; |
| 200 | 217 |
| 201 } // namespace ash | 218 } // namespace ash |
| 202 | 219 |
| 203 #endif // ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ | 220 #endif // ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ |
| OLD | NEW |