| 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 "services/service_manager/public/cpp/connection.h" | 9 #include "services/service_manager/public/cpp/connection.h" | 
| 10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" | 
| 11 #include "services/ui/public/cpp/gpu/gpu_service.h" | 11 #include "services/ui/public/cpp/gpu/gpu_service.h" | 
| 12 #include "services/ui/public/interfaces/event_matcher.mojom.h" | 12 #include "services/ui/public/interfaces/event_matcher.mojom.h" | 
| 13 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" | 
| 14 #include "ui/aura/mus/mus_context_factory.h" | 14 #include "ui/aura/mus/mus_context_factory.h" | 
| 15 #include "ui/aura/mus/os_exchange_data_provider_mus.h" | 15 #include "ui/aura/mus/os_exchange_data_provider_mus.h" | 
| 16 #include "ui/aura/mus/property_converter.h" | 16 #include "ui/aura/mus/property_converter.h" | 
| 17 #include "ui/aura/mus/window_tree_client.h" | 17 #include "ui/aura/mus/window_tree_client.h" | 
| 18 #include "ui/aura/mus/window_tree_host_mus.h" | 18 #include "ui/aura/mus/window_tree_host_mus.h" | 
| 19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" | 
| 20 #include "ui/aura/window_tree_host.h" | 20 #include "ui/aura/window_tree_host.h" | 
| 21 #include "ui/views/mus/aura_init.h" | 21 #include "ui/views/mus/aura_init.h" | 
| 22 #include "ui/views/mus/clipboard_mus.h" | 22 #include "ui/views/mus/clipboard_mus.h" | 
| 23 #include "ui/views/mus/desktop_window_tree_host_mus.h" | 23 #include "ui/views/mus/desktop_window_tree_host_mus.h" | 
|  | 24 #include "ui/views/mus/pointer_watcher_event_router2.h" | 
| 24 #include "ui/views/mus/screen_mus.h" | 25 #include "ui/views/mus/screen_mus.h" | 
| 25 #include "ui/views/views_delegate.h" | 26 #include "ui/views/views_delegate.h" | 
| 26 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 27 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 
| 27 #include "ui/wm/core/capture_controller.h" | 28 #include "ui/wm/core/capture_controller.h" | 
| 28 #include "ui/wm/core/wm_state.h" | 29 #include "ui/wm/core/wm_state.h" | 
| 29 | 30 | 
| 30 namespace views { | 31 namespace views { | 
| 31 | 32 | 
| 32 // static | 33 // static | 
| 33 MusClient* MusClient::instance_ = nullptr; | 34 MusClient* MusClient::instance_ = nullptr; | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 92   gpu_service_ = ui::GpuService::Create(connector, std::move(io_task_runner)); | 93   gpu_service_ = ui::GpuService::Create(connector, std::move(io_task_runner)); | 
| 93   compositor_context_factory_ = | 94   compositor_context_factory_ = | 
| 94       base::MakeUnique<aura::MusContextFactory>(gpu_service_.get()); | 95       base::MakeUnique<aura::MusContextFactory>(gpu_service_.get()); | 
| 95   aura::Env::GetInstance()->set_context_factory( | 96   aura::Env::GetInstance()->set_context_factory( | 
| 96       compositor_context_factory_.get()); | 97       compositor_context_factory_.get()); | 
| 97   window_tree_client_ = | 98   window_tree_client_ = | 
| 98       base::MakeUnique<aura::WindowTreeClient>(this, nullptr, nullptr); | 99       base::MakeUnique<aura::WindowTreeClient>(this, nullptr, nullptr); | 
| 99   aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); | 100   aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); | 
| 100   window_tree_client_->ConnectViaWindowTreeFactory(connector_); | 101   window_tree_client_->ConnectViaWindowTreeFactory(connector_); | 
| 101 | 102 | 
| 102   // TODO: wire up PointerWatcherEventRouter. http://crbug.com/663526. | 103   pointer_watcher_event_router_ = | 
|  | 104       base::MakeUnique<PointerWatcherEventRouter2>(window_tree_client_.get()); | 
| 103 | 105 | 
| 104   screen_ = base::MakeUnique<ScreenMus>(this); | 106   screen_ = base::MakeUnique<ScreenMus>(this); | 
| 105   screen_->Init(connector); | 107   screen_->Init(connector); | 
| 106 | 108 | 
| 107   std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); | 109   std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); | 
| 108   clipboard->Init(connector); | 110   clipboard->Init(connector); | 
| 109   ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard)); | 111   ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard)); | 
| 110 | 112 | 
| 111   ui::OSExchangeDataProviderFactory::SetFactory(this); | 113   ui::OSExchangeDataProviderFactory::SetFactory(this); | 
| 112 | 114 | 
| 113   ViewsDelegate::GetInstance()->set_native_widget_factory( | 115   ViewsDelegate::GetInstance()->set_native_widget_factory( | 
| 114       base::Bind(&MusClient::CreateNativeWidget, base::Unretained(this))); | 116       base::Bind(&MusClient::CreateNativeWidget, base::Unretained(this))); | 
| 115 } | 117 } | 
| 116 | 118 | 
| 117 void MusClient::OnEmbed( | 119 void MusClient::OnEmbed( | 
| 118     std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 120     std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) { | 
| 119   NOTREACHED(); | 121   NOTREACHED(); | 
| 120 } | 122 } | 
| 121 | 123 | 
| 122 void MusClient::OnLostConnection(aura::WindowTreeClient* client) {} | 124 void MusClient::OnLostConnection(aura::WindowTreeClient* client) {} | 
| 123 | 125 | 
| 124 void MusClient::OnEmbedRootDestroyed(aura::Window* root) { | 126 void MusClient::OnEmbedRootDestroyed(aura::Window* root) { | 
| 125   // Not called for MusClient as WindowTreeClient isn't created by | 127   // Not called for MusClient as WindowTreeClient isn't created by | 
| 126   // way of an Embed(). | 128   // way of an Embed(). | 
| 127   NOTREACHED(); | 129   NOTREACHED(); | 
| 128 } | 130 } | 
| 129 | 131 | 
| 130 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, | 132 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, | 
| 131                                        aura::Window* target) { | 133                                        aura::Window* target) { | 
| 132   // TODO: wire up PointerWatcherEventRouter. http://crbug.com/663526. | 134   pointer_watcher_event_router_->OnPointerEventObserved(event, target); | 
| 133   NOTIMPLEMENTED(); |  | 
| 134 } | 135 } | 
| 135 | 136 | 
| 136 void MusClient::OnWindowManagerFrameValuesChanged() { | 137 void MusClient::OnWindowManagerFrameValuesChanged() { | 
| 137   // TODO: wire up client area. http://crbug.com/663525. | 138   // TODO: wire up client area. http://crbug.com/663525. | 
| 138   NOTIMPLEMENTED(); | 139   NOTIMPLEMENTED(); | 
| 139 } | 140 } | 
| 140 | 141 | 
| 141 aura::client::CaptureClient* MusClient::GetCaptureClient() { | 142 aura::client::CaptureClient* MusClient::GetCaptureClient() { | 
| 142   return wm::CaptureController::Get(); | 143   return wm::CaptureController::Get(); | 
| 143 } | 144 } | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 162       return root->GetTopWindowContainingPoint(relative_point); | 163       return root->GetTopWindowContainingPoint(relative_point); | 
| 163   } | 164   } | 
| 164   return nullptr; | 165   return nullptr; | 
| 165 } | 166 } | 
| 166 | 167 | 
| 167 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | 168 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | 
| 168   return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 169   return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 
| 169 } | 170 } | 
| 170 | 171 | 
| 171 }  // namespace views | 172 }  // namespace views | 
| OLD | NEW | 
|---|