Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #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
| |
| 6 #define MOJO_APPS_JS_CONTENT_HANDLER_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | |
| 11 #include "mojo/public/cpp/application/interface_factory_impl.h" | |
| 12 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h" | |
| 13 | |
| 14 namespace mojo { | |
| 15 | |
| 16 class ApplcationImpl; | |
| 17 | |
| 18 namespace apps { | |
| 19 | |
| 20 class ApplicationDelegateImpl; | |
| 21 class JSApp; | |
| 22 | |
| 23 class ContentHandlerImpl : public InterfaceImpl<ContentHandler> { | |
| 24 public: | |
| 25 ContentHandlerImpl(ApplicationDelegateImpl* content_handler); | |
| 26 virtual ~ContentHandlerImpl(); | |
| 27 | |
| 28 private: | |
| 29 virtual void OnConnect(const mojo::String& url, | |
| 30 URLResponsePtr content, | |
| 31 InterfaceRequest<ServiceProvider> service_provider) | |
| 32 MOJO_OVERRIDE; | |
| 33 | |
| 34 ApplicationDelegateImpl* content_handler_; | |
| 35 }; | |
| 36 | |
| 37 class ApplicationDelegateImpl : public ApplicationDelegate { | |
| 38 public: | |
| 39 ApplicationDelegateImpl(); | |
| 40 virtual ~ApplicationDelegateImpl(); | |
| 41 | |
| 42 void StartJSApp(const std::string& url, URLResponsePtr content); | |
| 43 void QuitJSApp(JSApp* app); | |
| 44 | |
| 45 void ConnectToService(ScopedMessagePipeHandle pipe_handle, | |
| 46 const std::string& application_url, | |
| 47 const std::string& interface_name); | |
| 48 | |
| 49 private: | |
| 50 typedef std::vector<scoped_ptr<JSApp> > AppVector; | |
| 51 | |
| 52 // ApplicationDelegate methods | |
| 53 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE; | |
| 54 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) | |
| 55 MOJO_OVERRIDE; | |
| 56 | |
| 57 ApplicationImpl* application_impl_; | |
| 58 InterfaceFactoryImplWithContext<ContentHandlerImpl, ApplicationDelegateImpl> | |
| 59 content_handler_factory_; | |
| 60 AppVector app_vector_; | |
| 61 }; | |
| 62 | |
| 63 } // namespace apps | |
| 64 } // namespace mojo | |
| 65 | |
| 66 #endif // MOJO_APPS_JS_CONTENT_HANDLER_H_ | |
| OLD | NEW |