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

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/node.cc

Issue 433513005: Pass ServiceProvider thru ViewManagerService::Embed() allowing embedder & embeddee to expose servic… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | Annotate | Revision Log
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 "mojo/services/public/cpp/view_manager/node.h" 5 #include "mojo/services/public/cpp/view_manager/node.h"
6 6
7 #include "mojo/public/cpp/application/service_provider_impl.h"
7 #include "mojo/services/public/cpp/view_manager/lib/node_private.h" 8 #include "mojo/services/public/cpp/view_manager/lib/node_private.h"
8 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" 9 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h"
9 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" 10 #include "mojo/services/public/cpp/view_manager/lib/view_private.h"
10 #include "mojo/services/public/cpp/view_manager/node_observer.h" 11 #include "mojo/services/public/cpp/view_manager/node_observer.h"
11 #include "mojo/services/public/cpp/view_manager/view.h" 12 #include "mojo/services/public/cpp/view_manager/view.h"
12 13
13 namespace mojo { 14 namespace mojo {
14 15
15 namespace { 16 namespace {
16 17
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 330
330 void Node::SetFocus() { 331 void Node::SetFocus() {
331 if (manager_) 332 if (manager_)
332 static_cast<ViewManagerClientImpl*>(manager_)->SetFocus(id_); 333 static_cast<ViewManagerClientImpl*>(manager_)->SetFocus(id_);
333 } 334 }
334 335
335 void Node::Embed(const String& url) { 336 void Node::Embed(const String& url) {
336 static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_); 337 static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_);
337 } 338 }
338 339
340 scoped_ptr<ServiceProvider>
341 Node::Embed(const String& url,
342 scoped_ptr<ServiceProviderImpl> exported_services) {
343 scoped_ptr<ServiceProvider> imported_services;
344 // BindToProxy() takes ownership of |exported_services|.
345 ServiceProviderImpl* registry = exported_services.release();
346 ServiceProviderPtr sp;
347 if (registry) {
348 BindToProxy(registry, &sp);
349 imported_services.reset(exported_services->CreateRemoteServiceProvider());
350 }
351 static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_, sp.Pass());
352 return imported_services.Pass();
353 }
354
339 //////////////////////////////////////////////////////////////////////////////// 355 ////////////////////////////////////////////////////////////////////////////////
340 // Node, protected: 356 // Node, protected:
341 357
342 Node::Node() 358 Node::Node()
343 : manager_(NULL), 359 : manager_(NULL),
344 id_(static_cast<Id>(-1)), 360 id_(static_cast<Id>(-1)),
345 parent_(NULL), 361 parent_(NULL),
346 active_view_(NULL) {} 362 active_view_(NULL) {}
347 363
348 Node::~Node() { 364 Node::~Node() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 413 }
398 414
399 void Node::LocalSetBounds(const gfx::Rect& old_bounds, 415 void Node::LocalSetBounds(const gfx::Rect& old_bounds,
400 const gfx::Rect& new_bounds) { 416 const gfx::Rect& new_bounds) {
401 DCHECK(old_bounds == bounds_); 417 DCHECK(old_bounds == bounds_);
402 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); 418 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds);
403 bounds_ = new_bounds; 419 bounds_ = new_bounds;
404 } 420 }
405 421
406 } // namespace mojo 422 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/html_viewer/html_viewer.cc ('k') | mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698