| 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/capture_synchronizer.h" | 19 #include "ui/aura/mus/capture_synchronizer.h" |
| 20 #include "ui/aura/mus/mus_context_factory.h" | 20 #include "ui/aura/mus/mus_context_factory.h" |
| 21 #include "ui/aura/mus/os_exchange_data_provider_mus.h" | |
| 22 #include "ui/aura/mus/property_converter.h" | 21 #include "ui/aura/mus/property_converter.h" |
| 23 #include "ui/aura/mus/window_tree_client.h" | 22 #include "ui/aura/mus/window_tree_client.h" |
| 24 #include "ui/aura/mus/window_tree_host_mus.h" | 23 #include "ui/aura/mus/window_tree_host_mus.h" |
| 25 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 26 #include "ui/aura/window_tree_host.h" | 25 #include "ui/aura/window_tree_host.h" |
| 27 #include "ui/views/mus/aura_init.h" | 26 #include "ui/views/mus/aura_init.h" |
| 28 #include "ui/views/mus/clipboard_mus.h" | 27 #include "ui/views/mus/clipboard_mus.h" |
| 29 #include "ui/views/mus/desktop_window_tree_host_mus.h" | 28 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
| 30 #include "ui/views/mus/mus_property_mirror.h" | 29 #include "ui/views/mus/mus_property_mirror.h" |
| 31 #include "ui/views/mus/pointer_watcher_event_router.h" | 30 #include "ui/views/mus/pointer_watcher_event_router.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 pointer_watcher_event_router_ = | 104 pointer_watcher_event_router_ = |
| 106 base::MakeUnique<PointerWatcherEventRouter>(window_tree_client_.get()); | 105 base::MakeUnique<PointerWatcherEventRouter>(window_tree_client_.get()); |
| 107 | 106 |
| 108 screen_ = base::MakeUnique<ScreenMus>(this); | 107 screen_ = base::MakeUnique<ScreenMus>(this); |
| 109 screen_->Init(connector); | 108 screen_->Init(connector); |
| 110 | 109 |
| 111 std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); | 110 std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); |
| 112 clipboard->Init(connector); | 111 clipboard->Init(connector); |
| 113 ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard)); | 112 ui::Clipboard::SetClipboardForCurrentThread(std::move(clipboard)); |
| 114 | 113 |
| 115 ui::OSExchangeDataProviderFactory::SetFactory(this); | |
| 116 | |
| 117 ViewsDelegate::GetInstance()->set_native_widget_factory( | 114 ViewsDelegate::GetInstance()->set_native_widget_factory( |
| 118 base::Bind(&MusClient::CreateNativeWidget, base::Unretained(this))); | 115 base::Bind(&MusClient::CreateNativeWidget, base::Unretained(this))); |
| 119 } | 116 } |
| 120 | 117 |
| 121 MusClient::~MusClient() { | 118 MusClient::~MusClient() { |
| 122 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while | 119 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while |
| 123 // we are still valid. | 120 // we are still valid. |
| 124 window_tree_client_.reset(); | 121 window_tree_client_.reset(); |
| 125 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); | 122 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); |
| 126 ui::Clipboard::DestroyClipboardForCurrentThread(); | 123 ui::Clipboard::DestroyClipboardForCurrentThread(); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 continue; | 287 continue; |
| 291 // TODO: this likely gets z-order wrong. http://crbug.com/663606. | 288 // TODO: this likely gets z-order wrong. http://crbug.com/663606. |
| 292 gfx::Point relative_point(point); | 289 gfx::Point relative_point(point); |
| 293 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point); | 290 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point); |
| 294 if (gfx::Rect(root->bounds().size()).Contains(relative_point)) | 291 if (gfx::Rect(root->bounds().size()).Contains(relative_point)) |
| 295 return root->GetTopWindowContainingPoint(relative_point); | 292 return root->GetTopWindowContainingPoint(relative_point); |
| 296 } | 293 } |
| 297 return nullptr; | 294 return nullptr; |
| 298 } | 295 } |
| 299 | 296 |
| 300 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | |
| 301 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | |
| 302 } | |
| 303 | |
| 304 } // namespace views | 297 } // namespace views |
| OLD | NEW |