| 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 <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" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const shell::Identity& identity) | 107 const shell::Identity& identity) |
| 108 : connector_(connector), | 108 : connector_(connector), |
| 109 identity_(identity), | 109 identity_(identity), |
| 110 created_device_data_manager_(false) { | 110 created_device_data_manager_(false) { |
| 111 client_.reset(new mus::WindowTreeClient(this, nullptr, nullptr)); | 111 client_.reset(new mus::WindowTreeClient(this, nullptr, nullptr)); |
| 112 client_->ConnectViaWindowTreeFactory(connector_); | 112 client_->ConnectViaWindowTreeFactory(connector_); |
| 113 | 113 |
| 114 screen_.reset(new ScreenMus(this)); | 114 screen_.reset(new ScreenMus(this)); |
| 115 screen_->Init(connector); | 115 screen_->Init(connector); |
| 116 | 116 |
| 117 if (!ui::DeviceDataManager::HasInstance()) { | 117 // Receives updates about input-devices from other another process. |
| 118 // TODO(sad): We should have a DeviceDataManager implementation that talks | 118 input_device_client_.Connect(connector_); |
| 119 // to a mojo service to learn about the input-devices on the system. | |
| 120 // http://crbug.com/601981 | |
| 121 ui::DeviceDataManager::CreateInstance(); | |
| 122 created_device_data_manager_ = true; | |
| 123 } | |
| 124 | 119 |
| 125 ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind( | 120 ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind( |
| 126 &WindowManagerConnection::CreateNativeWidgetMus, | 121 &WindowManagerConnection::CreateNativeWidgetMus, |
| 127 base::Unretained(this), | 122 base::Unretained(this), |
| 128 std::map<std::string, std::vector<uint8_t>>())); | 123 std::map<std::string, std::vector<uint8_t>>())); |
| 129 } | 124 } |
| 130 | 125 |
| 131 WindowManagerConnection::~WindowManagerConnection() { | 126 WindowManagerConnection::~WindowManagerConnection() { |
| 132 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while | 127 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while |
| 133 // we are still valid. | 128 // we are still valid. |
| 134 client_.reset(); | 129 client_.reset(); |
| 135 if (created_device_data_manager_) | |
| 136 ui::DeviceDataManager::DeleteInstance(); | |
| 137 | 130 |
| 138 if (ViewsDelegate::GetInstance()) { | 131 if (ViewsDelegate::GetInstance()) { |
| 139 ViewsDelegate::GetInstance()->set_native_widget_factory( | 132 ViewsDelegate::GetInstance()->set_native_widget_factory( |
| 140 ViewsDelegate::NativeWidgetFactory()); | 133 ViewsDelegate::NativeWidgetFactory()); |
| 141 } | 134 } |
| 142 } | 135 } |
| 143 | 136 |
| 144 bool WindowManagerConnection::HasPointerWatcher() { | 137 bool WindowManagerConnection::HasPointerWatcher() { |
| 145 // Check to see if we really have any observers left. This doesn't use | 138 // Check to see if we really have any observers left. This doesn't use |
| 146 // base::ObserverList<>::might_have_observers() because that returns true | 139 // base::ObserverList<>::might_have_observers() because that returns true |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() { | 175 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() { |
| 183 if (client_) | 176 if (client_) |
| 184 NativeWidgetMus::NotifyFrameChanged(client_.get()); | 177 NativeWidgetMus::NotifyFrameChanged(client_.get()); |
| 185 } | 178 } |
| 186 | 179 |
| 187 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { | 180 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { |
| 188 return client_->GetCursorScreenPoint(); | 181 return client_->GetCursorScreenPoint(); |
| 189 } | 182 } |
| 190 | 183 |
| 191 } // namespace views | 184 } // namespace views |
| OLD | NEW |