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