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

Side by Side Diff: mojo/public/python/mojo_application/service_provider_impl.py

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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
OLDNEW
(Empty)
1 # Copyright 2015 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 """Python implementation of the ServiceProvider interface."""
6
7 import logging
8
9 import service_provider_mojom
10
11 class ServiceProviderImpl(service_provider_mojom.ServiceProvider):
12 def __init__(self, provider):
13 self._provider = provider
14 self._name_to_service_connector = {}
15
16 def AddService(self, service_class, service_name=None):
17 if service_name is None:
18 service_name = service_class.manager.service_name
19 if service_name is None:
20 logging.error("No ServiceName specified for %s." % service_class.__name__)
21 return
22 self._name_to_service_connector[service_name] = service_class
23
24 def ConnectToService(self, interface_name, pipe):
25 if interface_name in self._name_to_service_connector:
26 service = self._name_to_service_connector[interface_name]
27 service.manager.Bind(service(), pipe)
28 else:
29 logging.error("Unable to find service " + interface_name)
OLDNEW
« no previous file with comments | « mojo/public/python/mojo_application/application_runner.py ('k') | mojo/public/python/mojo_bindings/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698