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

Unified Diff: mojo/apps/js/content_handler_main.cc

Issue 687273002: mojo: Update content handler API (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rename content_handler.h 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
Index: mojo/apps/js/content_handler_main.cc
diff --git a/mojo/apps/js/content_handler_main.cc b/mojo/apps/js/content_handler_main.cc
index 6c6a0a8414c6eebf87c5253876f4549ee69859a8..1e5b5a3d4876d52e225e2ea76991bca5df84eb93 100644
--- a/mojo/apps/js/content_handler_main.cc
+++ b/mojo/apps/js/content_handler_main.cc
@@ -2,44 +2,54 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
#include "base/i18n/icu_util.h"
+#include "gin/array_buffer.h"
+#include "gin/public/isolate_holder.h"
#include "mojo/application/application_runner_chromium.h"
-#include "mojo/apps/js/application_delegate_impl.h"
-#include "mojo/apps/js/content_handler_impl.h"
+#include "mojo/application/content_handler_factory.h"
+#include "mojo/apps/js/js_app.h"
#include "mojo/public/c/system/main.h"
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/interface_factory_impl.h"
-#include "mojo/services/public/interfaces/content_handler/content_handler.mojom.h"
namespace mojo {
namespace apps {
-class ContentHandlerApplicationDelegateImpl : public ApplicationDelegateImpl {
+class JsContentHandler : public ApplicationDelegate,
+ public ContentHandlerFactory::Delegate {
public:
- ContentHandlerApplicationDelegateImpl() : content_handler_factory_(this) {
- }
+ JsContentHandler() : content_handler_factory_(this) {}
private:
+ // Overridden from ApplicationDelegate:
void Initialize(ApplicationImpl* app) override {
base::i18n::InitializeICU();
- ApplicationDelegateImpl::Initialize(app);
+ gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
+ gin::ArrayBufferAllocator::SharedInstance());
}
- bool ConfigureIncomingConnection(ApplicationConnection* connection) override {
+ // Overridden from ApplicationDelegate:
+ virtual bool ConfigureIncomingConnection(
hansmuller 2014/10/31 16:14:44 Is the virtual keyword needed here? Likewise most
qsr 2014/10/31 16:31:36 Done.
+ ApplicationConnection* connection) override {
connection->AddService(&content_handler_factory_);
return true;
}
- InterfaceFactoryImplWithContext<ContentHandlerImpl, ApplicationDelegateImpl>
- content_handler_factory_;
+ // Overridden from ContentHandlerFactory::Delegate:
+ virtual scoped_ptr<ContentHandlerFactory::HandledApplicationHolder>
+ CreateApplication(ShellPtr shell, URLResponsePtr response) override {
+ return make_scoped_ptr(new JSApp(shell.Pass(), response.Pass()));
+ }
+
+ ContentHandlerFactory content_handler_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(JsContentHandler);
};
} // namespace apps
} // namespace mojo
MojoResult MojoMain(MojoHandle shell_handle) {
- mojo::ApplicationRunnerChromium runner(
- new mojo::apps::ContentHandlerApplicationDelegateImpl());
+ mojo::ApplicationRunnerChromium runner(new mojo::apps::JsContentHandler);
return runner.Run(shell_handle);
}

Powered by Google App Engine
This is Rietveld 408576698