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

Side by Side Diff: components/mus/public/cpp/lib/view_tree_client_impl.cc

Issue 1340983002: Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/mus/public/cpp/lib/view_tree_client_impl.h" 5 #include "components/mus/public/cpp/lib/view_tree_client_impl.h"
6 6
7 #include "components/mus/public/cpp/lib/view_private.h" 7 #include "components/mus/public/cpp/lib/view_private.h"
8 #include "components/mus/public/cpp/util.h" 8 #include "components/mus/public/cpp/util.h"
9 #include "components/mus/public/cpp/view_observer.h" 9 #include "components/mus/public/cpp/view_observer.h"
10 #include "components/mus/public/cpp/view_tree_connection.h" 10 #include "components/mus/public/cpp/view_tree_connection.h"
11 #include "components/mus/public/cpp/view_tree_delegate.h" 11 #include "components/mus/public/cpp/view_tree_delegate.h"
12 #include "mojo/application/public/cpp/application_impl.h" 12 #include "mojo/application/public/cpp/application_impl.h"
13 #include "mojo/application/public/cpp/connect.h" 13 #include "mojo/application/public/cpp/connect.h"
14 #include "mojo/application/public/cpp/service_provider_impl.h" 14 #include "mojo/application/public/cpp/service_provider_impl.h"
15 #include "mojo/application/public/interfaces/service_provider.mojom.h" 15 #include "mojo/application/public/interfaces/service_provider.mojom.h"
16 16
17 namespace mojo { 17 namespace mus {
18 18
19 Id MakeTransportId(ConnectionSpecificId connection_id, 19 Id MakeTransportId(ConnectionSpecificId connection_id,
20 ConnectionSpecificId local_id) { 20 ConnectionSpecificId local_id) {
21 return (connection_id << 16) | local_id; 21 return (connection_id << 16) | local_id;
22 } 22 }
23 23
24 // Helper called to construct a local view object from transport data. 24 // Helper called to construct a local view object from transport data.
25 View* AddViewToConnection(ViewTreeClientImpl* client, 25 View* AddViewToConnection(ViewTreeClientImpl* client,
26 View* parent, 26 View* parent,
27 const ViewDataPtr& view_data) { 27 const mojo::ViewDataPtr& view_data) {
28 // We don't use the cto that takes a ViewTreeConnection here, since it will 28 // We don't use the cto that takes a ViewTreeConnection here, since it will
29 // call back to the service and attempt to create a new view. 29 // call back to the service and attempt to create a new view.
30 View* view = ViewPrivate::LocalCreate(); 30 View* view = ViewPrivate::LocalCreate();
31 ViewPrivate private_view(view); 31 ViewPrivate private_view(view);
32 private_view.set_connection(client); 32 private_view.set_connection(client);
33 private_view.set_id(view_data->view_id); 33 private_view.set_id(view_data->view_id);
34 private_view.set_visible(view_data->visible); 34 private_view.set_visible(view_data->visible);
35 private_view.set_drawn(view_data->drawn); 35 private_view.set_drawn(view_data->drawn);
36 private_view.LocalSetViewportMetrics(ViewportMetrics(), 36 private_view.LocalSetViewportMetrics(mojo::ViewportMetrics(),
37 *view_data->viewport_metrics); 37 *view_data->viewport_metrics);
38 private_view.set_properties( 38 private_view.set_properties(
39 view_data->properties.To<std::map<std::string, std::vector<uint8_t>>>()); 39 view_data->properties.To<std::map<std::string, std::vector<uint8_t>>>());
40 client->AddView(view); 40 client->AddView(view);
41 private_view.LocalSetBounds(Rect(), *view_data->bounds); 41 private_view.LocalSetBounds(mojo::Rect(), *view_data->bounds);
42 if (parent) 42 if (parent)
43 ViewPrivate(parent).LocalAddChild(view); 43 ViewPrivate(parent).LocalAddChild(view);
44 return view; 44 return view;
45 } 45 }
46 46
47 View* BuildViewTree(ViewTreeClientImpl* client, 47 View* BuildViewTree(ViewTreeClientImpl* client,
48 const Array<ViewDataPtr>& views, 48 const mojo::Array<mojo::ViewDataPtr>& views,
49 View* initial_parent) { 49 View* initial_parent) {
50 std::vector<View*> parents; 50 std::vector<View*> parents;
51 View* root = NULL; 51 View* root = NULL;
52 View* last_view = NULL; 52 View* last_view = NULL;
53 if (initial_parent) 53 if (initial_parent)
54 parents.push_back(initial_parent); 54 parents.push_back(initial_parent);
55 for (size_t i = 0; i < views.size(); ++i) { 55 for (size_t i = 0; i < views.size(); ++i) {
56 if (last_view && views[i]->parent_id == last_view->id()) { 56 if (last_view && views[i]->parent_id == last_view->id()) {
57 parents.push_back(last_view); 57 parents.push_back(last_view);
58 } else if (!parents.empty()) { 58 } else if (!parents.empty()) {
59 while (parents.back()->id() != views[i]->parent_id) 59 while (parents.back()->id() != views[i]->parent_id)
60 parents.pop_back(); 60 parents.pop_back();
61 } 61 }
62 View* view = AddViewToConnection( 62 View* view = AddViewToConnection(
63 client, !parents.empty() ? parents.back() : NULL, views[i]); 63 client, !parents.empty() ? parents.back() : NULL, views[i]);
64 if (!last_view) 64 if (!last_view)
65 root = view; 65 root = view;
66 last_view = view; 66 last_view = view;
67 } 67 }
68 return root; 68 return root;
69 } 69 }
70 70
71 ViewTreeConnection* ViewTreeConnection::Create( 71 ViewTreeConnection* ViewTreeConnection::Create(
72 ViewTreeDelegate* delegate, 72 ViewTreeDelegate* delegate,
73 InterfaceRequest<ViewTreeClient> request) { 73 mojo::InterfaceRequest<mojo::ViewTreeClient> request) {
74 return new ViewTreeClientImpl(delegate, request.Pass()); 74 return new ViewTreeClientImpl(delegate, request.Pass());
75 } 75 }
76 76
77 ViewTreeClientImpl::ViewTreeClientImpl(ViewTreeDelegate* delegate, 77 ViewTreeClientImpl::ViewTreeClientImpl(
78 InterfaceRequest<ViewTreeClient> request) 78 ViewTreeDelegate* delegate,
79 mojo::InterfaceRequest<mojo::ViewTreeClient> request)
79 : connection_id_(0), 80 : connection_id_(0),
80 next_id_(1), 81 next_id_(1),
81 delegate_(delegate), 82 delegate_(delegate),
82 root_(nullptr), 83 root_(nullptr),
83 capture_view_(nullptr), 84 capture_view_(nullptr),
84 focused_view_(nullptr), 85 focused_view_(nullptr),
85 activated_view_(nullptr), 86 activated_view_(nullptr),
86 binding_(this, request.Pass()), 87 binding_(this, request.Pass()),
87 is_embed_root_(false), 88 is_embed_root_(false),
88 in_destructor_(false) {} 89 in_destructor_(false) {}
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 tree_->AddView(parent_id, child_id, ActionCompletedCallback()); 122 tree_->AddView(parent_id, child_id, ActionCompletedCallback());
122 } 123 }
123 124
124 void ViewTreeClientImpl::RemoveChild(Id child_id, Id parent_id) { 125 void ViewTreeClientImpl::RemoveChild(Id child_id, Id parent_id) {
125 DCHECK(tree_); 126 DCHECK(tree_);
126 tree_->RemoveViewFromParent(child_id, ActionCompletedCallback()); 127 tree_->RemoveViewFromParent(child_id, ActionCompletedCallback());
127 } 128 }
128 129
129 void ViewTreeClientImpl::Reorder(Id view_id, 130 void ViewTreeClientImpl::Reorder(Id view_id,
130 Id relative_view_id, 131 Id relative_view_id,
131 OrderDirection direction) { 132 mojo::OrderDirection direction) {
132 DCHECK(tree_); 133 DCHECK(tree_);
133 tree_->ReorderView(view_id, relative_view_id, direction, 134 tree_->ReorderView(view_id, relative_view_id, direction,
134 ActionCompletedCallback()); 135 ActionCompletedCallback());
135 } 136 }
136 137
137 bool ViewTreeClientImpl::OwnsView(Id id) const { 138 bool ViewTreeClientImpl::OwnsView(Id id) const {
138 return HiWord(id) == connection_id_; 139 return HiWord(id) == connection_id_;
139 } 140 }
140 141
141 void ViewTreeClientImpl::SetBounds(Id view_id, const Rect& bounds) { 142 void ViewTreeClientImpl::SetBounds(Id view_id, const mojo::Rect& bounds) {
142 DCHECK(tree_); 143 DCHECK(tree_);
143 tree_->SetViewBounds(view_id, bounds.Clone(), ActionCompletedCallback()); 144 tree_->SetViewBounds(view_id, bounds.Clone(), ActionCompletedCallback());
144 } 145 }
145 146
146 void ViewTreeClientImpl::SetFocus(Id view_id) { 147 void ViewTreeClientImpl::SetFocus(Id view_id) {
147 // In order for us to get here we had to have exposed a view, which implies we 148 // In order for us to get here we had to have exposed a view, which implies we
148 // got a connection. 149 // got a connection.
149 DCHECK(tree_); 150 DCHECK(tree_);
150 tree_->SetFocus(view_id); 151 tree_->SetFocus(view_id);
151 } 152 }
152 153
153 void ViewTreeClientImpl::SetVisible(Id view_id, bool visible) { 154 void ViewTreeClientImpl::SetVisible(Id view_id, bool visible) {
154 DCHECK(tree_); 155 DCHECK(tree_);
155 tree_->SetViewVisibility(view_id, visible, ActionCompletedCallback()); 156 tree_->SetViewVisibility(view_id, visible, ActionCompletedCallback());
156 } 157 }
157 158
158 void ViewTreeClientImpl::SetProperty(Id view_id, 159 void ViewTreeClientImpl::SetProperty(Id view_id,
159 const std::string& name, 160 const std::string& name,
160 const std::vector<uint8_t>& data) { 161 const std::vector<uint8_t>& data) {
161 DCHECK(tree_); 162 DCHECK(tree_);
162 tree_->SetViewProperty(view_id, String(name), Array<uint8_t>::From(data), 163 tree_->SetViewProperty(view_id, mojo::String(name),
164 mojo::Array<uint8_t>::From(data),
163 ActionCompletedCallback()); 165 ActionCompletedCallback());
164 } 166 }
165 167
166 void ViewTreeClientImpl::SetViewTextInputState(Id view_id, 168 void ViewTreeClientImpl::SetViewTextInputState(Id view_id,
167 TextInputStatePtr state) { 169 mojo::TextInputStatePtr state) {
168 DCHECK(tree_); 170 DCHECK(tree_);
169 tree_->SetViewTextInputState(view_id, state.Pass()); 171 tree_->SetViewTextInputState(view_id, state.Pass());
170 } 172 }
171 173
172 void ViewTreeClientImpl::SetImeVisibility(Id view_id, 174 void ViewTreeClientImpl::SetImeVisibility(Id view_id,
173 bool visible, 175 bool visible,
174 TextInputStatePtr state) { 176 mojo::TextInputStatePtr state) {
175 DCHECK(tree_); 177 DCHECK(tree_);
176 tree_->SetImeVisibility(view_id, visible, state.Pass()); 178 tree_->SetImeVisibility(view_id, visible, state.Pass());
177 } 179 }
178 180
179 void ViewTreeClientImpl::Embed(Id view_id, 181 void ViewTreeClientImpl::Embed(Id view_id,
180 ViewTreeClientPtr client, 182 mojo::ViewTreeClientPtr client,
181 uint32_t policy_bitmask, 183 uint32_t policy_bitmask,
182 const ViewTree::EmbedCallback& callback) { 184 const mojo::ViewTree::EmbedCallback& callback) {
183 DCHECK(tree_); 185 DCHECK(tree_);
184 tree_->Embed(view_id, client.Pass(), policy_bitmask, callback); 186 tree_->Embed(view_id, client.Pass(), policy_bitmask, callback);
185 } 187 }
186 188
187 void ViewTreeClientImpl::RequestSurface(Id view_id, 189 void ViewTreeClientImpl::RequestSurface(
188 InterfaceRequest<Surface> surface, 190 Id view_id,
189 SurfaceClientPtr client) { 191 mojo::InterfaceRequest<mojo::Surface> surface,
192 mojo::SurfaceClientPtr client) {
190 DCHECK(tree_); 193 DCHECK(tree_);
191 tree_->RequestSurface(view_id, surface.Pass(), client.Pass()); 194 tree_->RequestSurface(view_id, surface.Pass(), client.Pass());
192 } 195 }
193 196
194 void ViewTreeClientImpl::AddView(View* view) { 197 void ViewTreeClientImpl::AddView(View* view) {
195 DCHECK(views_.find(view->id()) == views_.end()); 198 DCHECK(views_.find(view->id()) == views_.end());
196 views_[view->id()] = view; 199 views_[view->id()] = view;
197 } 200 }
198 201
199 void ViewTreeClientImpl::RemoveView(Id view_id) { 202 void ViewTreeClientImpl::RemoveView(Id view_id) {
(...skipping 13 matching lines...) Expand all
213 if (!in_destructor_) 216 if (!in_destructor_)
214 delete this; 217 delete this;
215 } 218 }
216 219
217 //////////////////////////////////////////////////////////////////////////////// 220 ////////////////////////////////////////////////////////////////////////////////
218 // ViewTreeClientImpl, ViewTreeConnection implementation: 221 // ViewTreeClientImpl, ViewTreeConnection implementation:
219 222
220 Id ViewTreeClientImpl::CreateViewOnServer() { 223 Id ViewTreeClientImpl::CreateViewOnServer() {
221 DCHECK(tree_); 224 DCHECK(tree_);
222 const Id view_id = MakeTransportId(connection_id_, ++next_id_); 225 const Id view_id = MakeTransportId(connection_id_, ++next_id_);
223 tree_->CreateView(view_id, [this](ErrorCode code) { 226 tree_->CreateView(view_id, [this](mojo::ErrorCode code) {
224 OnActionCompleted(code == ERROR_CODE_NONE); 227 OnActionCompleted(code == mojo::ERROR_CODE_NONE);
225 }); 228 });
226 return view_id; 229 return view_id;
227 } 230 }
228 231
229 View* ViewTreeClientImpl::GetRoot() { 232 View* ViewTreeClientImpl::GetRoot() {
230 return root_; 233 return root_;
231 } 234 }
232 235
233 View* ViewTreeClientImpl::GetViewById(Id id) { 236 View* ViewTreeClientImpl::GetViewById(Id id) {
234 IdToViewMap::const_iterator it = views_.find(id); 237 IdToViewMap::const_iterator it = views_.find(id);
(...skipping 15 matching lines...) Expand all
250 } 253 }
251 254
252 ConnectionSpecificId ViewTreeClientImpl::GetConnectionId() { 255 ConnectionSpecificId ViewTreeClientImpl::GetConnectionId() {
253 return connection_id_; 256 return connection_id_;
254 } 257 }
255 258
256 //////////////////////////////////////////////////////////////////////////////// 259 ////////////////////////////////////////////////////////////////////////////////
257 // ViewTreeClientImpl, ViewTreeClient implementation: 260 // ViewTreeClientImpl, ViewTreeClient implementation:
258 261
259 void ViewTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, 262 void ViewTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id,
260 ViewDataPtr root_data, 263 mojo::ViewDataPtr root_data,
261 ViewTreePtr tree, 264 mojo::ViewTreePtr tree,
262 Id focused_view_id, 265 Id focused_view_id,
263 uint32 access_policy) { 266 uint32 access_policy) {
264 if (tree) { 267 if (tree) {
265 DCHECK(!tree_); 268 DCHECK(!tree_);
266 tree_ = tree.Pass(); 269 tree_ = tree.Pass();
267 tree_.set_connection_error_handler([this]() { delete this; }); 270 tree_.set_connection_error_handler([this]() { delete this; });
268 } 271 }
269 connection_id_ = connection_id; 272 connection_id_ = connection_id;
270 is_embed_root_ = 273 is_embed_root_ =
271 (access_policy & mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT) != 0; 274 (access_policy & mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT) != 0;
(...skipping 14 matching lines...) Expand all
286 } 289 }
287 } 290 }
288 291
289 void ViewTreeClientImpl::OnUnembed() { 292 void ViewTreeClientImpl::OnUnembed() {
290 delegate_->OnUnembed(); 293 delegate_->OnUnembed();
291 // This will send out the various notifications. 294 // This will send out the various notifications.
292 delete this; 295 delete this;
293 } 296 }
294 297
295 void ViewTreeClientImpl::OnViewBoundsChanged(Id view_id, 298 void ViewTreeClientImpl::OnViewBoundsChanged(Id view_id,
296 RectPtr old_bounds, 299 mojo::RectPtr old_bounds,
297 RectPtr new_bounds) { 300 mojo::RectPtr new_bounds) {
298 View* view = GetViewById(view_id); 301 View* view = GetViewById(view_id);
299 ViewPrivate(view).LocalSetBounds(*old_bounds, *new_bounds); 302 ViewPrivate(view).LocalSetBounds(*old_bounds, *new_bounds);
300 } 303 }
301 304
302 namespace { 305 namespace {
303 306
304 void SetViewportMetricsOnDecendants(View* root, 307 void SetViewportMetricsOnDecendants(View* root,
305 const ViewportMetrics& old_metrics, 308 const mojo::ViewportMetrics& old_metrics,
306 const ViewportMetrics& new_metrics) { 309 const mojo::ViewportMetrics& new_metrics) {
307 ViewPrivate(root).LocalSetViewportMetrics(old_metrics, new_metrics); 310 ViewPrivate(root).LocalSetViewportMetrics(old_metrics, new_metrics);
308 const View::Children& children = root->children(); 311 const View::Children& children = root->children();
309 for (size_t i = 0; i < children.size(); ++i) 312 for (size_t i = 0; i < children.size(); ++i)
310 SetViewportMetricsOnDecendants(children[i], old_metrics, new_metrics); 313 SetViewportMetricsOnDecendants(children[i], old_metrics, new_metrics);
311 } 314 }
312 } 315 }
313 316
314 void ViewTreeClientImpl::OnViewViewportMetricsChanged( 317 void ViewTreeClientImpl::OnViewViewportMetricsChanged(
315 ViewportMetricsPtr old_metrics, 318 mojo::ViewportMetricsPtr old_metrics,
316 ViewportMetricsPtr new_metrics) { 319 mojo::ViewportMetricsPtr new_metrics) {
317 View* view = GetRoot(); 320 View* view = GetRoot();
318 if (view) 321 if (view)
319 SetViewportMetricsOnDecendants(view, *old_metrics, *new_metrics); 322 SetViewportMetricsOnDecendants(view, *old_metrics, *new_metrics);
320 } 323 }
321 324
322 void ViewTreeClientImpl::OnViewHierarchyChanged( 325 void ViewTreeClientImpl::OnViewHierarchyChanged(
323 Id view_id, 326 Id view_id,
324 Id new_parent_id, 327 Id new_parent_id,
325 Id old_parent_id, 328 Id old_parent_id,
326 mojo::Array<ViewDataPtr> views) { 329 mojo::Array<mojo::ViewDataPtr> views) {
327 View* initial_parent = views.size() ? GetViewById(views[0]->parent_id) : NULL; 330 View* initial_parent = views.size() ? GetViewById(views[0]->parent_id) : NULL;
328 331
329 const bool was_view_known = GetViewById(view_id) != nullptr; 332 const bool was_view_known = GetViewById(view_id) != nullptr;
330 333
331 BuildViewTree(this, views, initial_parent); 334 BuildViewTree(this, views, initial_parent);
332 335
333 // If the view was not known, then BuildViewTree() will have created it and 336 // If the view was not known, then BuildViewTree() will have created it and
334 // parented the view. 337 // parented the view.
335 if (!was_view_known) 338 if (!was_view_known)
336 return; 339 return;
337 340
338 View* new_parent = GetViewById(new_parent_id); 341 View* new_parent = GetViewById(new_parent_id);
339 View* old_parent = GetViewById(old_parent_id); 342 View* old_parent = GetViewById(old_parent_id);
340 View* view = GetViewById(view_id); 343 View* view = GetViewById(view_id);
341 if (new_parent) 344 if (new_parent)
342 ViewPrivate(new_parent).LocalAddChild(view); 345 ViewPrivate(new_parent).LocalAddChild(view);
343 else 346 else
344 ViewPrivate(old_parent).LocalRemoveChild(view); 347 ViewPrivate(old_parent).LocalRemoveChild(view);
345 } 348 }
346 349
347 void ViewTreeClientImpl::OnViewReordered(Id view_id, 350 void ViewTreeClientImpl::OnViewReordered(Id view_id,
348 Id relative_view_id, 351 Id relative_view_id,
349 OrderDirection direction) { 352 mojo::OrderDirection direction) {
350 View* view = GetViewById(view_id); 353 View* view = GetViewById(view_id);
351 View* relative_view = GetViewById(relative_view_id); 354 View* relative_view = GetViewById(relative_view_id);
352 if (view && relative_view) 355 if (view && relative_view)
353 ViewPrivate(view).LocalReorder(relative_view, direction); 356 ViewPrivate(view).LocalReorder(relative_view, direction);
354 } 357 }
355 358
356 void ViewTreeClientImpl::OnViewDeleted(Id view_id) { 359 void ViewTreeClientImpl::OnViewDeleted(Id view_id) {
357 View* view = GetViewById(view_id); 360 View* view = GetViewById(view_id);
358 if (view) 361 if (view)
359 ViewPrivate(view).LocalDestroy(); 362 ViewPrivate(view).LocalDestroy();
360 } 363 }
361 364
362 void ViewTreeClientImpl::OnViewVisibilityChanged(Id view_id, bool visible) { 365 void ViewTreeClientImpl::OnViewVisibilityChanged(Id view_id, bool visible) {
363 // TODO(sky): there is a race condition here. If this client and another 366 // TODO(sky): there is a race condition here. If this client and another
364 // client change the visibility at the same time the wrong value may be set. 367 // client change the visibility at the same time the wrong value may be set.
365 // Deal with this some how. 368 // Deal with this some how.
366 View* view = GetViewById(view_id); 369 View* view = GetViewById(view_id);
367 if (view) 370 if (view)
368 ViewPrivate(view).LocalSetVisible(visible); 371 ViewPrivate(view).LocalSetVisible(visible);
369 } 372 }
370 373
371 void ViewTreeClientImpl::OnViewDrawnStateChanged(Id view_id, bool drawn) { 374 void ViewTreeClientImpl::OnViewDrawnStateChanged(Id view_id, bool drawn) {
372 View* view = GetViewById(view_id); 375 View* view = GetViewById(view_id);
373 if (view) 376 if (view)
374 ViewPrivate(view).LocalSetDrawn(drawn); 377 ViewPrivate(view).LocalSetDrawn(drawn);
375 } 378 }
376 379
377 void ViewTreeClientImpl::OnViewSharedPropertyChanged(Id view_id, 380 void ViewTreeClientImpl::OnViewSharedPropertyChanged(
378 const String& name, 381 Id view_id,
379 Array<uint8_t> new_data) { 382 const mojo::String& name,
383 mojo::Array<uint8_t> new_data) {
380 View* view = GetViewById(view_id); 384 View* view = GetViewById(view_id);
381 if (view) { 385 if (view) {
382 std::vector<uint8_t> data; 386 std::vector<uint8_t> data;
383 std::vector<uint8_t>* data_ptr = NULL; 387 std::vector<uint8_t>* data_ptr = NULL;
384 if (!new_data.is_null()) { 388 if (!new_data.is_null()) {
385 data = new_data.To<std::vector<uint8_t>>(); 389 data = new_data.To<std::vector<uint8_t>>();
386 data_ptr = &data; 390 data_ptr = &data;
387 } 391 }
388 392
389 view->SetSharedProperty(name, data_ptr); 393 view->SetSharedProperty(name, data_ptr);
390 } 394 }
391 } 395 }
392 396
393 void ViewTreeClientImpl::OnViewInputEvent( 397 void ViewTreeClientImpl::OnViewInputEvent(
394 Id view_id, 398 Id view_id,
395 EventPtr event, 399 mojo::EventPtr event,
396 const Callback<void()>& ack_callback) { 400 const mojo::Callback<void()>& ack_callback) {
397 View* view = GetViewById(view_id); 401 View* view = GetViewById(view_id);
398 if (view) { 402 if (view) {
399 FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view).observers(), 403 FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view).observers(),
400 OnViewInputEvent(view, event)); 404 OnViewInputEvent(view, event));
401 } 405 }
402 ack_callback.Run(); 406 ack_callback.Run();
403 } 407 }
404 408
405 void ViewTreeClientImpl::OnViewFocused(Id focused_view_id) { 409 void ViewTreeClientImpl::OnViewFocused(Id focused_view_id) {
406 View* focused = GetViewById(focused_view_id); 410 View* focused = GetViewById(focused_view_id);
(...skipping 13 matching lines...) Expand all
420 } 424 }
421 425
422 //////////////////////////////////////////////////////////////////////////////// 426 ////////////////////////////////////////////////////////////////////////////////
423 // ViewTreeClientImpl, private: 427 // ViewTreeClientImpl, private:
424 428
425 void ViewTreeClientImpl::OnActionCompleted(bool success) { 429 void ViewTreeClientImpl::OnActionCompleted(bool success) {
426 if (!change_acked_callback_.is_null()) 430 if (!change_acked_callback_.is_null())
427 change_acked_callback_.Run(); 431 change_acked_callback_.Run();
428 } 432 }
429 433
430 Callback<void(bool)> ViewTreeClientImpl::ActionCompletedCallback() { 434 mojo::Callback<void(bool)> ViewTreeClientImpl::ActionCompletedCallback() {
431 return [this](bool success) { OnActionCompleted(success); }; 435 return [this](bool success) { OnActionCompleted(success); };
432 } 436 }
433 437
434 } // namespace mojo 438 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/public/cpp/lib/view_tree_client_impl.h ('k') | components/mus/public/cpp/lib/view_tree_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698