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 COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_OOPIF_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_OOPIF_H_ |
6 #define COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_OOPIF_H_ | 6 #define COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_OOPIF_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/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "components/html_viewer/ax_provider_impl.h" | 14 #include "components/html_viewer/ax_provider_impl.h" |
15 #include "components/html_viewer/frame_tree_manager_delegate.h" | 15 #include "components/html_viewer/html_frame_tree_manager_delegate.h" |
16 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" | 16 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" |
17 #include "components/view_manager/public/cpp/view_manager_client_factory.h" | 17 #include "components/view_manager/public/cpp/view_manager_client_factory.h" |
18 #include "components/view_manager/public/cpp/view_manager_delegate.h" | 18 #include "components/view_manager/public/cpp/view_manager_delegate.h" |
19 #include "components/view_manager/public/cpp/view_observer.h" | 19 #include "components/view_manager/public/cpp/view_observer.h" |
20 #include "mandoline/tab/public/interfaces/frame_tree.mojom.h" | 20 #include "mandoline/tab/public/interfaces/frame_tree.mojom.h" |
21 #include "mojo/application/public/cpp/app_lifetime_helper.h" | 21 #include "mojo/application/public/cpp/app_lifetime_helper.h" |
22 #include "mojo/application/public/cpp/interface_factory.h" | 22 #include "mojo/application/public/cpp/interface_factory.h" |
23 #include "mojo/application/public/cpp/service_provider_impl.h" | 23 #include "mojo/application/public/cpp/service_provider_impl.h" |
24 #include "mojo/application/public/interfaces/application.mojom.h" | 24 #include "mojo/application/public/interfaces/application.mojom.h" |
25 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 25 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
26 | 26 |
27 namespace base { | 27 namespace base { |
28 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
29 } | 29 } |
30 | 30 |
31 namespace mojo { | 31 namespace mojo { |
32 class ViewManager; | 32 class ViewManager; |
33 class View; | 33 class View; |
34 } | 34 } |
35 | 35 |
36 namespace html_viewer { | 36 namespace html_viewer { |
37 | 37 |
38 class AxProviderImpl; | 38 class AxProviderImpl; |
39 class DevToolsAgentImpl; | 39 class DevToolsAgentImpl; |
40 class DocumentResourceWaiter; | 40 class DocumentResourceWaiter; |
41 class Frame; | |
42 class FrameTreeManager; | |
43 class GlobalState; | 41 class GlobalState; |
| 42 class HTMLFrameTreeManager; |
44 class TestHTMLViewerImpl; | 43 class TestHTMLViewerImpl; |
45 class WebLayerTreeViewImpl; | 44 class WebLayerTreeViewImpl; |
46 | 45 |
47 // A view for a single HTML document. | 46 // A view for a single HTML document. |
48 // | 47 // |
49 // HTMLDocument is deleted in one of two ways: | 48 // HTMLDocument is deleted in one of two ways: |
50 // . When the View the HTMLDocument is embedded in is destroyed. | 49 // . When the View the HTMLDocument is embedded in is destroyed. |
51 // . Explicitly by way of Destroy(). | 50 // . Explicitly by way of Destroy(). |
52 class HTMLDocumentOOPIF | 51 class HTMLDocumentOOPIF |
53 : public mojo::ViewManagerDelegate, | 52 : public mojo::ViewManagerDelegate, |
54 public mojo::ViewObserver, | 53 public mojo::ViewObserver, |
55 public FrameTreeManagerDelegate, | 54 public HTMLFrameTreeManagerDelegate, |
56 public mojo::InterfaceFactory<mojo::AxProvider>, | 55 public mojo::InterfaceFactory<mojo::AxProvider>, |
57 public mojo::InterfaceFactory<mandoline::FrameTreeClient>, | 56 public mojo::InterfaceFactory<mandoline::FrameTreeClient>, |
58 public mojo::InterfaceFactory<TestHTMLViewer> { | 57 public mojo::InterfaceFactory<TestHTMLViewer> { |
59 public: | 58 public: |
60 using DeleteCallback = base::Callback<void(HTMLDocumentOOPIF*)>; | 59 using DeleteCallback = base::Callback<void(HTMLDocumentOOPIF*)>; |
61 | 60 |
62 // Load a new HTMLDocument with |response|. | 61 // Load a new HTMLDocument with |response|. |
63 // |html_document_app| is the application this app was created in, and | 62 // |html_document_app| is the application this app was created in, and |
64 // |connection| the specific connection triggering this new instance. | 63 // |connection| the specific connection triggering this new instance. |
65 // |setup| is used to obtain init type state (such as resources). | 64 // |setup| is used to obtain init type state (such as resources). |
(...skipping 30 matching lines...) Expand all Loading... |
96 void OnEmbed(mojo::View* root) override; | 95 void OnEmbed(mojo::View* root) override; |
97 void OnViewManagerDestroyed(mojo::ViewManager* view_manager) override; | 96 void OnViewManagerDestroyed(mojo::ViewManager* view_manager) override; |
98 | 97 |
99 // ViewObserver: | 98 // ViewObserver: |
100 void OnViewViewportMetricsChanged( | 99 void OnViewViewportMetricsChanged( |
101 mojo::View* view, | 100 mojo::View* view, |
102 const mojo::ViewportMetrics& old_metrics, | 101 const mojo::ViewportMetrics& old_metrics, |
103 const mojo::ViewportMetrics& new_metrics) override; | 102 const mojo::ViewportMetrics& new_metrics) override; |
104 void OnViewDestroyed(mojo::View* view) override; | 103 void OnViewDestroyed(mojo::View* view) override; |
105 | 104 |
106 // FrameTreeManagerDelegate: | 105 // HTMLFrameTreeManagerDelegate: |
107 bool ShouldNavigateLocallyInMainFrame() override; | 106 bool ShouldNavigateLocallyInMainFrame() override; |
108 void OnFrameDidFinishLoad(Frame* frame) override; | 107 void OnFrameDidFinishLoad(HTMLFrame* frame) override; |
109 | 108 |
110 // mojo::InterfaceFactory<mojo::AxProvider>: | 109 // mojo::InterfaceFactory<mojo::AxProvider>: |
111 void Create(mojo::ApplicationConnection* connection, | 110 void Create(mojo::ApplicationConnection* connection, |
112 mojo::InterfaceRequest<mojo::AxProvider> request) override; | 111 mojo::InterfaceRequest<mojo::AxProvider> request) override; |
113 | 112 |
114 // mojo::InterfaceFactory<mandoline::FrameTreeClient>: | 113 // mojo::InterfaceFactory<mandoline::FrameTreeClient>: |
115 void Create( | 114 void Create( |
116 mojo::ApplicationConnection* connection, | 115 mojo::ApplicationConnection* connection, |
117 mojo::InterfaceRequest<mandoline::FrameTreeClient> request) override; | 116 mojo::InterfaceRequest<mandoline::FrameTreeClient> request) override; |
118 | 117 |
119 // mojo::InterfaceFactory<TestHTMLViewer>: | 118 // mojo::InterfaceFactory<TestHTMLViewer>: |
120 void Create(mojo::ApplicationConnection* connection, | 119 void Create(mojo::ApplicationConnection* connection, |
121 mojo::InterfaceRequest<TestHTMLViewer> request) override; | 120 mojo::InterfaceRequest<TestHTMLViewer> request) override; |
122 | 121 |
123 scoped_ptr<mojo::AppRefCount> app_refcount_; | 122 scoped_ptr<mojo::AppRefCount> app_refcount_; |
124 mojo::ApplicationImpl* html_document_app_; | 123 mojo::ApplicationImpl* html_document_app_; |
125 mojo::ApplicationConnection* connection_; | 124 mojo::ApplicationConnection* connection_; |
126 mojo::ViewManagerClientFactory view_manager_client_factory_; | 125 mojo::ViewManagerClientFactory view_manager_client_factory_; |
127 | 126 |
128 // HTMLDocument owns these pointers; binding requests after document load. | 127 // HTMLDocument owns these pointers; binding requests after document load. |
129 std::set<AxProviderImpl*> ax_providers_; | 128 std::set<AxProviderImpl*> ax_providers_; |
130 | 129 |
131 ScopedVector<TestHTMLViewerImpl> test_html_viewers_; | 130 ScopedVector<TestHTMLViewerImpl> test_html_viewers_; |
132 | 131 |
133 // Set to true when the local frame has finished loading. | 132 // Set to true when the local frame has finished loading. |
134 bool did_finish_local_frame_load_ = false; | 133 bool did_finish_local_frame_load_ = false; |
135 | 134 |
136 GlobalState* global_state_; | 135 GlobalState* global_state_; |
137 | 136 |
138 scoped_ptr<FrameTreeManager> frame_tree_manager_; | 137 scoped_ptr<HTMLFrameTreeManager> frame_tree_manager_; |
139 scoped_ptr<mojo::Binding<mandoline::FrameTreeClient>> | 138 scoped_ptr<mojo::Binding<mandoline::FrameTreeClient>> |
140 frame_tree_manager_binding_; | 139 frame_tree_manager_binding_; |
141 | 140 |
142 scoped_ptr<DevToolsAgentImpl> devtools_agent_; | 141 scoped_ptr<DevToolsAgentImpl> devtools_agent_; |
143 | 142 |
144 scoped_ptr<DocumentResourceWaiter> resource_waiter_; | 143 scoped_ptr<DocumentResourceWaiter> resource_waiter_; |
145 | 144 |
146 scoped_ptr<BeforeLoadCache> before_load_cache_; | 145 scoped_ptr<BeforeLoadCache> before_load_cache_; |
147 | 146 |
148 DeleteCallback delete_callback_; | 147 DeleteCallback delete_callback_; |
149 | 148 |
150 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentOOPIF); | 149 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentOOPIF); |
151 }; | 150 }; |
152 | 151 |
153 } // namespace html_viewer | 152 } // namespace html_viewer |
154 | 153 |
155 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_OOPIF_H_ | 154 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_OOPIF_H_ |
OLD | NEW |