Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: ash/common/wm/maximize_mode/maximize_mode_controller.h

Issue 2505403003: TouchView Mojom (Closed)
Patch Set: Minor param rename Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
14 #include "base/compiler_specific.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "mojo/public/cpp/bindings/binding_set.h"
18 #include "mojo/public/cpp/bindings/interface_ptr_set.h"
15 #include "ui/gfx/geometry/vector3d_f.h" 19 #include "ui/gfx/geometry/vector3d_f.h"
16 20
17 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
18 #include "chromeos/accelerometer/accelerometer_reader.h" 22 #include "chromeos/accelerometer/accelerometer_reader.h"
19 #include "chromeos/accelerometer/accelerometer_types.h" 23 #include "chromeos/accelerometer/accelerometer_types.h"
20 #include "chromeos/dbus/power_manager_client.h" 24 #include "chromeos/dbus/power_manager_client.h"
21 #endif // OS_CHROMEOS 25 #endif // OS_CHROMEOS
22 26
23 namespace base { 27 namespace base {
24 class TickClock; 28 class TickClock;
(...skipping 16 matching lines...) Expand all
41 } 45 }
42 46
43 // MaximizeModeController listens to accelerometer events and automatically 47 // MaximizeModeController listens to accelerometer events and automatically
44 // enters and exits maximize mode when the lid is opened beyond the triggering 48 // enters and exits maximize mode when the lid is opened beyond the triggering
45 // angle and rotates the display to match the device when in maximize mode. 49 // angle and rotates the display to match the device when in maximize mode.
46 class ASH_EXPORT MaximizeModeController : 50 class ASH_EXPORT MaximizeModeController :
47 #if defined(OS_CHROMEOS) 51 #if defined(OS_CHROMEOS)
48 public chromeos::AccelerometerReader::Observer, 52 public chromeos::AccelerometerReader::Observer,
49 public chromeos::PowerManagerClient::Observer, 53 public chromeos::PowerManagerClient::Observer,
50 #endif // OS_CHROMEOS 54 #endif // OS_CHROMEOS
55 NON_EXPORTED_BASE(public mojom::TouchViewManager),
51 public ShellObserver, 56 public ShellObserver,
52 public WmDisplayObserver { 57 public WmDisplayObserver {
53 public: 58 public:
54 MaximizeModeController(); 59 MaximizeModeController();
55 ~MaximizeModeController() override; 60 ~MaximizeModeController() override;
56 61
57 // True if it is possible to enter maximize mode in the current 62 // True if it is possible to enter maximize mode in the current
58 // configuration. If this returns false, it should never be the case that 63 // configuration. If this returns false, it should never be the case that
59 // maximize mode becomes enabled. 64 // maximize mode becomes enabled.
60 bool CanEnterMaximizeMode(); 65 bool CanEnterMaximizeMode();
61 66
62 // TODO(jonross): Merge this with EnterMaximizeMode. Currently these are 67 // TODO(jonross): Merge this with EnterMaximizeMode. Currently these are
63 // separate for several reasons: there is no internal display when running 68 // separate for several reasons: there is no internal display when running
64 // unittests; the event blocker prevents keyboard input when running ChromeOS 69 // unittests; the event blocker prevents keyboard input when running ChromeOS
65 // on linux. http://crbug.com/362881 70 // on linux. http://crbug.com/362881
66 // Turn the always maximize mode window manager on or off. 71 // Turn the always maximize mode window manager on or off.
67 void EnableMaximizeModeWindowManager(bool should_enable); 72 void EnableMaximizeModeWindowManager(bool should_enable);
68 73
69 // Test if the MaximizeModeWindowManager is enabled or not. 74 // Test if the MaximizeModeWindowManager is enabled or not.
70 bool IsMaximizeModeWindowManagerEnabled() const; 75 bool IsMaximizeModeWindowManagerEnabled() const;
71 76
72 // Add a special window to the MaximizeModeWindowManager for tracking. This is 77 // Add a special window to the MaximizeModeWindowManager for tracking. This is
73 // only required for special windows which are handled by other window 78 // only required for special windows which are handled by other window
74 // managers like the |MultiUserWindowManager|. 79 // managers like the |MultiUserWindowManager|.
75 // If the maximize mode is not enabled no action will be performed. 80 // If the maximize mode is not enabled no action will be performed.
76 void AddWindow(WmWindow* window); 81 void AddWindow(WmWindow* window);
77 82
83 // Binds the mojom::TouchViewManager interface request to this object.
84 void BindRequest(mojom::TouchViewManagerRequest request);
85
78 // ShellObserver: 86 // ShellObserver:
79 void OnAppTerminating() override; 87 void OnAppTerminating() override;
80 void OnMaximizeModeStarted() override; 88 void OnMaximizeModeStarted() override;
81 void OnMaximizeModeEnded() override; 89 void OnMaximizeModeEnded() override;
82 90
83 // WmDisplayObserver: 91 // WmDisplayObserver:
84 void OnDisplayConfigurationChanged() override; 92 void OnDisplayConfigurationChanged() override;
85 93
86 #if defined(OS_CHROMEOS) 94 #if defined(OS_CHROMEOS)
87 // chromeos::AccelerometerReader::Observer: 95 // chromeos::AccelerometerReader::Observer:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // TOUCH_VIEW_INTERVAL_INACTIVE, then record that TouchView has been 142 // TOUCH_VIEW_INTERVAL_INACTIVE, then record that TouchView has been
135 // inactive from |touchview_usage_interval_start_time_| until now. 143 // inactive from |touchview_usage_interval_start_time_| until now.
136 // Similarly, record that TouchView has been active if |type| is 144 // Similarly, record that TouchView has been active if |type| is
137 // TOUCH_VIEW_INTERVAL_ACTIVE. 145 // TOUCH_VIEW_INTERVAL_ACTIVE.
138 void RecordTouchViewUsageInterval(TouchViewIntervalType type); 146 void RecordTouchViewUsageInterval(TouchViewIntervalType type);
139 147
140 // Returns TOUCH_VIEW_INTERVAL_ACTIVE if TouchView is currently active, 148 // Returns TOUCH_VIEW_INTERVAL_ACTIVE if TouchView is currently active,
141 // otherwise returns TOUCH_VIEW_INTERNAL_INACTIVE. 149 // otherwise returns TOUCH_VIEW_INTERNAL_INACTIVE.
142 TouchViewIntervalType CurrentTouchViewIntervalType(); 150 TouchViewIntervalType CurrentTouchViewIntervalType();
143 151
152 // mojom::TouchViewManager:
153 void AddObserver(mojom::TouchViewObserverPtr observer) override;
154
144 // The maximized window manager (if enabled). 155 // The maximized window manager (if enabled).
145 std::unique_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_; 156 std::unique_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_;
146 157
147 // A helper class which when instantiated will block native events from the 158 // A helper class which when instantiated will block native events from the
148 // internal keyboard and touchpad. 159 // internal keyboard and touchpad.
149 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> event_blocker_; 160 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> event_blocker_;
150 161
151 // Whether we have ever seen accelerometer data. 162 // Whether we have ever seen accelerometer data.
152 bool have_seen_accelerometer_data_; 163 bool have_seen_accelerometer_data_;
153 164
(...skipping 17 matching lines...) Expand all
171 182
172 // Tracks when the lid is closed. Used to prevent entering maximize mode. 183 // Tracks when the lid is closed. Used to prevent entering maximize mode.
173 bool lid_is_closed_; 184 bool lid_is_closed_;
174 185
175 // Tracks smoothed accelerometer data over time. This is done when the hinge 186 // Tracks smoothed accelerometer data over time. This is done when the hinge
176 // is approaching vertical to remove abrupt acceleration that can lead to 187 // is approaching vertical to remove abrupt acceleration that can lead to
177 // incorrect calculations of hinge angles. 188 // incorrect calculations of hinge angles.
178 gfx::Vector3dF base_smoothed_; 189 gfx::Vector3dF base_smoothed_;
179 gfx::Vector3dF lid_smoothed_; 190 gfx::Vector3dF lid_smoothed_;
180 191
192 // Bindings for the TouchViewManager interface.
193 mojo::BindingSet<mojom::TouchViewManager> bindings_;
194
195 // The set of touchview observers to be notified about mode changes.
196 mojo::InterfacePtrSet<mojom::TouchViewObserver> observers_;
197
181 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); 198 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController);
182 }; 199 };
183 200
184 } // namespace ash 201 } // namespace ash
185 202
186 #endif // ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_ 203 #endif // ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/common/mojo_interface_factory.cc ('k') | ash/common/wm/maximize_mode/maximize_mode_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698