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

Unified Diff: sky/viewer/content_handler_impl.cc

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: 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

Powered by Google App Engine
This is Rietveld 408576698