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

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

Issue 2897663002: chromeos: makes it possible for windows to outlive WindowTreeClient (Closed)
Patch Set: cleanup 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 | « ui/aura/BUILD.gn ('k') | 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 // See CreateInstance() for description. 111 // See CreateInstance() for description.
112 void SetWindowTreeClient(WindowTreeClient* window_tree_client); 112 void SetWindowTreeClient(WindowTreeClient* window_tree_client);
113 bool HasWindowTreeClient() const { return window_tree_client_ != nullptr; } 113 bool HasWindowTreeClient() const { return window_tree_client_ != nullptr; }
114 114
115 private: 115 private:
116 friend class test::EnvTestHelper; 116 friend class test::EnvTestHelper;
117 friend class EventInjector; 117 friend class EventInjector;
118 friend class MusMouseLocationUpdater; 118 friend class MusMouseLocationUpdater;
119 friend class Window; 119 friend class Window;
120 friend class WindowTreeClient; // For call to WindowTreeClientDestroyed().
120 friend class WindowTreeHost; 121 friend class WindowTreeHost;
121 122
122 explicit Env(Mode mode); 123 explicit Env(Mode mode);
123 124
124 void Init(); 125 void Init();
125 126
126 // After calling this method, all OSExchangeDataProvider instances will be 127 // After calling this method, all OSExchangeDataProvider instances will be
127 // Mus instances. We can't do this work in Init(), because our mode may 128 // Mus instances. We can't do this work in Init(), because our mode may
128 // changed via the EnvTestHelper. 129 // changed via the EnvTestHelper.
129 void EnableMusOSExchangeDataProvider(); 130 void EnableMusOSExchangeDataProvider();
130 131
131 // Called by the Window when it is initialized. Notifies observers. 132 // Called by the Window when it is initialized. Notifies observers.
132 void NotifyWindowInitialized(Window* window); 133 void NotifyWindowInitialized(Window* window);
133 134
134 // Called by the WindowTreeHost when it is initialized. Notifies observers. 135 // Called by the WindowTreeHost when it is initialized. Notifies observers.
135 void NotifyHostInitialized(WindowTreeHost* host); 136 void NotifyHostInitialized(WindowTreeHost* host);
136 137
137 // Invoked by WindowTreeHost when it is activated. Notifies observers. 138 // Invoked by WindowTreeHost when it is activated. Notifies observers.
138 void NotifyHostActivated(WindowTreeHost* host); 139 void NotifyHostActivated(WindowTreeHost* host);
139 140
141 void WindowTreeClientDestroyed(WindowTreeClient* client);
142
140 // Overridden from ui::EventTarget: 143 // Overridden from ui::EventTarget:
141 bool CanAcceptEvent(const ui::Event& event) override; 144 bool CanAcceptEvent(const ui::Event& event) override;
142 ui::EventTarget* GetParentTarget() override; 145 ui::EventTarget* GetParentTarget() override;
143 std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override; 146 std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override;
144 ui::EventTargeter* GetEventTargeter() override; 147 ui::EventTargeter* GetEventTargeter() override;
145 148
146 // Overridden from ui::OSExchangeDataProviderFactory::Factory: 149 // Overridden from ui::OSExchangeDataProviderFactory::Factory:
147 std::unique_ptr<ui::OSExchangeData::Provider> BuildProvider() override; 150 std::unique_ptr<ui::OSExchangeData::Provider> BuildProvider() override;
148 151
149 // This is not const for tests, which may share Env across tests and so needs 152 // This is not const for tests, which may share Env across tests and so needs
150 // to reset the value. 153 // to reset the value.
151 Mode mode_; 154 Mode mode_;
152 155
153 // Intentionally not exposed publicly. Someday we might want to support 156 // Intentionally not exposed publicly. Someday we might want to support
154 // multiple WindowTreeClients. Use EnvTestHelper in tests. 157 // multiple WindowTreeClients. Use EnvTestHelper in tests. This is set to null
158 // during shutdown.
155 WindowTreeClient* window_tree_client_ = nullptr; 159 WindowTreeClient* window_tree_client_ = nullptr;
156 160
157 base::ObserverList<EnvObserver> observers_; 161 base::ObserverList<EnvObserver> observers_;
158 162
159 std::unique_ptr<EnvInputStateController> env_controller_; 163 std::unique_ptr<EnvInputStateController> env_controller_;
160 int mouse_button_flags_; 164 int mouse_button_flags_;
161 // Location of last mouse event, in screen coordinates. 165 // Location of last mouse event, in screen coordinates.
162 mutable gfx::Point last_mouse_location_; 166 mutable gfx::Point last_mouse_location_;
163 bool is_touch_down_; 167 bool is_touch_down_;
164 bool get_last_mouse_location_from_mus_; 168 bool get_last_mouse_location_from_mus_;
165 // This may be set to true in tests to force using |last_mouse_location_| 169 // This may be set to true in tests to force using |last_mouse_location_|
166 // rather than querying WindowTreeClient. 170 // rather than querying WindowTreeClient.
167 bool always_use_last_mouse_location_ = false; 171 bool always_use_last_mouse_location_ = false;
168 // Whether we set ourselves as the OSExchangeDataProviderFactory. 172 // Whether we set ourselves as the OSExchangeDataProviderFactory.
169 bool is_os_exchange_data_provider_factory_ = false; 173 bool is_os_exchange_data_provider_factory_ = false;
170 174
171 std::unique_ptr<InputStateLookup> input_state_lookup_; 175 std::unique_ptr<InputStateLookup> input_state_lookup_;
172 std::unique_ptr<ui::PlatformEventSource> event_source_; 176 std::unique_ptr<ui::PlatformEventSource> event_source_;
173 177
174 #if defined(USE_OZONE) 178 #if defined(USE_OZONE)
175 // Factory for pixmaps that can use be transported from the client to the GPU 179 // Factory for pixmaps that can use be transported from the client to the GPU
176 // process using a low-level ozone-provided platform specific mechanism. 180 // process using a low-level ozone-provided platform specific mechanism.
177 std::unique_ptr<gfx::ClientNativePixmapFactory> native_pixmap_factory_; 181 std::unique_ptr<gfx::ClientNativePixmapFactory> native_pixmap_factory_;
178 #endif 182 #endif
179 183
180 ui::ContextFactory* context_factory_; 184 ui::ContextFactory* context_factory_;
181 ui::ContextFactoryPrivate* context_factory_private_; 185 ui::ContextFactoryPrivate* context_factory_private_;
182 186
187 // This is set to true when the WindowTreeClient is destroyed. It triggers
188 // creating a different WindowPort implementation.
189 bool in_mus_shutdown_ = false;
190
183 DISALLOW_COPY_AND_ASSIGN(Env); 191 DISALLOW_COPY_AND_ASSIGN(Env);
184 }; 192 };
185 193
186 } // namespace aura 194 } // namespace aura
187 195
188 #endif // UI_AURA_ENV_H_ 196 #endif // UI_AURA_ENV_H_
OLDNEW
« no previous file with comments | « ui/aura/BUILD.gn ('k') | ui/aura/env.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698