Index: sky/viewer/content_handler_impl.cc |
diff --git a/sky/viewer/content_handler_impl.cc b/sky/viewer/content_handler_impl.cc |
index d10a7824faf5d350b5cf69d78da441e26e3f9f5b..4e70167fa477e8599dfee22eb52447cd5114f470 100644 |
--- a/sky/viewer/content_handler_impl.cc |
+++ b/sky/viewer/content_handler_impl.cc |
@@ -6,6 +6,7 @@ |
#include "base/bind.h" |
#include "mojo/public/cpp/application/connect.h" |
+#include "mojo/public/cpp/bindings/strong_binding.h" |
#include "mojo/public/cpp/utility/run_loop.h" |
#include "mojo/services/network/public/interfaces/network_service.mojom.h" |
#include "sky/viewer/document_view.h" |
@@ -14,20 +15,21 @@ namespace sky { |
class SkyApplication : public mojo::Application { |
public: |
- SkyApplication(mojo::ShellPtr shell, |
+ SkyApplication(mojo::InterfaceRequest<mojo::Application> application, |
mojo::URLResponsePtr response) |
: url_(response->url), |
- shell_(shell.Pass()), |
- initial_response_(response.Pass()) { |
- shell_.set_client(this); |
+ binding_(this, application.Pass()), |
+ initial_response_(response.Pass()) {} |
+ |
+ void Initialize(mojo::ShellPtr shell, |
+ mojo::Array<mojo::String> args) override { |
+ shell_ = shell.Pass(); |
mojo::ServiceProviderPtr service_provider; |
shell_->ConnectToApplication("mojo:network_service", |
mojo::GetProxy(&service_provider), nullptr); |
mojo::ConnectToService(service_provider.get(), &network_service_); |
} |
- void Initialize(mojo::Array<mojo::String> args) override {} |
- |
void AcceptConnection(const mojo::String& requestor_url, |
mojo::InterfaceRequest<mojo::ServiceProvider> services, |
mojo::ServiceProviderPtr exposed_services) override { |
@@ -68,6 +70,7 @@ class SkyApplication : public mojo::Application { |
} |
mojo::String url_; |
+ mojo::StrongBinding<mojo::Application> binding_; |
mojo::ShellPtr shell_; |
mojo::NetworkServicePtr network_service_; |
mojo::URLResponsePtr initial_response_; |
@@ -79,9 +82,10 @@ ContentHandlerImpl::ContentHandlerImpl() { |
ContentHandlerImpl::~ContentHandlerImpl() { |
} |
-void ContentHandlerImpl::StartApplication(mojo::ShellPtr shell, |
- mojo::URLResponsePtr response) { |
- new SkyApplication(shell.Pass(), response.Pass()); |
+void ContentHandlerImpl::StartApplication( |
+ mojo::InterfaceRequest<mojo::Application> application, |
+ mojo::URLResponsePtr response) { |
+ new SkyApplication(application.Pass(), response.Pass()); |
} |
} // namespace sky |