| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/window_manager_connection.h" | 5 #include "ui/views/mus/window_manager_connection.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/threading/thread_local.h" | 13 #include "base/threading/thread_local.h" |
| 14 #include "services/service_manager/public/cpp/connection.h" | 14 #include "services/service_manager/public/cpp/connection.h" |
| 15 #include "services/service_manager/public/cpp/connector.h" | 15 #include "services/service_manager/public/cpp/connector.h" |
| 16 #include "services/ui/public/cpp/gpu/gpu_service.h" | 16 #include "services/ui/public/cpp/gpu/gpu.h" |
| 17 #include "services/ui/public/cpp/property_type_converters.h" | 17 #include "services/ui/public/cpp/property_type_converters.h" |
| 18 #include "services/ui/public/cpp/window.h" | 18 #include "services/ui/public/cpp/window.h" |
| 19 #include "services/ui/public/cpp/window_property.h" | 19 #include "services/ui/public/cpp/window_property.h" |
| 20 #include "services/ui/public/cpp/window_tree_client.h" | 20 #include "services/ui/public/cpp/window_tree_client.h" |
| 21 #include "services/ui/public/interfaces/event_matcher.mojom.h" | 21 #include "services/ui/public/interfaces/event_matcher.mojom.h" |
| 22 #include "services/ui/public/interfaces/window_tree.mojom.h" | 22 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 23 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
| 24 #include "ui/aura/mus/os_exchange_data_provider_mus.h" | 24 #include "ui/aura/mus/os_exchange_data_provider_mus.h" |
| 25 #include "ui/views/mus/clipboard_mus.h" | 25 #include "ui/views/mus/clipboard_mus.h" |
| 26 #include "ui/views/mus/native_widget_mus.h" | 26 #include "ui/views/mus/native_widget_mus.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace | 84 } // namespace |
| 85 | 85 |
| 86 WindowManagerConnection::~WindowManagerConnection() { | 86 WindowManagerConnection::~WindowManagerConnection() { |
| 87 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while | 87 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while |
| 88 // we are still valid. | 88 // we are still valid. |
| 89 client_.reset(); | 89 client_.reset(); |
| 90 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); | 90 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); |
| 91 ui::Clipboard::DestroyClipboardForCurrentThread(); | 91 ui::Clipboard::DestroyClipboardForCurrentThread(); |
| 92 gpu_service_.reset(); | 92 gpu_.reset(); |
| 93 lazy_tls_ptr.Pointer()->Set(nullptr); | 93 lazy_tls_ptr.Pointer()->Set(nullptr); |
| 94 | 94 |
| 95 if (ViewsDelegate::GetInstance()) { | 95 if (ViewsDelegate::GetInstance()) { |
| 96 ViewsDelegate::GetInstance()->set_native_widget_factory( | 96 ViewsDelegate::GetInstance()->set_native_widget_factory( |
| 97 ViewsDelegate::NativeWidgetFactory()); | 97 ViewsDelegate::NativeWidgetFactory()); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 // static | 101 // static |
| 102 std::unique_ptr<WindowManagerConnection> WindowManagerConnection::Create( | 102 std::unique_ptr<WindowManagerConnection> WindowManagerConnection::Create( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return client_->GetRoots(); | 148 return client_->GetRoots(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 WindowManagerConnection::WindowManagerConnection( | 151 WindowManagerConnection::WindowManagerConnection( |
| 152 service_manager::Connector* connector, | 152 service_manager::Connector* connector, |
| 153 const service_manager::Identity& identity, | 153 const service_manager::Identity& identity, |
| 154 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 154 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 155 : connector_(connector), identity_(identity) { | 155 : connector_(connector), identity_(identity) { |
| 156 lazy_tls_ptr.Pointer()->Set(this); | 156 lazy_tls_ptr.Pointer()->Set(this); |
| 157 | 157 |
| 158 gpu_service_ = ui::GpuService::Create(connector, std::move(task_runner)); | 158 gpu_ = ui::Gpu::Create(connector, std::move(task_runner)); |
| 159 compositor_context_factory_ = | 159 compositor_context_factory_ = |
| 160 base::MakeUnique<views::SurfaceContextFactory>(gpu_service_.get()); | 160 base::MakeUnique<views::SurfaceContextFactory>(gpu_.get()); |
| 161 aura::Env::GetInstance()->set_context_factory( | 161 aura::Env::GetInstance()->set_context_factory( |
| 162 compositor_context_factory_.get()); | 162 compositor_context_factory_.get()); |
| 163 client_ = base::MakeUnique<ui::WindowTreeClient>(this, nullptr, nullptr); | 163 client_ = base::MakeUnique<ui::WindowTreeClient>(this, nullptr, nullptr); |
| 164 client_->ConnectViaWindowTreeFactory(connector_); | 164 client_->ConnectViaWindowTreeFactory(connector_); |
| 165 | 165 |
| 166 pointer_watcher_event_router_ = | 166 pointer_watcher_event_router_ = |
| 167 base::MakeUnique<PointerWatcherEventRouter>(client_.get()); | 167 base::MakeUnique<PointerWatcherEventRouter>(client_.get()); |
| 168 | 168 |
| 169 screen_ = base::MakeUnique<ScreenMus>(this); | 169 screen_ = base::MakeUnique<ScreenMus>(this); |
| 170 screen_->Init(connector); | 170 screen_->Init(connector); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 const gfx::Point& point) { | 226 const gfx::Point& point) { |
| 227 return GetAuraWindowFromUiWindow(GetUiWindowAtScreenPoint(point)); | 227 return GetAuraWindowFromUiWindow(GetUiWindowAtScreenPoint(point)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 std::unique_ptr<OSExchangeData::Provider> | 230 std::unique_ptr<OSExchangeData::Provider> |
| 231 WindowManagerConnection::BuildProvider() { | 231 WindowManagerConnection::BuildProvider() { |
| 232 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 232 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace views | 235 } // namespace views |
| OLD | NEW |