| 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 "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "components/discardable_memory/client/client_discardable_shared_memory_
manager.h" | 10 #include "components/discardable_memory/client/client_discardable_shared_memory_
manager.h" |
| 11 #include "services/service_manager/public/cpp/connection.h" | 11 #include "services/service_manager/public/cpp/connection.h" |
| 12 #include "services/service_manager/public/cpp/connector.h" | 12 #include "services/service_manager/public/cpp/connector.h" |
| 13 #include "services/ui/public/cpp/gpu/gpu.h" | 13 #include "services/ui/public/cpp/gpu/gpu.h" |
| 14 #include "services/ui/public/cpp/property_type_converters.h" | 14 #include "services/ui/public/cpp/property_type_converters.h" |
| 15 #include "services/ui/public/interfaces/constants.mojom.h" | 15 #include "services/ui/public/interfaces/constants.mojom.h" |
| 16 #include "services/ui/public/interfaces/event_matcher.mojom.h" | 16 #include "services/ui/public/interfaces/event_matcher.mojom.h" |
| 17 #include "services/ui/public/interfaces/window_manager.mojom.h" | 17 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 18 #include "ui/aura/env.h" | 18 #include "ui/aura/env.h" |
| 19 #include "ui/aura/mus/mus_context_factory.h" | 19 #include "ui/aura/mus/mus_context_factory.h" |
| 20 #include "ui/aura/mus/os_exchange_data_provider_mus.h" | 20 #include "ui/aura/mus/os_exchange_data_provider_mus.h" |
| 21 #include "ui/aura/mus/property_converter.h" | 21 #include "ui/aura/mus/property_converter.h" |
| 22 #include "ui/aura/mus/window_tree_client.h" | 22 #include "ui/aura/mus/window_tree_client.h" |
| 23 #include "ui/aura/mus/window_tree_host_mus.h" | 23 #include "ui/aura/mus/window_tree_host_mus.h" |
| 24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_tree_host.h" | 25 #include "ui/aura/window_tree_host.h" |
| 26 #include "ui/views/mus/aura_init.h" | 26 #include "ui/views/mus/aura_init.h" |
| 27 #include "ui/views/mus/clipboard_mus.h" | 27 #include "ui/views/mus/clipboard_mus.h" |
| 28 #include "ui/views/mus/desktop_window_tree_host_mus.h" | 28 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
| 29 #include "ui/views/mus/mus_client_test_observer.h" |
| 29 #include "ui/views/mus/pointer_watcher_event_router.h" | 30 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 30 #include "ui/views/mus/screen_mus.h" | 31 #include "ui/views/mus/screen_mus.h" |
| 31 #include "ui/views/views_delegate.h" | 32 #include "ui/views/views_delegate.h" |
| 32 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 33 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 33 #include "ui/views/widget/widget_delegate.h" | 34 #include "ui/views/widget/widget_delegate.h" |
| 34 #include "ui/wm/core/capture_controller.h" | 35 #include "ui/wm/core/capture_controller.h" |
| 35 #include "ui/wm/core/wm_state.h" | 36 #include "ui/wm/core/wm_state.h" |
| 36 | 37 |
| 37 // Widget::InitParams::Type must match that of ui::mojom::WindowType. | 38 // Widget::InitParams::Type must match that of ui::mojom::WindowType. |
| 38 #define WINDOW_TYPES_MATCH(NAME) \ | 39 #define WINDOW_TYPES_MATCH(NAME) \ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 55 | 56 |
| 56 namespace views { | 57 namespace views { |
| 57 | 58 |
| 58 // static | 59 // static |
| 59 MusClient* MusClient::instance_ = nullptr; | 60 MusClient* MusClient::instance_ = nullptr; |
| 60 | 61 |
| 61 MusClient::MusClient(service_manager::Connector* connector, | 62 MusClient::MusClient(service_manager::Connector* connector, |
| 62 const service_manager::Identity& identity, | 63 const service_manager::Identity& identity, |
| 63 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 64 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 64 bool create_wm_state) | 65 bool create_wm_state) |
| 65 : identity_(identity) { | 66 : identity_(identity), test_observer_(nullptr) { |
| 66 DCHECK(!instance_); | 67 DCHECK(!instance_); |
| 67 DCHECK(aura::Env::GetInstance()); | 68 DCHECK(aura::Env::GetInstance()); |
| 68 instance_ = this; | 69 instance_ = this; |
| 69 | 70 |
| 70 if (!io_task_runner) { | 71 if (!io_task_runner) { |
| 71 io_thread_ = base::MakeUnique<base::Thread>("IOThread"); | 72 io_thread_ = base::MakeUnique<base::Thread>("IOThread"); |
| 72 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); | 73 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); |
| 73 thread_options.priority = base::ThreadPriority::NORMAL; | 74 thread_options.priority = base::ThreadPriority::NORMAL; |
| 74 CHECK(io_thread_->StartWithOptions(thread_options)); | 75 CHECK(io_thread_->StartWithOptions(thread_options)); |
| 75 io_task_runner = io_thread_->task_runner(); | 76 io_task_runner = io_thread_->task_runner(); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 aura::WindowTreeHostMus* window_tree_host) { | 243 aura::WindowTreeHostMus* window_tree_host) { |
| 243 static_cast<DesktopWindowTreeHostMus*>(window_tree_host) | 244 static_cast<DesktopWindowTreeHostMus*>(window_tree_host) |
| 244 ->ServerDestroyedWindow(); | 245 ->ServerDestroyedWindow(); |
| 245 } | 246 } |
| 246 | 247 |
| 247 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, | 248 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, |
| 248 aura::Window* target) { | 249 aura::Window* target) { |
| 249 pointer_watcher_event_router_->OnPointerEventObserved(event, target); | 250 pointer_watcher_event_router_->OnPointerEventObserved(event, target); |
| 250 } | 251 } |
| 251 | 252 |
| 253 void MusClient::OnChangeCompleted(aura::ChangeType type, bool success) { |
| 254 if (test_observer_) |
| 255 test_observer_->OnChangeCompleted(type, success); |
| 256 } |
| 257 |
| 252 void MusClient::OnWindowManagerFrameValuesChanged() { | 258 void MusClient::OnWindowManagerFrameValuesChanged() { |
| 253 for (auto& observer : observer_list_) | 259 for (auto& observer : observer_list_) |
| 254 observer.OnWindowManagerFrameValuesChanged(); | 260 observer.OnWindowManagerFrameValuesChanged(); |
| 255 } | 261 } |
| 256 | 262 |
| 257 aura::client::CaptureClient* MusClient::GetCaptureClient() { | 263 aura::client::CaptureClient* MusClient::GetCaptureClient() { |
| 258 return wm::CaptureController::Get(); | 264 return wm::CaptureController::Get(); |
| 259 } | 265 } |
| 260 | 266 |
| 261 aura::PropertyConverter* MusClient::GetPropertyConverter() { | 267 aura::PropertyConverter* MusClient::GetPropertyConverter() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 274 return root->GetTopWindowContainingPoint(relative_point); | 280 return root->GetTopWindowContainingPoint(relative_point); |
| 275 } | 281 } |
| 276 return nullptr; | 282 return nullptr; |
| 277 } | 283 } |
| 278 | 284 |
| 279 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | 285 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { |
| 280 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 286 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); |
| 281 } | 287 } |
| 282 | 288 |
| 283 } // namespace views | 289 } // namespace views |
| OLD | NEW |