| 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_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ |
| 6 #define COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ | 6 #define COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_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/devtools_service/public/interfaces/devtools_service.mojom.h
" | 14 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h
" |
| 15 #include "components/html_viewer/ax_provider_impl.h" | 15 #include "components/html_viewer/ax_provider_impl.h" |
| 16 #include "components/html_viewer/html_frame_delegate.h" | 16 #include "components/html_viewer/html_frame_delegate.h" |
| 17 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" | 17 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" |
| 18 #include "components/mus/public/cpp/view_tree_delegate.h" | 18 #include "components/mus/public/cpp/view_tree_delegate.h" |
| 19 #include "components/web_view/public/interfaces/frame_tree.mojom.h" | 19 #include "components/web_view/public/interfaces/frame_tree.mojom.h" |
| 20 #include "mojo/application/public/cpp/app_lifetime_helper.h" | 20 #include "mojo/application/public/cpp/app_lifetime_helper.h" |
| 21 #include "mojo/application/public/cpp/interface_factory.h" | 21 #include "mojo/application/public/cpp/interface_factory.h" |
| 22 #include "mojo/application/public/cpp/service_provider_impl.h" | 22 #include "mojo/application/public/cpp/service_provider_impl.h" |
| 23 #include "mojo/application/public/interfaces/application.mojom.h" | 23 #include "mojo/application/public/interfaces/application.mojom.h" |
| 24 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 24 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 25 | 25 |
| 26 namespace base { | 26 namespace base { |
| 27 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace mus { | 30 namespace mojo { |
| 31 class View; | 31 class View; |
| 32 class ViewTreeConnection; | 32 class ViewTreeConnection; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace html_viewer { | 35 namespace html_viewer { |
| 36 | 36 |
| 37 class AxProviderImpl; | 37 class AxProviderImpl; |
| 38 class DocumentResourceWaiter; | 38 class DocumentResourceWaiter; |
| 39 class GlobalState; | 39 class GlobalState; |
| 40 class HTMLFactory; | 40 class HTMLFactory; |
| 41 class HTMLFrame; | 41 class HTMLFrame; |
| 42 class TestHTMLViewerImpl; | 42 class TestHTMLViewerImpl; |
| 43 class ViewTreeDelegateImpl; | 43 class ViewTreeDelegateImpl; |
| 44 class WebLayerTreeViewImpl; | 44 class WebLayerTreeViewImpl; |
| 45 | 45 |
| 46 // A view for a single HTML document. | 46 // A view for a single HTML document. |
| 47 // | 47 // |
| 48 // HTMLDocument is deleted in one of two ways: | 48 // HTMLDocument is deleted in one of two ways: |
| 49 // . When the View the HTMLDocument is embedded in is destroyed. | 49 // . When the View the HTMLDocument is embedded in is destroyed. |
| 50 // . Explicitly by way of Destroy(). | 50 // . Explicitly by way of Destroy(). |
| 51 class HTMLDocument | 51 class HTMLDocument |
| 52 : public mus::ViewTreeDelegate, | 52 : public mojo::ViewTreeDelegate, |
| 53 public HTMLFrameDelegate, | 53 public HTMLFrameDelegate, |
| 54 public mojo::InterfaceFactory<mojo::AxProvider>, | 54 public mojo::InterfaceFactory<mojo::AxProvider>, |
| 55 public mojo::InterfaceFactory<web_view::FrameTreeClient>, | 55 public mojo::InterfaceFactory<web_view::FrameTreeClient>, |
| 56 public mojo::InterfaceFactory<TestHTMLViewer>, | 56 public mojo::InterfaceFactory<TestHTMLViewer>, |
| 57 public mojo::InterfaceFactory<devtools_service::DevToolsAgent>, | 57 public mojo::InterfaceFactory<devtools_service::DevToolsAgent>, |
| 58 public mojo::InterfaceFactory<mojo::ViewTreeClient> { | 58 public mojo::InterfaceFactory<mojo::ViewTreeClient> { |
| 59 public: | 59 public: |
| 60 using DeleteCallback = base::Callback<void(HTMLDocument*)>; | 60 using DeleteCallback = base::Callback<void(HTMLDocument*)>; |
| 61 | 61 |
| 62 // Load a new HTMLDocument with |response|. | 62 // Load a new HTMLDocument with |response|. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 89 // Any state that needs to be moved when rendering transfers from one frame | 89 // Any state that needs to be moved when rendering transfers from one frame |
| 90 // to another is stored here. | 90 // to another is stored here. |
| 91 struct TransferableState { | 91 struct TransferableState { |
| 92 TransferableState(); | 92 TransferableState(); |
| 93 ~TransferableState(); | 93 ~TransferableState(); |
| 94 | 94 |
| 95 // Takes the state from |other|. | 95 // Takes the state from |other|. |
| 96 void Move(TransferableState* other); | 96 void Move(TransferableState* other); |
| 97 | 97 |
| 98 bool owns_view_tree_connection; | 98 bool owns_view_tree_connection; |
| 99 mus::View* root; | 99 mojo::View* root; |
| 100 scoped_ptr<ViewTreeDelegateImpl> view_tree_delegate_impl; | 100 scoped_ptr<ViewTreeDelegateImpl> view_tree_delegate_impl; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 ~HTMLDocument() override; | 103 ~HTMLDocument() override; |
| 104 | 104 |
| 105 void Load(); | 105 void Load(); |
| 106 | 106 |
| 107 BeforeLoadCache* GetBeforeLoadCache(); | 107 BeforeLoadCache* GetBeforeLoadCache(); |
| 108 | 108 |
| 109 // ViewTreeDelegate: | 109 // ViewTreeDelegate: |
| 110 void OnEmbed(mus::View* root) override; | 110 void OnEmbed(mojo::View* root) override; |
| 111 void OnConnectionLost(mus::ViewTreeConnection* connection) override; | 111 void OnConnectionLost(mojo::ViewTreeConnection* connection) override; |
| 112 | 112 |
| 113 // HTMLFrameDelegate: | 113 // HTMLFrameDelegate: |
| 114 mojo::ApplicationImpl* GetApp() override; | 114 mojo::ApplicationImpl* GetApp() override; |
| 115 HTMLFactory* GetHTMLFactory() override; | 115 HTMLFactory* GetHTMLFactory() override; |
| 116 void OnFrameDidFinishLoad() override; | 116 void OnFrameDidFinishLoad() override; |
| 117 void OnFrameSwappedToRemote() override; | 117 void OnFrameSwappedToRemote() override; |
| 118 void OnSwap(HTMLFrame* frame, HTMLFrameDelegate* old_delegate) override; | 118 void OnSwap(HTMLFrame* frame, HTMLFrameDelegate* old_delegate) override; |
| 119 void OnFrameDestroyed() override; | 119 void OnFrameDestroyed() override; |
| 120 | 120 |
| 121 // mojo::InterfaceFactory<mojo::AxProvider>: | 121 // mojo::InterfaceFactory<mojo::AxProvider>: |
| 122 void Create(mojo::ApplicationConnection* connection, | 122 void Create(mojo::ApplicationConnection* connection, |
| 123 mojo::InterfaceRequest<mojo::AxProvider> request) override; | 123 mojo::InterfaceRequest<mojo::AxProvider> request) override; |
| 124 | 124 |
| 125 // mojo::InterfaceFactory<web_view::FrameTreeClient>: | 125 // mojo::InterfaceFactory<web_view::FrameTreeClient>: |
| 126 void Create( | 126 void Create( |
| 127 mojo::ApplicationConnection* connection, | 127 mojo::ApplicationConnection* connection, |
| 128 mojo::InterfaceRequest<web_view::FrameTreeClient> request) override; | 128 mojo::InterfaceRequest<web_view::FrameTreeClient> request) override; |
| 129 | 129 |
| 130 // mojo::InterfaceFactory<TestHTMLViewer>: | 130 // mojo::InterfaceFactory<TestHTMLViewer>: |
| 131 void Create(mojo::ApplicationConnection* connection, | 131 void Create(mojo::ApplicationConnection* connection, |
| 132 mojo::InterfaceRequest<TestHTMLViewer> request) override; | 132 mojo::InterfaceRequest<TestHTMLViewer> request) override; |
| 133 | 133 |
| 134 // mojo::InterfaceFactory<devtools_service::DevToolsAgent>: | 134 // mojo::InterfaceFactory<devtools_service::DevToolsAgent>: |
| 135 void Create( | 135 void Create( |
| 136 mojo::ApplicationConnection* connection, | 136 mojo::ApplicationConnection* connection, |
| 137 mojo::InterfaceRequest<devtools_service::DevToolsAgent> request) override; | 137 mojo::InterfaceRequest<devtools_service::DevToolsAgent> request) override; |
| 138 | 138 |
| 139 // mojo::InterfaceFactory<mus::ViewTreeClient>: | 139 // mojo::InterfaceFactory<mojo::ViewTreeClient>: |
| 140 void Create(mojo::ApplicationConnection* connection, | 140 void Create(mojo::ApplicationConnection* connection, |
| 141 mojo::InterfaceRequest<mojo::ViewTreeClient> request) override; | 141 mojo::InterfaceRequest<mojo::ViewTreeClient> request) override; |
| 142 | 142 |
| 143 scoped_ptr<mojo::AppRefCount> app_refcount_; | 143 scoped_ptr<mojo::AppRefCount> app_refcount_; |
| 144 mojo::ApplicationImpl* html_document_app_; | 144 mojo::ApplicationImpl* html_document_app_; |
| 145 mojo::ApplicationConnection* connection_; | 145 mojo::ApplicationConnection* connection_; |
| 146 | 146 |
| 147 // HTMLDocument owns these pointers; binding requests after document load. | 147 // HTMLDocument owns these pointers; binding requests after document load. |
| 148 std::set<AxProviderImpl*> ax_providers_; | 148 std::set<AxProviderImpl*> ax_providers_; |
| 149 | 149 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 170 // initialized. | 170 // initialized. |
| 171 mojo::InterfaceRequest<devtools_service::DevToolsAgent> | 171 mojo::InterfaceRequest<devtools_service::DevToolsAgent> |
| 172 devtools_agent_request_; | 172 devtools_agent_request_; |
| 173 | 173 |
| 174 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); | 174 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 } // namespace html_viewer | 177 } // namespace html_viewer |
| 178 | 178 |
| 179 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ | 179 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ |
| OLD | NEW |