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

Side by Side Diff: ui/views/mus/window_manager_connection.cc

Issue 2047703003: Revert of Implement ui::ClipboardMus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/views/mus/window_manager_connection.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
11 #include "components/mus/public/cpp/property_type_converters.h" 11 #include "components/mus/public/cpp/property_type_converters.h"
12 #include "components/mus/public/cpp/window.h" 12 #include "components/mus/public/cpp/window.h"
13 #include "components/mus/public/cpp/window_property.h" 13 #include "components/mus/public/cpp/window_property.h"
14 #include "components/mus/public/cpp/window_tree_client.h" 14 #include "components/mus/public/cpp/window_tree_client.h"
15 #include "components/mus/public/interfaces/event_matcher.mojom.h" 15 #include "components/mus/public/interfaces/event_matcher.mojom.h"
16 #include "components/mus/public/interfaces/window_tree.mojom.h" 16 #include "components/mus/public/interfaces/window_tree.mojom.h"
17 #include "services/shell/public/cpp/connection.h" 17 #include "services/shell/public/cpp/connection.h"
18 #include "services/shell/public/cpp/connector.h" 18 #include "services/shell/public/cpp/connector.h"
19 #include "ui/events/devices/device_data_manager.h" 19 #include "ui/events/devices/device_data_manager.h"
20 #include "ui/views/mus/clipboard_mus.h"
21 #include "ui/views/mus/native_widget_mus.h" 20 #include "ui/views/mus/native_widget_mus.h"
22 #include "ui/views/mus/screen_mus.h" 21 #include "ui/views/mus/screen_mus.h"
23 #include "ui/views/pointer_watcher.h" 22 #include "ui/views/pointer_watcher.h"
24 #include "ui/views/views_delegate.h" 23 #include "ui/views/views_delegate.h"
25 24
26 namespace views { 25 namespace views {
27 namespace { 26 namespace {
28 27
29 using WindowManagerConnectionPtr = 28 using WindowManagerConnectionPtr =
30 base::ThreadLocalPointer<views::WindowManagerConnection>; 29 base::ThreadLocalPointer<views::WindowManagerConnection>;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 const shell::Identity& identity) 107 const shell::Identity& identity)
109 : connector_(connector), 108 : connector_(connector),
110 identity_(identity), 109 identity_(identity),
111 created_device_data_manager_(false) { 110 created_device_data_manager_(false) {
112 client_.reset(new mus::WindowTreeClient(this, nullptr, nullptr)); 111 client_.reset(new mus::WindowTreeClient(this, nullptr, nullptr));
113 client_->ConnectViaWindowTreeFactory(connector_); 112 client_->ConnectViaWindowTreeFactory(connector_);
114 113
115 screen_.reset(new ScreenMus(this)); 114 screen_.reset(new ScreenMus(this));
116 screen_->Init(connector); 115 screen_->Init(connector);
117 116
118 std::unique_ptr<ClipboardMus> clipboard(new ClipboardMus);
119 clipboard->Init(connector);
120 ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard));
121
122 if (!ui::DeviceDataManager::HasInstance()) { 117 if (!ui::DeviceDataManager::HasInstance()) {
123 // TODO(sad): We should have a DeviceDataManager implementation that talks 118 // TODO(sad): We should have a DeviceDataManager implementation that talks
124 // to a mojo service to learn about the input-devices on the system. 119 // to a mojo service to learn about the input-devices on the system.
125 // http://crbug.com/601981 120 // http://crbug.com/601981
126 ui::DeviceDataManager::CreateInstance(); 121 ui::DeviceDataManager::CreateInstance();
127 created_device_data_manager_ = true; 122 created_device_data_manager_ = true;
128 } 123 }
129 124
130 ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind( 125 ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind(
131 &WindowManagerConnection::CreateNativeWidgetMus, 126 &WindowManagerConnection::CreateNativeWidgetMus,
132 base::Unretained(this), 127 base::Unretained(this),
133 std::map<std::string, std::vector<uint8_t>>())); 128 std::map<std::string, std::vector<uint8_t>>()));
134 } 129 }
135 130
136 WindowManagerConnection::~WindowManagerConnection() { 131 WindowManagerConnection::~WindowManagerConnection() {
137 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while 132 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while
138 // we are still valid. 133 // we are still valid.
139 client_.reset(); 134 client_.reset();
140 ui::Clipboard::DestroyClipboardForCurrentThread();
141 if (created_device_data_manager_) 135 if (created_device_data_manager_)
142 ui::DeviceDataManager::DeleteInstance(); 136 ui::DeviceDataManager::DeleteInstance();
143 137
144 if (ViewsDelegate::GetInstance()) { 138 if (ViewsDelegate::GetInstance()) {
145 ViewsDelegate::GetInstance()->set_native_widget_factory( 139 ViewsDelegate::GetInstance()->set_native_widget_factory(
146 ViewsDelegate::NativeWidgetFactory()); 140 ViewsDelegate::NativeWidgetFactory());
147 } 141 }
148 } 142 }
149 143
150 bool WindowManagerConnection::HasPointerWatcher() { 144 bool WindowManagerConnection::HasPointerWatcher() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() { 182 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() {
189 if (client_) 183 if (client_)
190 NativeWidgetMus::NotifyFrameChanged(client_.get()); 184 NativeWidgetMus::NotifyFrameChanged(client_.get());
191 } 185 }
192 186
193 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { 187 gfx::Point WindowManagerConnection::GetCursorScreenPoint() {
194 return client_->GetCursorScreenPoint(); 188 return client_->GetCursorScreenPoint();
195 } 189 }
196 190
197 } // namespace views 191 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/window_manager_connection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698