| 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), |
| 67 test_observer_(nullptr) { |
| 66 DCHECK(!instance_); | 68 DCHECK(!instance_); |
| 67 DCHECK(aura::Env::GetInstance()); | 69 DCHECK(aura::Env::GetInstance()); |
| 68 instance_ = this; | 70 instance_ = this; |
| 69 | 71 |
| 70 if (!io_task_runner) { | 72 if (!io_task_runner) { |
| 71 io_thread_ = base::MakeUnique<base::Thread>("IOThread"); | 73 io_thread_ = base::MakeUnique<base::Thread>("IOThread"); |
| 72 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); | 74 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); |
| 73 thread_options.priority = base::ThreadPriority::NORMAL; | 75 thread_options.priority = base::ThreadPriority::NORMAL; |
| 74 CHECK(io_thread_->StartWithOptions(thread_options)); | 76 CHECK(io_thread_->StartWithOptions(thread_options)); |
| 75 io_task_runner = io_thread_->task_runner(); | 77 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) { | 244 aura::WindowTreeHostMus* window_tree_host) { |
| 243 static_cast<DesktopWindowTreeHostMus*>(window_tree_host) | 245 static_cast<DesktopWindowTreeHostMus*>(window_tree_host) |
| 244 ->ServerDestroyedWindow(); | 246 ->ServerDestroyedWindow(); |
| 245 } | 247 } |
| 246 | 248 |
| 247 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, | 249 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, |
| 248 aura::Window* target) { | 250 aura::Window* target) { |
| 249 pointer_watcher_event_router_->OnPointerEventObserved(event, target); | 251 pointer_watcher_event_router_->OnPointerEventObserved(event, target); |
| 250 } | 252 } |
| 251 | 253 |
| 254 void MusClient::OnChangeCompleted(aura::ChangeType type, bool success) { |
| 255 if (test_observer_) |
| 256 test_observer_->OnChangeCompleted(type, success); |
| 257 } |
| 258 |
| 252 void MusClient::OnWindowManagerFrameValuesChanged() { | 259 void MusClient::OnWindowManagerFrameValuesChanged() { |
| 253 for (auto& observer : observer_list_) | 260 for (auto& observer : observer_list_) |
| 254 observer.OnWindowManagerFrameValuesChanged(); | 261 observer.OnWindowManagerFrameValuesChanged(); |
| 255 } | 262 } |
| 256 | 263 |
| 257 aura::client::CaptureClient* MusClient::GetCaptureClient() { | 264 aura::client::CaptureClient* MusClient::GetCaptureClient() { |
| 258 return wm::CaptureController::Get(); | 265 return wm::CaptureController::Get(); |
| 259 } | 266 } |
| 260 | 267 |
| 261 aura::PropertyConverter* MusClient::GetPropertyConverter() { | 268 aura::PropertyConverter* MusClient::GetPropertyConverter() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 274 return root->GetTopWindowContainingPoint(relative_point); | 281 return root->GetTopWindowContainingPoint(relative_point); |
| 275 } | 282 } |
| 276 return nullptr; | 283 return nullptr; |
| 277 } | 284 } |
| 278 | 285 |
| 279 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | 286 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { |
| 280 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 287 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); |
| 281 } | 288 } |
| 282 | 289 |
| 283 } // namespace views | 290 } // namespace views |
| OLD | NEW |