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

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/exported_service_registry.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<ExportedServiceRegistry> exported_services) {
343 scoped_ptr<ServiceProvider> imported_services;
344 // BindToProxy() takes ownership of |exported_services|.
345 ExportedServiceRegistry* registry = exported_services.release();
346 ServiceProviderPtr sp;
347 if (registry) {
348 BindToProxy(registry, &sp);
349 RemoteServiceProvider* remote =
350 new RemoteServiceProvider(registry->client());
351 registry->set_remote(remote);
352 imported_services.reset(remote);
353 }
354 static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_, sp.Pass());
355 return imported_services.Pass();
356 }
357
339 //////////////////////////////////////////////////////////////////////////////// 358 ////////////////////////////////////////////////////////////////////////////////
340 // Node, protected: 359 // Node, protected:
341 360
342 Node::Node() 361 Node::Node()
343 : manager_(NULL), 362 : manager_(NULL),
344 id_(static_cast<Id>(-1)), 363 id_(static_cast<Id>(-1)),
345 parent_(NULL), 364 parent_(NULL),
346 active_view_(NULL) {} 365 active_view_(NULL) {}
347 366
348 Node::~Node() { 367 Node::~Node() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 416 }
398 417
399 void Node::LocalSetBounds(const gfx::Rect& old_bounds, 418 void Node::LocalSetBounds(const gfx::Rect& old_bounds,
400 const gfx::Rect& new_bounds) { 419 const gfx::Rect& new_bounds) {
401 DCHECK(old_bounds == bounds_); 420 DCHECK(old_bounds == bounds_);
402 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); 421 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds);
403 bounds_ = new_bounds; 422 bounds_ = new_bounds;
404 } 423 }
405 424
406 } // namespace mojo 425 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698