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

Side by Side Diff: ui/aura/env.h

Issue 2854663002: Make EnvInputStateController owned by aura::Env. (Closed)
Patch Set: Created 3 years, 7 months 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 | ui/aura/env.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_AURA_ENV_H_ 5 #ifndef UI_AURA_ENV_H_
6 #define UI_AURA_ENV_H_ 6 #define UI_AURA_ENV_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 16 matching lines...) Expand all
27 namespace ui { 27 namespace ui {
28 class ContextFactory; 28 class ContextFactory;
29 class ContextFactoryPrivate; 29 class ContextFactoryPrivate;
30 class PlatformEventSource; 30 class PlatformEventSource;
31 } 31 }
32 namespace aura { 32 namespace aura {
33 namespace test { 33 namespace test {
34 class EnvTestHelper; 34 class EnvTestHelper;
35 } 35 }
36 36
37 class EnvInputStateController;
37 class EnvObserver; 38 class EnvObserver;
38 class InputStateLookup; 39 class InputStateLookup;
39 class MusMouseLocationUpdater; 40 class MusMouseLocationUpdater;
40 class Window; 41 class Window;
41 class WindowPort; 42 class WindowPort;
42 class WindowTreeClient; 43 class WindowTreeClient;
43 class WindowTreeHost; 44 class WindowTreeHost;
44 45
45 // A singleton object that tracks general state within Aura. 46 // A singleton object that tracks general state within Aura.
46 class AURA_EXPORT Env : public ui::EventTarget, 47 class AURA_EXPORT Env : public ui::EventTarget,
(...skipping 17 matching lines...) Expand all
64 static Env* GetInstanceDontCreate(); 65 static Env* GetInstanceDontCreate();
65 66
66 Mode mode() const { return mode_; } 67 Mode mode() const { return mode_; }
67 68
68 // Called internally to create the appropriate WindowPort implementation. 69 // Called internally to create the appropriate WindowPort implementation.
69 std::unique_ptr<WindowPort> CreateWindowPort(Window* window); 70 std::unique_ptr<WindowPort> CreateWindowPort(Window* window);
70 71
71 void AddObserver(EnvObserver* observer); 72 void AddObserver(EnvObserver* observer);
72 void RemoveObserver(EnvObserver* observer); 73 void RemoveObserver(EnvObserver* observer);
73 74
75 EnvInputStateController* env_controller() const {
76 return env_controller_.get();
77 }
78
74 int mouse_button_flags() const { return mouse_button_flags_; } 79 int mouse_button_flags() const { return mouse_button_flags_; }
75 void set_mouse_button_flags(int mouse_button_flags) { 80 void set_mouse_button_flags(int mouse_button_flags) {
76 mouse_button_flags_ = mouse_button_flags; 81 mouse_button_flags_ = mouse_button_flags;
77 } 82 }
78 // Returns true if a mouse button is down. This may query the native OS, 83 // Returns true if a mouse button is down. This may query the native OS,
79 // otherwise it uses |mouse_button_flags_|. 84 // otherwise it uses |mouse_button_flags_|.
80 bool IsMouseButtonDown() const; 85 bool IsMouseButtonDown() const;
81 86
82 // Gets/sets the last mouse location seen in a mouse event in the screen 87 // Gets/sets the last mouse location seen in a mouse event in the screen
83 // coordinates. 88 // coordinates.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // This is not const for tests, which may share Env across tests and so needs 148 // This is not const for tests, which may share Env across tests and so needs
144 // to reset the value. 149 // to reset the value.
145 Mode mode_; 150 Mode mode_;
146 151
147 // Intentionally not exposed publicly. Someday we might want to support 152 // Intentionally not exposed publicly. Someday we might want to support
148 // multiple WindowTreeClients. Use EnvTestHelper in tests. 153 // multiple WindowTreeClients. Use EnvTestHelper in tests.
149 WindowTreeClient* window_tree_client_ = nullptr; 154 WindowTreeClient* window_tree_client_ = nullptr;
150 155
151 base::ObserverList<EnvObserver> observers_; 156 base::ObserverList<EnvObserver> observers_;
152 157
158 std::unique_ptr<EnvInputStateController> env_controller_;
153 int mouse_button_flags_; 159 int mouse_button_flags_;
154 // Location of last mouse event, in screen coordinates. 160 // Location of last mouse event, in screen coordinates.
155 mutable gfx::Point last_mouse_location_; 161 mutable gfx::Point last_mouse_location_;
156 bool is_touch_down_; 162 bool is_touch_down_;
157 bool get_last_mouse_location_from_mus_; 163 bool get_last_mouse_location_from_mus_;
158 // This may be set to true in tests to force using |last_mouse_location_| 164 // This may be set to true in tests to force using |last_mouse_location_|
159 // rather than querying WindowTreeClient. 165 // rather than querying WindowTreeClient.
160 bool always_use_last_mouse_location_ = false; 166 bool always_use_last_mouse_location_ = false;
161 // Whether we set ourselves as the OSExchangeDataProviderFactory. 167 // Whether we set ourselves as the OSExchangeDataProviderFactory.
162 bool is_os_exchange_data_provider_factory_ = false; 168 bool is_os_exchange_data_provider_factory_ = false;
163 169
164 std::unique_ptr<InputStateLookup> input_state_lookup_; 170 std::unique_ptr<InputStateLookup> input_state_lookup_;
165 std::unique_ptr<ui::PlatformEventSource> event_source_; 171 std::unique_ptr<ui::PlatformEventSource> event_source_;
166 172
167 #if defined(USE_OZONE) 173 #if defined(USE_OZONE)
168 // Factory for pixmaps that can use be transported from the client to the GPU 174 // Factory for pixmaps that can use be transported from the client to the GPU
169 // process using a low-level ozone-provided platform specific mechanism. 175 // process using a low-level ozone-provided platform specific mechanism.
170 std::unique_ptr<gfx::ClientNativePixmapFactory> native_pixmap_factory_; 176 std::unique_ptr<gfx::ClientNativePixmapFactory> native_pixmap_factory_;
171 #endif 177 #endif
172 178
173 ui::ContextFactory* context_factory_; 179 ui::ContextFactory* context_factory_;
174 ui::ContextFactoryPrivate* context_factory_private_; 180 ui::ContextFactoryPrivate* context_factory_private_;
175 181
176 DISALLOW_COPY_AND_ASSIGN(Env); 182 DISALLOW_COPY_AND_ASSIGN(Env);
177 }; 183 };
178 184
179 } // namespace aura 185 } // namespace aura
180 186
181 #endif // UI_AURA_ENV_H_ 187 #endif // UI_AURA_ENV_H_
OLDNEW
« no previous file with comments | « no previous file | ui/aura/env.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698