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

Unified Diff: examples/content_handler_demo/content_handler_demo.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
« no previous file with comments | « no previous file | examples/pdf_viewer/pdf_viewer.cc » ('j') | mojo/public/cpp/application/application_impl.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/content_handler_demo/content_handler_demo.cc
diff --git a/examples/content_handler_demo/content_handler_demo.cc b/examples/content_handler_demo/content_handler_demo.cc
index 4932fd9c1e51d6da4ef4bf8c19860290d8aead5f..8b17c69e1c1cd843b4c121933b81c0c4409416ef 100644
--- a/examples/content_handler_demo/content_handler_demo.cc
+++ b/examples/content_handler_demo/content_handler_demo.cc
@@ -9,19 +9,21 @@
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/application_runner.h"
#include "mojo/public/cpp/application/interface_factory_impl.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/services/content_handler/public/interfaces/content_handler.mojom.h"
namespace mojo {
namespace examples {
-class PrintBodyApplication : public InterfaceImpl<Application> {
+class PrintBodyApplication : public Application {
public:
- PrintBodyApplication(ShellPtr shell, ScopedDataPipeConsumerHandle body)
- : shell_(shell.Pass()), body_(body.Pass()) {
- shell_.set_client(this);
- }
+ PrintBodyApplication(InterfaceRequest<Application> request,
+ ScopedDataPipeConsumerHandle body)
+ : binding_(this, request.Pass()), body_(body.Pass()) {}
- virtual void Initialize(Array<String> args) override {}
+ virtual void Initialize(ShellPtr shell, Array<String> args) override {
+ shell_ = shell.Pass();
+ }
virtual void RequestQuit() override {}
virtual void AcceptConnection(const String& requestor_url,
@@ -58,6 +60,7 @@ class PrintBodyApplication : public InterfaceImpl<Application> {
}
}
+ StrongBinding<Application> binding_;
ShellPtr shell_;
ScopedDataPipeConsumerHandle body_;
@@ -70,10 +73,10 @@ class ContentHandlerImpl : public InterfaceImpl<ContentHandler> {
virtual ~ContentHandlerImpl() {}
private:
- virtual void StartApplication(ShellPtr shell,
+ virtual void StartApplication(InterfaceRequest<Application> application,
URLResponsePtr response) override {
// The application will delete itself after being connected to.
- new PrintBodyApplication(shell.Pass(), response->body.Pass());
+ new PrintBodyApplication(application.Pass(), response->body.Pass());
}
};
« no previous file with comments | « no previous file | examples/pdf_viewer/pdf_viewer.cc » ('j') | mojo/public/cpp/application/application_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698