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 <set> |
7 #include <utility> | 8 #include <utility> |
8 | 9 |
9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
10 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
11 #include "base/threading/thread_local.h" | 12 #include "base/threading/thread_local.h" |
12 #include "services/shell/public/cpp/connection.h" | 13 #include "services/shell/public/cpp/connection.h" |
13 #include "services/shell/public/cpp/connector.h" | 14 #include "services/shell/public/cpp/connector.h" |
14 #include "services/ui/public/cpp/gpu_service.h" | 15 #include "services/ui/public/cpp/gpu_service.h" |
15 #include "services/ui/public/cpp/property_type_converters.h" | 16 #include "services/ui/public/cpp/property_type_converters.h" |
16 #include "services/ui/public/cpp/window.h" | 17 #include "services/ui/public/cpp/window.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 107 } |
107 | 108 |
108 WindowManagerConnection::WindowManagerConnection( | 109 WindowManagerConnection::WindowManagerConnection( |
109 shell::Connector* connector, | 110 shell::Connector* connector, |
110 const shell::Identity& identity, | 111 const shell::Identity& identity, |
111 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 112 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
112 : connector_(connector), identity_(identity) { | 113 : connector_(connector), identity_(identity) { |
113 lazy_tls_ptr.Pointer()->Set(this); | 114 lazy_tls_ptr.Pointer()->Set(this); |
114 | 115 |
115 gpu_service_ = ui::GpuService::Create(connector, std::move(task_runner)); | 116 gpu_service_ = ui::GpuService::Create(connector, std::move(task_runner)); |
116 compositor_context_factory_.reset( | 117 compositor_context_factory_ = |
117 new views::SurfaceContextFactory(gpu_service_.get())); | 118 base::MakeUnique<views::SurfaceContextFactory>(gpu_service_.get()); |
118 aura::Env::GetInstance()->set_context_factory( | 119 aura::Env::GetInstance()->set_context_factory( |
119 compositor_context_factory_.get()); | 120 compositor_context_factory_.get()); |
120 client_.reset(new ui::WindowTreeClient(this, nullptr, nullptr)); | 121 client_ = base::MakeUnique<ui::WindowTreeClient>(this, nullptr, nullptr); |
121 client_->ConnectViaWindowTreeFactory(connector_); | 122 client_->ConnectViaWindowTreeFactory(connector_); |
122 | 123 |
123 pointer_watcher_event_router_.reset( | 124 pointer_watcher_event_router_ = |
124 new PointerWatcherEventRouter(client_.get())); | 125 base::MakeUnique<PointerWatcherEventRouter>(client_.get()); |
125 | 126 |
126 screen_.reset(new ScreenMus(this)); | 127 screen_ = base::MakeUnique<ScreenMus>(this); |
127 screen_->Init(connector); | 128 screen_->Init(connector); |
128 | 129 |
129 std::unique_ptr<ClipboardMus> clipboard(new ClipboardMus); | 130 std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); |
130 clipboard->Init(connector); | 131 clipboard->Init(connector); |
131 ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard)); | 132 ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard)); |
132 | 133 |
133 ui::OSExchangeDataProviderFactory::SetFactory(this); | 134 ui::OSExchangeDataProviderFactory::SetFactory(this); |
134 | 135 |
135 ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind( | 136 ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind( |
136 &WindowManagerConnection::CreateNativeWidgetMus, | 137 &WindowManagerConnection::CreateNativeWidgetMus, |
137 base::Unretained(this), | 138 base::Unretained(this), |
138 std::map<std::string, std::vector<uint8_t>>())); | 139 std::map<std::string, std::vector<uint8_t>>())); |
139 } | 140 } |
(...skipping 25 matching lines...) Expand all Loading... |
165 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { | 166 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { |
166 return client_->GetCursorScreenPoint(); | 167 return client_->GetCursorScreenPoint(); |
167 } | 168 } |
168 | 169 |
169 std::unique_ptr<OSExchangeData::Provider> | 170 std::unique_ptr<OSExchangeData::Provider> |
170 WindowManagerConnection::BuildProvider() { | 171 WindowManagerConnection::BuildProvider() { |
171 return base::MakeUnique<OSExchangeDataProviderMus>(); | 172 return base::MakeUnique<OSExchangeDataProviderMus>(); |
172 } | 173 } |
173 | 174 |
174 } // namespace views | 175 } // namespace views |
OLD | NEW |