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

Unified Diff: mojo/application/content_handler.h

Issue 688693004: alternate shape for content handler boilerplate (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 80 cols Created 6 years, 2 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 | « examples/pdf_viewer/pdf_viewer.cc ('k') | mojo/application/content_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/application/content_handler.h
diff --git a/mojo/application/content_handler.h b/mojo/application/content_handler.h
index 97210b87ed3e7a0695e93b448fd32eb073d83fb6..ec99a03ff76527db7d2b6ece116b4ba3dda92c1f 100644
--- a/mojo/application/content_handler.h
+++ b/mojo/application/content_handler.h
@@ -5,44 +5,36 @@
#ifndef MOJO_APPLICATION_CONTENT_HANDLER_H_
#define MOJO_APPLICATION_CONTENT_HANDLER_H_
-#include "base/callback.h"
#include "mojo/public/c/system/core.h"
#include "mojo/public/cpp/application/application_delegate.h"
+#include "mojo/public/cpp/application/interface_factory.h"
+#include "mojo/public/cpp/bindings/callback.h"
#include "mojo/public/interfaces/application/application.mojom.h"
#include "mojo/public/interfaces/application/shell.mojom.h"
+#include "mojo/services/public/interfaces/content_handler/content_handler.mojom.h"
#include "mojo/services/public/interfaces/network/url_loader.mojom.h"
namespace mojo {
-class ContentHandlerDelegate : public ApplicationDelegate {
+class ContentHandlerFactory : public InterfaceFactory<ContentHandler> {
public:
- ContentHandlerDelegate() {}
- // Implement this method to create the ApplicationDelegate for the given
- // content. The application will be run on its own thread.
- virtual scoped_ptr<mojo::InterfaceImpl<mojo::Application>> CreateApplication(
- ShellPtr shell,
- URLResponsePtr response) = 0;
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+ virtual ApplicationDelegate* CreateApplication(URLResponsePtr response) = 0;
+ };
- private:
- DISALLOW_COPY_AND_ASSIGN(ContentHandlerDelegate);
-};
+ ContentHandlerFactory(Delegate* delegate);
+ virtual ~ContentHandlerFactory();
-// A utility for running a chromium based mojo Application that expose a content
-// handler. The typical use case is to use when writing your MojoMain:
-//
-// MojoResult MojoMain(MojoHandle shell_handle) {
-// return mojo::ContentHandlerRunner::Run(shell_handle,
-// make_scoped_ptr(new MyDelegate));
-// }
-class ContentHandlerRunner {
- public:
- static MojoResult Run(MojoHandle shell_handle,
- scoped_ptr<ContentHandlerDelegate> delegate);
+ virtual void Create(ApplicationConnection* connection,
+ InterfaceRequest<ContentHandler> request) override;
private:
- ContentHandlerRunner() {}
+ Delegate* delegate_;
};
+
} // namespace mojo
#endif // MOJO_APPLICATION_CONTENT_HANDLER_H_
« no previous file with comments | « examples/pdf_viewer/pdf_viewer.cc ('k') | mojo/application/content_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698