Chromium Code Reviews| 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_ |