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

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

Issue 2579703003: Using ShellObserver instead of creating MaximizeModeController::Observer (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | ash/common/wm/maximize_mode/maximize_mode_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 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/observer_list.h"
17 #include "base/time/time.h" 16 #include "base/time/time.h"
18 #include "mojo/public/cpp/bindings/binding_set.h" 17 #include "mojo/public/cpp/bindings/binding_set.h"
19 #include "mojo/public/cpp/bindings/interface_ptr_set.h" 18 #include "mojo/public/cpp/bindings/interface_ptr_set.h"
20 #include "ui/gfx/geometry/vector3d_f.h" 19 #include "ui/gfx/geometry/vector3d_f.h"
21 20
22 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
23 #include "chromeos/accelerometer/accelerometer_reader.h" 22 #include "chromeos/accelerometer/accelerometer_reader.h"
24 #include "chromeos/accelerometer/accelerometer_types.h" 23 #include "chromeos/accelerometer/accelerometer_types.h"
25 #include "chromeos/dbus/power_manager_client.h" 24 #include "chromeos/dbus/power_manager_client.h"
26 #endif // OS_CHROMEOS 25 #endif // OS_CHROMEOS
(...skipping 23 matching lines...) Expand all
50 // 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.
51 class ASH_EXPORT MaximizeModeController : 50 class ASH_EXPORT MaximizeModeController :
52 #if defined(OS_CHROMEOS) 51 #if defined(OS_CHROMEOS)
53 public chromeos::AccelerometerReader::Observer, 52 public chromeos::AccelerometerReader::Observer,
54 public chromeos::PowerManagerClient::Observer, 53 public chromeos::PowerManagerClient::Observer,
55 #endif // OS_CHROMEOS 54 #endif // OS_CHROMEOS
56 NON_EXPORTED_BASE(public mojom::TouchViewManager), 55 NON_EXPORTED_BASE(public mojom::TouchViewManager),
57 public ShellObserver, 56 public ShellObserver,
58 public WmDisplayObserver { 57 public WmDisplayObserver {
59 public: 58 public:
60 // Interface for observing changes from MaximizeModeController.
61 class Observer {
62 public:
63 virtual ~Observer() {}
64
65 // Called when device enters maximize mode.
66 virtual void OnEnterMaximizeMode() {}
67
68 // Called when device leaves maximize mode.
69 virtual void OnLeaveMaximizeMode() {}
70 };
71
72 MaximizeModeController(); 59 MaximizeModeController();
73 ~MaximizeModeController() override; 60 ~MaximizeModeController() override;
74 61
75 // Adds and removes the |observer|.
76 void AddObserver(Observer* observer);
77 void RemoveObserver(Observer* observer);
78
79 // 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
80 // 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
81 // maximize mode becomes enabled. 64 // maximize mode becomes enabled.
82 bool CanEnterMaximizeMode(); 65 bool CanEnterMaximizeMode();
83 66
84 // TODO(jonross): Merge this with EnterMaximizeMode. Currently these are 67 // TODO(jonross): Merge this with EnterMaximizeMode. Currently these are
85 // separate for several reasons: there is no internal display when running 68 // separate for several reasons: there is no internal display when running
86 // unittests; the event blocker prevents keyboard input when running ChromeOS 69 // unittests; the event blocker prevents keyboard input when running ChromeOS
87 // on linux. http://crbug.com/362881 70 // on linux. http://crbug.com/362881
88 // Turn the always maximize mode window manager on or off. 71 // Turn the always maximize mode window manager on or off.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // 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
204 // is approaching vertical to remove abrupt acceleration that can lead to 187 // is approaching vertical to remove abrupt acceleration that can lead to
205 // incorrect calculations of hinge angles. 188 // incorrect calculations of hinge angles.
206 gfx::Vector3dF base_smoothed_; 189 gfx::Vector3dF base_smoothed_;
207 gfx::Vector3dF lid_smoothed_; 190 gfx::Vector3dF lid_smoothed_;
208 191
209 // Bindings for the TouchViewManager interface. 192 // Bindings for the TouchViewManager interface.
210 mojo::BindingSet<mojom::TouchViewManager> bindings_; 193 mojo::BindingSet<mojom::TouchViewManager> bindings_;
211 194
212 // The set of touchview observers to be notified about mode changes. 195 // The set of touchview observers to be notified about mode changes.
213 mojo::InterfacePtrSet<mojom::TouchViewObserver> touchview_observers_; 196 mojo::InterfacePtrSet<mojom::TouchViewObserver> observers_;
214
215 base::ObserverList<Observer> observers_;
216 197
217 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController); 198 DISALLOW_COPY_AND_ASSIGN(MaximizeModeController);
218 }; 199 };
219 200
220 } // namespace ash 201 } // namespace ash
221 202
222 #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 | « no previous file | ash/common/wm/maximize_mode/maximize_mode_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698