Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: ui/views/mus/mus_client.cc

Issue 2488353005: Implement aura::PropertyConverter for mus interop. (Closed)
Patch Set: Remove key name comparison. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/aura/window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 10 matching lines...) Expand all
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/screen_mus.h" 24 #include "ui/views/mus/screen_mus.h"
25 #include "ui/views/views_delegate.h" 25 #include "ui/views/views_delegate.h"
26 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 26 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
27 #include "ui/wm/core/capture_controller.h" 27 #include "ui/wm/core/capture_controller.h"
28 #include "ui/wm/core/wm_state.h" 28 #include "ui/wm/core/wm_state.h"
29 29
30 namespace views { 30 namespace views {
31 namespace {
32
33 // TODO: property converter should likely live in aura as it needs to be used
34 // by both ash and views. http://crbug.com/663522.
35 class PropertyConverterImpl : public aura::PropertyConverter {
36 public:
37 PropertyConverterImpl() {}
38 ~PropertyConverterImpl() override {}
39
40 // aura::PropertyConverter:
41 bool ConvertPropertyForTransport(
42 aura::Window* window,
43 const void* key,
44 std::string* transport_name,
45 std::unique_ptr<std::vector<uint8_t>>* transport_value) override {
46 return false;
47 }
48 std::string GetTransportNameForPropertyKey(const void* key) override {
49 return std::string();
50 }
51 void SetPropertyFromTransportValue(
52 aura::Window* window,
53 const std::string& transport_name,
54 const std::vector<uint8_t>* transport_data) override {}
55
56 private:
57 DISALLOW_COPY_AND_ASSIGN(PropertyConverterImpl);
58 };
59
60 } // namespace
61 31
62 // static 32 // static
63 MusClient* MusClient::instance_ = nullptr; 33 MusClient* MusClient::instance_ = nullptr;
64 34
65 MusClient::~MusClient() { 35 MusClient::~MusClient() {
66 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while 36 // ~WindowTreeClient calls back to us (we're its delegate), destroy it while
67 // we are still valid. 37 // we are still valid.
68 window_tree_client_.reset(); 38 window_tree_client_.reset();
69 ui::OSExchangeDataProviderFactory::SetFactory(nullptr); 39 ui::OSExchangeDataProviderFactory::SetFactory(nullptr);
70 ui::Clipboard::DestroyClipboardForCurrentThread(); 40 ui::Clipboard::DestroyClipboardForCurrentThread();
(...skipping 28 matching lines...) Expand all
99 } 69 }
100 return native_widget; 70 return native_widget;
101 } 71 }
102 72
103 MusClient::MusClient(service_manager::Connector* connector, 73 MusClient::MusClient(service_manager::Connector* connector,
104 const service_manager::Identity& identity, 74 const service_manager::Identity& identity,
105 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) 75 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
106 : connector_(connector), identity_(identity) { 76 : connector_(connector), identity_(identity) {
107 DCHECK(!instance_); 77 DCHECK(!instance_);
108 instance_ = this; 78 instance_ = this;
109 property_converter_ = base::MakeUnique<PropertyConverterImpl>(); 79 // TODO(msw): Avoid this... use some default value? Allow clients to extend?
80 property_converter_ = base::MakeUnique<aura::PropertyConverter>();
110 81
111 wm_state_ = base::MakeUnique<wm::WMState>(); 82 wm_state_ = base::MakeUnique<wm::WMState>();
112 83
113 gpu_service_ = aura::GpuService::Create(connector, std::move(io_task_runner)); 84 gpu_service_ = aura::GpuService::Create(connector, std::move(io_task_runner));
114 compositor_context_factory_ = 85 compositor_context_factory_ =
115 base::MakeUnique<aura::MusContextFactory>(gpu_service_.get()); 86 base::MakeUnique<aura::MusContextFactory>(gpu_service_.get());
116 aura::Env::GetInstance()->set_context_factory( 87 aura::Env::GetInstance()->set_context_factory(
117 compositor_context_factory_.get()); 88 compositor_context_factory_.get());
118 window_tree_client_ = 89 window_tree_client_ =
119 base::MakeUnique<aura::WindowTreeClient>(this, nullptr, nullptr); 90 base::MakeUnique<aura::WindowTreeClient>(this, nullptr, nullptr);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 return root->GetTopWindowContainingPoint(relative_point); 153 return root->GetTopWindowContainingPoint(relative_point);
183 } 154 }
184 return nullptr; 155 return nullptr;
185 } 156 }
186 157
187 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { 158 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() {
188 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); 159 return base::MakeUnique<aura::OSExchangeDataProviderMus>();
189 } 160 }
190 161
191 } // namespace views 162 } // namespace views
OLDNEW
« no previous file with comments | « ui/aura/window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698