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_APPLICATION_CONTENT_HANDLER_FACTORY_H_ | 5 #ifndef MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_ |
6 #define MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_ | 6 #define MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "mojo/public/cpp/application/interface_factory.h" | 9 #include "mojo/public/cpp/application/interface_factory.h" |
10 #include "mojo/public/interfaces/application/shell.mojom.h" | 10 #include "mojo/public/interfaces/application/shell.mojom.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 virtual ~Delegate() {} | 25 virtual ~Delegate() {} |
26 // Implement this method to create the Application. This method will be | 26 // Implement this method to create the Application. This method will be |
27 // called on a new thread. Leaving this method will quit the application. | 27 // called on a new thread. Leaving this method will quit the application. |
28 virtual void RunApplication( | 28 virtual void RunApplication( |
29 InterfaceRequest<Application> application_request, | 29 InterfaceRequest<Application> application_request, |
30 URLResponsePtr response) = 0; | 30 URLResponsePtr response) = 0; |
31 }; | 31 }; |
32 | 32 |
33 class ManagedDelegate : public Delegate { | 33 class ManagedDelegate : public Delegate { |
34 public: | 34 public: |
35 virtual ~ManagedDelegate() {} | 35 ~ManagedDelegate() override {} |
36 // Implement this method to create the Application for the given content. | 36 // Implement this method to create the Application for the given content. |
37 // This method will be called on a new thread. The application will be run | 37 // This method will be called on a new thread. The application will be run |
38 // on this new thread, and the returned value will be kept alive until the | 38 // on this new thread, and the returned value will be kept alive until the |
39 // application ends. | 39 // application ends. |
40 virtual scoped_ptr<HandledApplicationHolder> CreateApplication( | 40 virtual scoped_ptr<HandledApplicationHolder> CreateApplication( |
41 InterfaceRequest<Application> application_request, | 41 InterfaceRequest<Application> application_request, |
42 URLResponsePtr response) = 0; | 42 URLResponsePtr response) = 0; |
43 | 43 |
44 private: | 44 private: |
45 void RunApplication(InterfaceRequest<Application> application_request, | 45 void RunApplication(InterfaceRequest<Application> application_request, |
46 URLResponsePtr response) override; | 46 URLResponsePtr response) override; |
47 }; | 47 }; |
48 | 48 |
49 explicit ContentHandlerFactory(Delegate* delegate); | 49 explicit ContentHandlerFactory(Delegate* delegate); |
50 virtual ~ContentHandlerFactory(); | 50 ~ContentHandlerFactory() override; |
51 | 51 |
52 private: | 52 private: |
53 // From InterfaceFactory: | 53 // From InterfaceFactory: |
54 void Create(ApplicationConnection* connection, | 54 void Create(ApplicationConnection* connection, |
55 InterfaceRequest<ContentHandler> request) override; | 55 InterfaceRequest<ContentHandler> request) override; |
56 | 56 |
57 Delegate* delegate_; | 57 Delegate* delegate_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(ContentHandlerFactory); | 59 DISALLOW_COPY_AND_ASSIGN(ContentHandlerFactory); |
60 }; | 60 }; |
(...skipping 10 matching lines...) Expand all Loading... |
71 | 71 |
72 template <class A> | 72 template <class A> |
73 scoped_ptr<ContentHandlerFactory::HandledApplicationHolder> | 73 scoped_ptr<ContentHandlerFactory::HandledApplicationHolder> |
74 make_handled_factory_holder(A* value) { | 74 make_handled_factory_holder(A* value) { |
75 return make_scoped_ptr(new HandledApplicationHolderImpl<A>(value)); | 75 return make_scoped_ptr(new HandledApplicationHolderImpl<A>(value)); |
76 } | 76 } |
77 | 77 |
78 } // namespace mojo | 78 } // namespace mojo |
79 | 79 |
80 #endif // MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_ | 80 #endif // MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_ |
OLD | NEW |