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

Side by Side Diff: mojo/public/cpp/application/lib/exported_service_registry.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/public/cpp/application/exported_service_registry.h"
6
7 #include "mojo/public/cpp/application/lib/service_connector.h"
8
9 namespace mojo {
10
11 ExportedServiceRegistry::ExportedServiceRegistry() : remote_(NULL) {
12 }
13
14 ExportedServiceRegistry::~ExportedServiceRegistry() {
15 }
16
17 void ExportedServiceRegistry::ConnectToService(
18 const String& service_name,
19 ScopedMessagePipeHandle client_handle) {
20 if (service_connectors_.find(service_name) == service_connectors_.end()) {
21 client_handle.reset();
22 return;
23 }
24
25 internal::ServiceConnectorBase* service_connector =
26 service_connectors_[service_name];
27 return service_connector->ConnectToService(service_name,
28 client_handle.Pass());
29 }
30
31 void ExportedServiceRegistry::AddServiceConnector(
32 internal::ServiceConnectorBase* service_connector) {
33 RemoveServiceConnector(service_connector);
34 service_connectors_[service_connector->name()] = service_connector;
35 // TODO(beng): perhaps take app connection thru ctor??
36 service_connector->set_application_connection(NULL);
37 }
38
39 void ExportedServiceRegistry::RemoveServiceConnector(
40 internal::ServiceConnectorBase* service_connector) {
41 NameToServiceConnectorMap::iterator it =
42 service_connectors_.find(service_connector->name());
43 if (it == service_connectors_.end())
44 return;
45 delete it->second;
46 service_connectors_.erase(it);
47 }
48
49 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698