OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/views/mus/mus_client.h" | 5 #include "ui/views/mus/mus_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "services/service_manager/public/cpp/connection.h" | 9 #include "services/service_manager/public/cpp/connection.h" |
10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" |
11 #include "services/ui/public/cpp/gpu/gpu_service.h" | 11 #include "services/ui/public/cpp/gpu/gpu.h" |
12 #include "services/ui/public/cpp/property_type_converters.h" | 12 #include "services/ui/public/cpp/property_type_converters.h" |
13 #include "services/ui/public/interfaces/event_matcher.mojom.h" | 13 #include "services/ui/public/interfaces/event_matcher.mojom.h" |
14 #include "services/ui/public/interfaces/window_manager.mojom.h" | 14 #include "services/ui/public/interfaces/window_manager.mojom.h" |
15 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
16 #include "ui/aura/mus/mus_context_factory.h" | 16 #include "ui/aura/mus/mus_context_factory.h" |
17 #include "ui/aura/mus/os_exchange_data_provider_mus.h" | 17 #include "ui/aura/mus/os_exchange_data_provider_mus.h" |
18 #include "ui/aura/mus/property_converter.h" | 18 #include "ui/aura/mus/property_converter.h" |
19 #include "ui/aura/mus/window_tree_client.h" | 19 #include "ui/aura/mus/window_tree_client.h" |
20 #include "ui/aura/mus/window_tree_host_mus.h" | 20 #include "ui/aura/mus/window_tree_host_mus.h" |
21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // static | 55 // static |
56 MusClient* MusClient::instance_ = nullptr; | 56 MusClient* MusClient::instance_ = nullptr; |
57 | 57 |
58 MusClient::~MusClient() { | 58 MusClient::~MusClient() { |
59 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while | 59 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while |
60 // we are still valid. | 60 // we are still valid. |
61 window_tree_client_.reset(); | 61 window_tree_client_.reset(); |
62 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); | 62 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); |
63 ui::Clipboard::DestroyClipboardForCurrentThread(); | 63 ui::Clipboard::DestroyClipboardForCurrentThread(); |
64 gpu_service_.reset(); | 64 gpu_.reset(); |
65 | 65 |
66 if (ViewsDelegate::GetInstance()) { | 66 if (ViewsDelegate::GetInstance()) { |
67 ViewsDelegate::GetInstance()->set_native_widget_factory( | 67 ViewsDelegate::GetInstance()->set_native_widget_factory( |
68 ViewsDelegate::NativeWidgetFactory()); | 68 ViewsDelegate::NativeWidgetFactory()); |
69 } | 69 } |
70 | 70 |
71 DCHECK_EQ(instance_, this); | 71 DCHECK_EQ(instance_, this); |
72 instance_ = nullptr; | 72 instance_ = nullptr; |
73 } | 73 } |
74 | 74 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 const service_manager::Identity& identity, | 172 const service_manager::Identity& identity, |
173 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) | 173 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) |
174 : identity_(identity) { | 174 : identity_(identity) { |
175 DCHECK(!instance_); | 175 DCHECK(!instance_); |
176 instance_ = this; | 176 instance_ = this; |
177 // TODO(msw): Avoid this... use some default value? Allow clients to extend? | 177 // TODO(msw): Avoid this... use some default value? Allow clients to extend? |
178 property_converter_ = base::MakeUnique<aura::PropertyConverter>(); | 178 property_converter_ = base::MakeUnique<aura::PropertyConverter>(); |
179 | 179 |
180 wm_state_ = base::MakeUnique<wm::WMState>(); | 180 wm_state_ = base::MakeUnique<wm::WMState>(); |
181 | 181 |
182 gpu_service_ = ui::GpuService::Create(connector, std::move(io_task_runner)); | 182 gpu_ = ui::Gpu::Create(connector, std::move(io_task_runner)); |
183 compositor_context_factory_ = | 183 compositor_context_factory_ = |
184 base::MakeUnique<aura::MusContextFactory>(gpu_service_.get()); | 184 base::MakeUnique<aura::MusContextFactory>(gpu_.get()); |
185 aura::Env::GetInstance()->set_context_factory( | 185 aura::Env::GetInstance()->set_context_factory( |
186 compositor_context_factory_.get()); | 186 compositor_context_factory_.get()); |
187 window_tree_client_ = | 187 window_tree_client_ = |
188 base::MakeUnique<aura::WindowTreeClient>(connector, this); | 188 base::MakeUnique<aura::WindowTreeClient>(connector, this); |
189 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); | 189 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); |
190 window_tree_client_->ConnectViaWindowTreeFactory(); | 190 window_tree_client_->ConnectViaWindowTreeFactory(); |
191 | 191 |
192 pointer_watcher_event_router_ = | 192 pointer_watcher_event_router_ = |
193 base::MakeUnique<PointerWatcherEventRouter2>(window_tree_client_.get()); | 193 base::MakeUnique<PointerWatcherEventRouter2>(window_tree_client_.get()); |
194 | 194 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 return root->GetTopWindowContainingPoint(relative_point); | 252 return root->GetTopWindowContainingPoint(relative_point); |
253 } | 253 } |
254 return nullptr; | 254 return nullptr; |
255 } | 255 } |
256 | 256 |
257 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | 257 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { |
258 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 258 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); |
259 } | 259 } |
260 | 260 |
261 } // namespace views | 261 } // namespace views |
OLD | NEW |