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

Unified Diff: mojo/apps/js/content_handler.h

Issue 467263006: JavaScript Content Handler Version 0.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes per review feedback. Created 6 years, 3 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.h
diff --git a/mojo/apps/js/content_handler.h b/mojo/apps/js/content_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..a9a34226785afd92e0c7a9dd6b3ce0c03f849149
--- /dev/null
+++ b/mojo/apps/js/content_handler.h
@@ -0,0 +1,66 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_APPS_JS_CONTENT_HANDLER_H_
Aaron Boodman 2014/09/11 05:24:53 I think this file should be called application_del
hansmuller 2014/09/11 16:44:44 I've renamed the file and will split out ContentHa
+#define MOJO_APPS_JS_CONTENT_HANDLER_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "mojo/public/cpp/application/application_delegate.h"
+#include "mojo/public/cpp/application/interface_factory_impl.h"
+#include "mojo/services/public/interfaces/content_handler/content_handler.mojom.h"
+
+namespace mojo {
+
+class ApplcationImpl;
+
+namespace apps {
+
+class ApplicationDelegateImpl;
+class JSApp;
+
+class ContentHandlerImpl : public InterfaceImpl<ContentHandler> {
+ public:
+ ContentHandlerImpl(ApplicationDelegateImpl* content_handler);
+ virtual ~ContentHandlerImpl();
+
+ private:
+ virtual void OnConnect(const mojo::String& url,
+ URLResponsePtr content,
+ InterfaceRequest<ServiceProvider> service_provider)
+ MOJO_OVERRIDE;
+
+ ApplicationDelegateImpl* content_handler_;
+};
+
+class ApplicationDelegateImpl : public ApplicationDelegate {
+ public:
+ ApplicationDelegateImpl();
+ virtual ~ApplicationDelegateImpl();
+
+ void StartJSApp(const std::string& url, URLResponsePtr content);
+ void QuitJSApp(JSApp* app);
+
+ void ConnectToService(ScopedMessagePipeHandle pipe_handle,
+ const std::string& application_url,
+ const std::string& interface_name);
+
+ private:
+ typedef std::vector<scoped_ptr<JSApp> > AppVector;
+
+ // ApplicationDelegate methods
+ virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE;
+ virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
+ MOJO_OVERRIDE;
+
+ ApplicationImpl* application_impl_;
+ InterfaceFactoryImplWithContext<ContentHandlerImpl, ApplicationDelegateImpl>
+ content_handler_factory_;
+ AppVector app_vector_;
+};
+
+} // namespace apps
+} // namespace mojo
+
+#endif // MOJO_APPS_JS_CONTENT_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698