Index: mojo/apps/js/application_delegate_impl.h |
diff --git a/mojo/apps/js/application_delegate_impl.h b/mojo/apps/js/application_delegate_impl.h |
index fc2500b690b24ad11c35e6a32f11980ab71082e1..01ff1ac91ef4464b08280c32ba0c17763a60011b 100644 |
--- a/mojo/apps/js/application_delegate_impl.h |
+++ b/mojo/apps/js/application_delegate_impl.h |
@@ -5,11 +5,10 @@ |
#ifndef MOJO_APPS_JS_CONTENT_HANDLER_H_ |
#define MOJO_APPS_JS_CONTENT_HANDLER_H_ |
-#include "base/memory/ref_counted.h" |
+#include "base/files/file_util.h" |
Aaron Boodman
2014/10/01 04:25:44
I don't think this is used by this file.
hansmuller
2014/10/01 15:40:12
Done.
|
#include "base/memory/scoped_vector.h" |
+#include "mojo/apps/js/content_handler_impl.h" |
Aaron Boodman
2014/10/01 04:25:44
I don't think this is used.
hansmuller
2014/10/01 15:40:12
Done.
|
#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 { |
@@ -20,49 +19,35 @@ namespace apps { |
class ApplicationDelegateImpl; |
class JSApp; |
-// Starts a new JSApp for each OnConnect call(). |
- |
-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) override; |
- |
- ApplicationDelegateImpl* content_handler_; |
-}; |
- |
// Manages the JSApps started by this content handler. This class owns the one |
// reference to the Mojo shell. JSApps post a task to the content handler's |
-// thread to connect to a service or to quit.l |
+// thread to connect to a service or to quit. |
+// |
+// The lifetime each JSApp is defined by its entry in AppVector. When the entry |
+// is removed ("erased") by QuitJSApp(), the JSApp is destroyed. |
class ApplicationDelegateImpl : public ApplicationDelegate { |
public: |
ApplicationDelegateImpl(); |
virtual ~ApplicationDelegateImpl(); |
- void StartJSApp(const std::string& url, URLResponsePtr content); |
- void QuitJSApp(JSApp* app); |
+ // Add app to the AppVector and call its Start() method. |
+ void StartJSApp(scoped_ptr<JSApp> app); |
+ |
+ // Remove app from the AppVector; destroys the app. |
+ void QuitJSApp(JSApp *app); |
void ConnectToService(ScopedMessagePipeHandle pipe_handle, |
const std::string& application_url, |
const std::string& interface_name); |
- private: |
- typedef ScopedVector<JSApp> AppVector; |
- |
- // ApplicationDelegate methods |
+ protected: |
+ // ApplicationDelegate method |
Aaron Boodman
2014/10/01 04:25:44
You can just say:
// ApplicationDelegate:
so tha
hansmuller
2014/10/01 15:40:12
Done.
|
virtual void Initialize(ApplicationImpl* app) override; |
- virtual bool ConfigureIncomingConnection( |
- ApplicationConnection* connection) override; |
+ private: |
+ typedef ScopedVector<JSApp> AppVector; |
ApplicationImpl* application_impl_; |
- InterfaceFactoryImplWithContext<ContentHandlerImpl, ApplicationDelegateImpl> |
- content_handler_factory_; |
AppVector app_vector_; |
}; |