| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_SHELL_PUBLIC_CPP_CONTENT_HANDLER_FACTORY_H_ | 5 #ifndef MOJO_SHELL_PUBLIC_CPP_CONTENT_HANDLER_FACTORY_H_ |
| 6 #define MOJO_SHELL_PUBLIC_CPP_CONTENT_HANDLER_FACTORY_H_ | 6 #define MOJO_SHELL_PUBLIC_CPP_CONTENT_HANDLER_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 10 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 public: | 21 public: |
| 22 virtual ~HandledApplicationHolder() {} | 22 virtual ~HandledApplicationHolder() {} |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 class Delegate { | 25 class Delegate { |
| 26 public: | 26 public: |
| 27 virtual ~Delegate() {} | 27 virtual ~Delegate() {} |
| 28 // Implement this method to create the Application. This method will be | 28 // Implement this method to create the Application. This method will be |
| 29 // called on a new thread. Leaving this method will quit the application. | 29 // called on a new thread. Leaving this method will quit the application. |
| 30 virtual void RunApplication( | 30 virtual void RunApplication( |
| 31 InterfaceRequest<shell::mojom::Application> application_request, | 31 InterfaceRequest<shell::mojom::ShellClient> request, |
| 32 URLResponsePtr response) = 0; | 32 URLResponsePtr response) = 0; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class ManagedDelegate : public Delegate { | 35 class ManagedDelegate : public Delegate { |
| 36 public: | 36 public: |
| 37 ~ManagedDelegate() override {} | 37 ~ManagedDelegate() override {} |
| 38 // Implement this method to create the Application for the given content. | 38 // Implement this method to create the Application for the given content. |
| 39 // This method will be called on a new thread. The application will be run | 39 // This method will be called on a new thread. The application will be run |
| 40 // on this new thread, and the returned value will be kept alive until the | 40 // on this new thread, and the returned value will be kept alive until the |
| 41 // application ends. | 41 // application ends. |
| 42 virtual scoped_ptr<HandledApplicationHolder> CreateApplication( | 42 virtual scoped_ptr<HandledApplicationHolder> CreateApplication( |
| 43 InterfaceRequest<shell::mojom::Application> application_request, | 43 InterfaceRequest<shell::mojom::ShellClient> request, |
| 44 URLResponsePtr response) = 0; | 44 URLResponsePtr response) = 0; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 void RunApplication( | 47 void RunApplication(InterfaceRequest<shell::mojom::ShellClient> request, |
| 48 InterfaceRequest<shell::mojom::Application> application_request, | 48 URLResponsePtr response) override; |
| 49 URLResponsePtr response) override; | |
| 50 }; | 49 }; |
| 51 | 50 |
| 52 explicit ContentHandlerFactory(Delegate* delegate); | 51 explicit ContentHandlerFactory(Delegate* delegate); |
| 53 ~ContentHandlerFactory() override; | 52 ~ContentHandlerFactory() override; |
| 54 | 53 |
| 55 private: | 54 private: |
| 56 // From InterfaceFactory: | 55 // From InterfaceFactory: |
| 57 void Create(Connection* connection, | 56 void Create(Connection* connection, |
| 58 InterfaceRequest<shell::mojom::ContentHandler> request) override; | 57 InterfaceRequest<shell::mojom::ContentHandler> request) override; |
| 59 | 58 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 74 | 73 |
| 75 template <class A> | 74 template <class A> |
| 76 scoped_ptr<ContentHandlerFactory::HandledApplicationHolder> | 75 scoped_ptr<ContentHandlerFactory::HandledApplicationHolder> |
| 77 make_handled_factory_holder(A* value) { | 76 make_handled_factory_holder(A* value) { |
| 78 return make_scoped_ptr(new HandledApplicationHolderImpl<A>(value)); | 77 return make_scoped_ptr(new HandledApplicationHolderImpl<A>(value)); |
| 79 } | 78 } |
| 80 | 79 |
| 81 } // namespace mojo | 80 } // namespace mojo |
| 82 | 81 |
| 83 #endif // MOJO_SHELL_PUBLIC_CPP_CONTENT_HANDLER_FACTORY_H_ | 82 #endif // MOJO_SHELL_PUBLIC_CPP_CONTENT_HANDLER_FACTORY_H_ |
| OLD | NEW |