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

Side by Side Diff: examples/python/__mojo__.py

Issue 905583002: Pass the final URL an app was loaded from to the app in Initialize(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: o Created 5 years, 10 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
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 """Example python application implementing the Echo service.""" 5 """Example python application implementing the Echo service."""
6 6
7 import logging 7 import logging
8 8
9 import application_mojom 9 import application_mojom
10 import example_service_mojom 10 import example_service_mojom
11 import service_provider_mojom 11 import service_provider_mojom
12 import shell_mojom 12 import shell_mojom
13 13
14 import mojo_system 14 import mojo_system
15 15
16 class ApplicationImpl(application_mojom.Application): 16 class ApplicationImpl(application_mojom.Application):
17 def __init__(self, app_request_handle): 17 def __init__(self, app_request_handle):
18 self._providers = [] 18 self._providers = []
19 application_mojom.Application.manager.Bind(self, app_request_handle) 19 application_mojom.Application.manager.Bind(self, app_request_handle)
20 20
21 def Initialize(self, shell, args): 21 def Initialize(self, shell, url, args):
22 self.shell = shell 22 self.shell = shell
23 23
24 def AcceptConnection(self, requestor_url, services, exposed_services): 24 def AcceptConnection(self, requestor_url, services, exposed_services):
25 # We keep a reference to ServiceProviderImpl to ensure neither it nor 25 # We keep a reference to ServiceProviderImpl to ensure neither it nor
26 # provider gets garbage collected. 26 # provider gets garbage collected.
27 service_provider = ServiceProviderImpl(services) 27 service_provider = ServiceProviderImpl(services)
28 service_provider.AddService(ExampleServiceImpl) 28 service_provider.AddService(ExampleServiceImpl)
29 services.Bind(service_provider) 29 services.Bind(service_provider)
30 self._providers.append(service_provider) 30 self._providers.append(service_provider)
31 31
(...skipping 20 matching lines...) Expand all
52 52
53 53
54 def MojoMain(app_request_handle): 54 def MojoMain(app_request_handle):
55 """MojoMain is the entry point for a python Mojo module.""" 55 """MojoMain is the entry point for a python Mojo module."""
56 loop = mojo_system.RunLoop() 56 loop = mojo_system.RunLoop()
57 57
58 application = ApplicationImpl(mojo_system.Handle(app_request_handle)) 58 application = ApplicationImpl(mojo_system.Handle(app_request_handle))
59 application.manager.AddOnErrorCallback(loop.Quit) 59 application.manager.AddOnErrorCallback(loop.Quit)
60 60
61 loop.Run() 61 loop.Run()
OLDNEW
« no previous file with comments | « examples/forwarding_content_handler/forwarding_content_handler.cc ('k') | mojo/public/cpp/application/application_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698