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

Unified Diff: examples/python/__mojo__.py

Issue 868463008: Remove Client relationship between mojo.Shell/mojo.Application (Closed) Base URL: git@github.com:domokit/mojo.git@app_impl_init
Patch Set: fix android Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: examples/python/__mojo__.py
diff --git a/examples/python/__mojo__.py b/examples/python/__mojo__.py
index c60f2dcf584f20f8b47fef8f49586bbbb1fefb57..7afa69a0af2a6cd4622db0560a87742866b35524 100644
--- a/examples/python/__mojo__.py
+++ b/examples/python/__mojo__.py
@@ -14,11 +14,12 @@ import shell_mojom
import mojo_system
class ApplicationImpl(application_mojom.Application):
- def __init__(self):
+ def __init__(self, app_request_handle):
self._providers = []
+ application_mojom.Application.manager.Bind(self, app_request_handle)
- def Initialize(self, args):
- pass
+ def Initialize(self, shell, args):
+ self.shell = shell
def AcceptConnection(self, requestor_url, services, exposed_services):
# We keep a reference to ServiceProviderImpl to ensure neither it nor
@@ -27,6 +28,7 @@ class ApplicationImpl(application_mojom.Application):
service_provider.AddService(ExampleServiceImpl)
services.Bind(service_provider)
self._providers.append(services)
+ # TODO(qsr): Handle exposed_services
class ServiceProviderImpl(service_provider_mojom.ServiceProvider):
@@ -52,12 +54,11 @@ class ExampleServiceImpl(example_service_mojom.ExampleService):
def RunCallback(self):
return {}
-def MojoMain(shell_handle):
+def MojoMain(app_request_handle):
"""MojoMain is the entry point for a python Mojo module."""
loop = mojo_system.RunLoop()
- shell = shell_mojom.Shell.manager.Proxy(mojo_system.Handle(shell_handle))
- shell.client = ApplicationImpl()
- shell.manager.AddOnErrorCallback(loop.Quit)
+ application = ApplicationImpl(mojo_system.Handle(app_request_handle))
+ application.manager.AddOnErrorCallback(loop.Quit)
loop.Run()

Powered by Google App Engine
This is Rietveld 408576698