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

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

Issue 2759463002: aura-mus: create an interactive ui test for drag and drop. (Closed)
Patch Set: Merge with master Created 3 years, 9 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/env.h ('k') | ui/aura/mus/window_tree_client.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 #include "ui/aura/env.h" 5 #include "ui/aura/env.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 private: 69 private:
70 Window* window_; 70 Window* window_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(ActiveFocusClientWindowObserver); 72 DISALLOW_COPY_AND_ASSIGN(ActiveFocusClientWindowObserver);
73 }; 73 };
74 74
75 //////////////////////////////////////////////////////////////////////////////// 75 ////////////////////////////////////////////////////////////////////////////////
76 // Env, public: 76 // Env, public:
77 77
78 Env::~Env() { 78 Env::~Env() {
79 if (RunningInsideMus()) 79 if (is_os_exchange_data_provider_factory_)
80 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); 80 ui::OSExchangeDataProviderFactory::SetFactory(nullptr);
81 81
82 for (EnvObserver& observer : observers_) 82 for (EnvObserver& observer : observers_)
83 observer.OnWillDestroyEnv(); 83 observer.OnWillDestroyEnv();
84 DCHECK_EQ(this, lazy_tls_ptr.Pointer()->Get()); 84 DCHECK_EQ(this, lazy_tls_ptr.Pointer()->Get());
85 lazy_tls_ptr.Pointer()->Set(NULL); 85 lazy_tls_ptr.Pointer()->Set(NULL);
86 } 86 }
87 87
88 // static 88 // static
89 std::unique_ptr<Env> Env::CreateInstance(Mode mode) { 89 std::unique_ptr<Env> Env::CreateInstance(Mode mode) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 get_last_mouse_location_from_mus_(mode_ == Mode::MUS), 190 get_last_mouse_location_from_mus_(mode_ == Mode::MUS),
191 input_state_lookup_(InputStateLookup::Create()), 191 input_state_lookup_(InputStateLookup::Create()),
192 context_factory_(nullptr), 192 context_factory_(nullptr),
193 context_factory_private_(nullptr) { 193 context_factory_private_(nullptr) {
194 DCHECK(lazy_tls_ptr.Pointer()->Get() == NULL); 194 DCHECK(lazy_tls_ptr.Pointer()->Get() == NULL);
195 lazy_tls_ptr.Pointer()->Set(this); 195 lazy_tls_ptr.Pointer()->Set(this);
196 } 196 }
197 197
198 void Env::Init() { 198 void Env::Init() {
199 if (RunningInsideMus()) { 199 if (RunningInsideMus()) {
200 ui::OSExchangeDataProviderFactory::SetFactory(this); 200 EnableMusOSExchangeDataProvider();
201 return; 201 return;
202 } 202 }
203 203
204 #if defined(USE_OZONE) 204 #if defined(USE_OZONE)
205 // The ozone platform can provide its own event source. So initialize the 205 // The ozone platform can provide its own event source. So initialize the
206 // platform before creating the default event source. If running inside mus 206 // platform before creating the default event source. If running inside mus
207 // let the mus process initialize ozone instead. 207 // let the mus process initialize ozone instead.
208 ui::OzonePlatform::InitializeForUI(); 208 ui::OzonePlatform::InitializeForUI();
209 #endif 209 #endif
210 if (!ui::PlatformEventSource::GetInstance()) 210 if (!ui::PlatformEventSource::GetInstance())
211 event_source_ = ui::PlatformEventSource::CreateDefault(); 211 event_source_ = ui::PlatformEventSource::CreateDefault();
212 } 212 }
213 213
214 void Env::EnableMusOSExchangeDataProvider() {
215 if (!is_os_exchange_data_provider_factory_) {
216 ui::OSExchangeDataProviderFactory::SetFactory(this);
217 is_os_exchange_data_provider_factory_ = true;
218 }
219 }
220
214 void Env::NotifyWindowInitialized(Window* window) { 221 void Env::NotifyWindowInitialized(Window* window) {
215 for (EnvObserver& observer : observers_) 222 for (EnvObserver& observer : observers_)
216 observer.OnWindowInitialized(window); 223 observer.OnWindowInitialized(window);
217 } 224 }
218 225
219 void Env::NotifyHostInitialized(WindowTreeHost* host) { 226 void Env::NotifyHostInitialized(WindowTreeHost* host) {
220 for (EnvObserver& observer : observers_) 227 for (EnvObserver& observer : observers_)
221 observer.OnHostInitialized(host); 228 observer.OnHostInitialized(host);
222 } 229 }
223 230
(...skipping 24 matching lines...) Expand all
248 ui::EventTargeter* Env::GetEventTargeter() { 255 ui::EventTargeter* Env::GetEventTargeter() {
249 NOTREACHED(); 256 NOTREACHED();
250 return NULL; 257 return NULL;
251 } 258 }
252 259
253 std::unique_ptr<ui::OSExchangeData::Provider> Env::BuildProvider() { 260 std::unique_ptr<ui::OSExchangeData::Provider> Env::BuildProvider() {
254 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); 261 return base::MakeUnique<aura::OSExchangeDataProviderMus>();
255 } 262 }
256 263
257 } // namespace aura 264 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/mus/window_tree_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698