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

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

Issue 1508613003: Require an explicit ServiceName annotation for interfaces in Python. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | mojo/public/python/mojo_application/service_provider_impl.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 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 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 """Python implementation of the Application interface.""" 5 """Python implementation of the Application interface."""
6 6
7 import logging
8
7 import application_mojom 9 import application_mojom
8 import service_provider_mojom 10 import service_provider_mojom
9 import shell_mojom 11 import shell_mojom
10 from mojo_application.service_provider_impl import ServiceProviderImpl 12 from mojo_application.service_provider_impl import ServiceProviderImpl
11 13
12 import mojo_system 14 import mojo_system
13 15
14 class ApplicationImpl(application_mojom.Application): 16 class ApplicationImpl(application_mojom.Application):
15 def __init__(self, delegate, app_request_handle): 17 def __init__(self, delegate, app_request_handle):
16 self.shell = None 18 self.shell = None
(...skipping 22 matching lines...) Expand all
39 def removeServiceProvider(): 41 def removeServiceProvider():
40 self._providers.remove(service_provider) 42 self._providers.remove(service_provider)
41 service_provider.manager.AddOnErrorCallback(removeServiceProvider) 43 service_provider.manager.AddOnErrorCallback(removeServiceProvider)
42 44
43 def ConnectToService(self, application_url, service_class): 45 def ConnectToService(self, application_url, service_class):
44 """ 46 """
45 Helper method to connect to a service. |application_url| is the URL of the 47 Helper method to connect to a service. |application_url| is the URL of the
46 application to be connected to, and |service_class| is the class of the 48 application to be connected to, and |service_class| is the class of the
47 service to be connected to. Returns a proxy to the service. 49 service to be connected to. Returns a proxy to the service.
48 """ 50 """
51 if not service_class.manager.service_name:
52 logging.error("No ServiceName specified for %s." % service_class.__name__)
53 return
49 application_proxy, request = ( 54 application_proxy, request = (
50 service_provider_mojom.ServiceProvider.manager.NewRequest()) 55 service_provider_mojom.ServiceProvider.manager.NewRequest())
51 self.shell.ConnectToApplication(application_url, request, None) 56 self.shell.ConnectToApplication(application_url, request, None)
52 57
53 service_proxy, request = service_class.manager.NewRequest() 58 service_proxy, request = service_class.manager.NewRequest()
54 application_proxy.ConnectToService(service_class.manager.name, 59 application_proxy.ConnectToService(service_class.manager.service_name,
55 request.PassMessagePipe()) 60 request.PassMessagePipe())
56 61
57 return service_proxy 62 return service_proxy
OLDNEW
« no previous file with comments | « no previous file | mojo/public/python/mojo_application/service_provider_impl.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698