| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 class HTMLDocument : public blink::WebViewClient, | 47 class HTMLDocument : public blink::WebViewClient, |
| 48 public blink::WebFrameClient, | 48 public blink::WebFrameClient, |
| 49 public mojo::ViewManagerDelegate, | 49 public mojo::ViewManagerDelegate, |
| 50 public mojo::ViewObserver, | 50 public mojo::ViewObserver, |
| 51 public mojo::InterfaceFactory<mojo::AxProvider> { | 51 public mojo::InterfaceFactory<mojo::AxProvider> { |
| 52 public: | 52 public: |
| 53 // Load a new HTMLDocument with |response|. | 53 // Load a new HTMLDocument with |response|. |
| 54 // | 54 // |html_document_app| is the application this app was created in, and |
| 55 // |services| should be used to implement a ServiceProvider which exposes | 55 // |connection| the specific connection triggering this new instance. |
| 56 // services to the connecting application. | 56 // |setup| is used to obtain init type state (such as resources). |
| 57 // Commonly, the connecting application is the ViewManager and it will | 57 HTMLDocument(mojo::ApplicationImpl* html_document_app, |
| 58 // request ViewManagerClient. | 58 mojo::ApplicationConnection* connection, |
| 59 // | |
| 60 // |shell| is the Shell connection for this mojo::Application. | |
| 61 HTMLDocument(mojo::InterfaceRequest<mojo::ServiceProvider> services, | |
| 62 mojo::URLResponsePtr response, | 59 mojo::URLResponsePtr response, |
| 63 mojo::ShellPtr shell, | |
| 64 Setup* setup); | 60 Setup* setup); |
| 65 ~HTMLDocument() override; | 61 ~HTMLDocument() override; |
| 66 | 62 |
| 67 private: | 63 private: |
| 68 // Data associated with a child iframe. | 64 // Data associated with a child iframe. |
| 69 struct ChildFrameData { | 65 struct ChildFrameData { |
| 70 mojo::View* view; | 66 mojo::View* view; |
| 71 blink::WebTreeScopeType scope; | 67 blink::WebTreeScopeType scope; |
| 72 }; | 68 }; |
| 73 | 69 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 void Create(mojo::ApplicationConnection* connection, | 129 void Create(mojo::ApplicationConnection* connection, |
| 134 mojo::InterfaceRequest<mojo::AxProvider> request) override; | 130 mojo::InterfaceRequest<mojo::AxProvider> request) override; |
| 135 | 131 |
| 136 void Load(mojo::URLResponsePtr response); | 132 void Load(mojo::URLResponsePtr response); |
| 137 | 133 |
| 138 // Converts a WebLocalFrame to a WebRemoteFrame. Used once we know the | 134 // Converts a WebLocalFrame to a WebRemoteFrame. Used once we know the |
| 139 // url of a frame to trigger the navigation. | 135 // url of a frame to trigger the navigation. |
| 140 void ConvertLocalFrameToRemoteFrame(blink::WebLocalFrame* frame); | 136 void ConvertLocalFrameToRemoteFrame(blink::WebLocalFrame* frame); |
| 141 | 137 |
| 142 scoped_ptr<mojo::AppRefCount> app_refcount_; | 138 scoped_ptr<mojo::AppRefCount> app_refcount_; |
| 139 mojo::ApplicationImpl* html_document_app_; |
| 143 mojo::URLResponsePtr response_; | 140 mojo::URLResponsePtr response_; |
| 144 mojo::ServiceProviderImpl exported_services_; | |
| 145 mojo::ServiceProviderPtr embedder_service_provider_; | 141 mojo::ServiceProviderPtr embedder_service_provider_; |
| 146 mojo::ShellPtr shell_; | |
| 147 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; | 142 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; |
| 148 blink::WebView* web_view_; | 143 blink::WebView* web_view_; |
| 149 mojo::View* root_; | 144 mojo::View* root_; |
| 150 mojo::ViewManagerClientFactory view_manager_client_factory_; | 145 mojo::ViewManagerClientFactory view_manager_client_factory_; |
| 151 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; | 146 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; |
| 152 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_; | 147 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_; |
| 153 | 148 |
| 154 // HTMLDocument owns these pointers; binding requests after document load. | 149 // HTMLDocument owns these pointers; binding requests after document load. |
| 155 std::set<mojo::InterfaceRequest<mojo::AxProvider>*> ax_provider_requests_; | 150 std::set<mojo::InterfaceRequest<mojo::AxProvider>*> ax_provider_requests_; |
| 156 std::set<AxProviderImpl*> ax_providers_; | 151 std::set<AxProviderImpl*> ax_providers_; |
| 157 | 152 |
| 158 // A flag set on didFinishLoad. | 153 // A flag set on didFinishLoad. |
| 159 bool did_finish_load_ = false; | 154 bool did_finish_load_ = false; |
| 160 | 155 |
| 161 Setup* setup_; | 156 Setup* setup_; |
| 162 | 157 |
| 163 scoped_ptr<TouchHandler> touch_handler_; | 158 scoped_ptr<TouchHandler> touch_handler_; |
| 164 | 159 |
| 165 FrameToViewMap frame_to_view_; | 160 FrameToViewMap frame_to_view_; |
| 166 | 161 |
| 167 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); | 162 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); |
| 168 }; | 163 }; |
| 169 | 164 |
| 170 } // namespace html_viewer | 165 } // namespace html_viewer |
| 171 | 166 |
| 172 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ | 167 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ |
| OLD | NEW |