OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ |
6 #define COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ | 6 #define COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "components/html_viewer/html_document.h" | 14 #include "components/html_viewer/html_document.h" |
15 #include "mojo/application/public/cpp/application_delegate.h" | 15 #include "mojo/application/public/cpp/application_delegate.h" |
16 #include "mojo/application/public/cpp/application_impl.h" | 16 #include "mojo/application/public/cpp/application_impl.h" |
17 #include "mojo/services/network/public/interfaces/network_service.mojom.h" | |
18 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" | 17 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" |
19 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | 18 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" |
20 | 19 |
21 namespace html_viewer { | 20 namespace html_viewer { |
22 | 21 |
23 class GlobalState; | 22 class GlobalState; |
24 class HTMLDocumentOOPIF; | 23 class HTMLDocumentOOPIF; |
25 | 24 |
26 // ApplicationDelegate created by the content handler for a specific url. | 25 // ApplicationDelegate created by the content handler for a specific url. |
27 class HTMLDocumentApplicationDelegate : public mojo::ApplicationDelegate { | 26 class HTMLDocumentApplicationDelegate : public mojo::ApplicationDelegate { |
(...skipping 30 matching lines...) Expand all Loading... |
58 void OnHTMLDocumentDeleted2(HTMLDocumentOOPIF* document); | 57 void OnHTMLDocumentDeleted2(HTMLDocumentOOPIF* document); |
59 void OnResponseReceived(mojo::URLLoaderPtr loader, | 58 void OnResponseReceived(mojo::URLLoaderPtr loader, |
60 mojo::ApplicationConnection* connection, | 59 mojo::ApplicationConnection* connection, |
61 scoped_ptr<ServiceConnectorQueue> connector_queue, | 60 scoped_ptr<ServiceConnectorQueue> connector_queue, |
62 mojo::URLResponsePtr response); | 61 mojo::URLResponsePtr response); |
63 | 62 |
64 mojo::ApplicationImpl app_; | 63 mojo::ApplicationImpl app_; |
65 // AppRefCount of the parent (HTMLViewer). | 64 // AppRefCount of the parent (HTMLViewer). |
66 scoped_ptr<mojo::AppRefCount> parent_app_refcount_; | 65 scoped_ptr<mojo::AppRefCount> parent_app_refcount_; |
67 const mojo::String url_; | 66 const mojo::String url_; |
68 mojo::NetworkServicePtr network_service_; | |
69 mojo::URLLoaderFactoryPtr url_loader_factory_; | 67 mojo::URLLoaderFactoryPtr url_loader_factory_; |
70 mojo::URLResponsePtr initial_response_; | 68 mojo::URLResponsePtr initial_response_; |
71 GlobalState* global_state_; | 69 GlobalState* global_state_; |
72 | 70 |
73 // As we create HTMLDocuments they are added here. They are removed when the | 71 // As we create HTMLDocuments they are added here. They are removed when the |
74 // HTMLDocument is deleted. | 72 // HTMLDocument is deleted. |
75 std::set<HTMLDocument*> documents_; | 73 std::set<HTMLDocument*> documents_; |
76 | 74 |
77 // As we create HTMLDocuments they are added here. They are removed when the | 75 // As we create HTMLDocuments they are added here. They are removed when the |
78 // HTMLDocument is deleted. | 76 // HTMLDocument is deleted. |
79 std::set<HTMLDocumentOOPIF*> documents2_; | 77 std::set<HTMLDocumentOOPIF*> documents2_; |
80 | 78 |
81 HTMLDocumentCreationCallback html_document_creation_callback_; | 79 HTMLDocumentCreationCallback html_document_creation_callback_; |
82 | 80 |
83 base::WeakPtrFactory<HTMLDocumentApplicationDelegate> weak_factory_; | 81 base::WeakPtrFactory<HTMLDocumentApplicationDelegate> weak_factory_; |
84 | 82 |
85 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentApplicationDelegate); | 83 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentApplicationDelegate); |
86 }; | 84 }; |
87 | 85 |
88 } // namespace html_viewer | 86 } // namespace html_viewer |
89 | 87 |
90 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ | 88 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ |
OLD | NEW |