| 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_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ | 5 #ifndef MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ |
| 6 #define MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ | 6 #define MOJO_SERVICES_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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class AxProviderImpl; | 44 class AxProviderImpl; |
| 45 class WebLayerTreeViewImpl; | 45 class WebLayerTreeViewImpl; |
| 46 class WebMediaPlayerFactory; | 46 class WebMediaPlayerFactory; |
| 47 | 47 |
| 48 // A view for a single HTML document. | 48 // A view for a single HTML document. |
| 49 class HTMLDocument : public blink::WebViewClient, | 49 class HTMLDocument : public blink::WebViewClient, |
| 50 public blink::WebFrameClient, | 50 public blink::WebFrameClient, |
| 51 public mojo::ViewManagerDelegate, | 51 public mojo::ViewManagerDelegate, |
| 52 public mojo::ViewObserver, | 52 public mojo::ViewObserver, |
| 53 public mojo::InterfaceFactory<mojo::AxProvider> { | 53 public mojo::InterfaceFactory<mojo::AxProvider> { |
| 54 // , public mojo::InterfaceImpl<mojo::HTMLDocumentTestAPI>, |
| 55 // public mojo::InterfaceFactory<mojo::HTMLDocumentTestAPI>
{ |
| 54 public: | 56 public: |
| 55 // Load a new HTMLDocument with |response|. | 57 // Load a new HTMLDocument with |response|. |
| 56 // | 58 // |
| 57 // |services| should be used to implement a ServiceProvider which exposes | 59 // Services are offered to the connecting application via |service_provider|. |
| 58 // services to the connecting application. | |
| 59 // Commonly, the connecting application is the ViewManager and it will | 60 // Commonly, the connecting application is the ViewManager and it will |
| 60 // request ViewManagerClient. | 61 // request ViewManagerClient. |
| 61 // | 62 // |
| 62 // |shell| is the Shell connection for this mojo::Application. | 63 // |shell| is the Shell connection for this mojo::Application. |
| 63 HTMLDocument(mojo::InterfaceRequest<mojo::ServiceProvider> services, | 64 HTMLDocument(mojo::ServiceProviderImpl* service_provider, |
| 64 mojo::URLResponsePtr response, | 65 mojo::URLResponsePtr response, |
| 65 mojo::Shell* shell, | 66 mojo::Shell* shell, |
| 66 scoped_refptr<base::MessageLoopProxy> compositor_thread, | 67 scoped_refptr<base::MessageLoopProxy> compositor_thread, |
| 67 WebMediaPlayerFactory* web_media_player_factory, | 68 WebMediaPlayerFactory* web_media_player_factory, |
| 68 bool is_headless); | 69 bool is_headless); |
| 69 virtual ~HTMLDocument(); | 70 virtual ~HTMLDocument(); |
| 70 | 71 |
| 71 private: | 72 private: |
| 72 // Updates the size and scale factor of the webview and related classes from | 73 // Updates the size and scale factor of the webview and related classes from |
| 73 // |root_|. | 74 // |root_|. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 100 blink::WebLocalFrame* frame, | 101 blink::WebLocalFrame* frame, |
| 101 blink::WebDataSource::ExtraData* data, | 102 blink::WebDataSource::ExtraData* data, |
| 102 const blink::WebURLRequest& request, | 103 const blink::WebURLRequest& request, |
| 103 blink::WebNavigationType nav_type, | 104 blink::WebNavigationType nav_type, |
| 104 blink::WebNavigationPolicy default_policy, | 105 blink::WebNavigationPolicy default_policy, |
| 105 bool isRedirect); | 106 bool isRedirect); |
| 106 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message, | 107 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message, |
| 107 const blink::WebString& source_name, | 108 const blink::WebString& source_name, |
| 108 unsigned source_line, | 109 unsigned source_line, |
| 109 const blink::WebString& stack_trace); | 110 const blink::WebString& stack_trace); |
| 111 virtual void didFinishLoad(blink::WebLocalFrame* frame); |
| 110 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame, | 112 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame, |
| 111 const blink::WebHistoryItem& history_item, | 113 const blink::WebHistoryItem& history_item, |
| 112 blink::WebHistoryCommitType commit_type); | 114 blink::WebHistoryCommitType commit_type); |
| 113 virtual blink::WebEncryptedMediaClient* encryptedMediaClient(); | 115 virtual blink::WebEncryptedMediaClient* encryptedMediaClient(); |
| 114 | 116 |
| 117 |
| 115 // ViewManagerDelegate methods: | 118 // ViewManagerDelegate methods: |
| 116 void OnEmbed(mojo::View* root, | 119 void OnEmbed(mojo::View* root, |
| 117 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 120 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 118 mojo::ServiceProviderPtr exposed_services) override; | 121 mojo::ServiceProviderPtr exposed_services) override; |
| 119 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; | 122 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; |
| 120 | 123 |
| 121 // ViewObserver methods: | 124 // ViewObserver methods: |
| 122 void OnViewBoundsChanged(mojo::View* view, | 125 void OnViewBoundsChanged(mojo::View* view, |
| 123 const mojo::Rect& old_bounds, | 126 const mojo::Rect& old_bounds, |
| 124 const mojo::Rect& new_bounds) override; | 127 const mojo::Rect& new_bounds) override; |
| 125 void OnViewDestroyed(mojo::View* view) override; | 128 void OnViewDestroyed(mojo::View* view) override; |
| 126 void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; | 129 void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; |
| 127 | 130 |
| 128 // InterfaceFactory<AxProvider> | 131 // mojo::InterfaceFactory<mojo::AxProvider> |
| 129 void Create(mojo::ApplicationConnection* connection, | 132 void Create(mojo::ApplicationConnection* connection, |
| 130 mojo::InterfaceRequest<mojo::AxProvider> request) override; | 133 mojo::InterfaceRequest<mojo::AxProvider> request) override; |
| 131 | 134 |
| 135 // // mojo::InterfaceImpl<mojo::HTMLDocumentTestAPI> |
| 136 // void GetLayoutTreeAsText( |
| 137 // const GetLayoutTreeAsTextCallback& callback) override; |
| 138 |
| 139 // // mojo::InterfaceFactory<mojo::HTMLDocumentTestAPI> |
| 140 // void Create( |
| 141 // mojo::ApplicationConnection* connection, |
| 142 // mojo::InterfaceRequest<mojo::HTMLDocumentTestAPI> request) override; |
| 143 |
| 132 void Load(mojo::URLResponsePtr response); | 144 void Load(mojo::URLResponsePtr response); |
| 133 | 145 |
| 134 mojo::URLResponsePtr response_; | 146 mojo::URLResponsePtr response_; |
| 135 mojo::ServiceProviderImpl exported_services_; | |
| 136 mojo::ServiceProviderPtr embedder_service_provider_; | 147 mojo::ServiceProviderPtr embedder_service_provider_; |
| 137 mojo::Shell* shell_; | 148 mojo::Shell* shell_; |
| 138 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; | 149 mojo::LazyInterfacePtr<mojo::NavigatorHost> navigator_host_; |
| 139 blink::WebView* web_view_; | 150 blink::WebView* web_view_; |
| 140 mojo::View* root_; | 151 mojo::View* root_; |
| 141 mojo::ViewManagerClientFactory view_manager_client_factory_; | 152 mojo::ViewManagerClientFactory view_manager_client_factory_; |
| 142 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; | 153 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; |
| 143 scoped_refptr<base::MessageLoopProxy> compositor_thread_; | 154 scoped_refptr<base::MessageLoopProxy> compositor_thread_; |
| 144 WebMediaPlayerFactory* web_media_player_factory_; | 155 WebMediaPlayerFactory* web_media_player_factory_; |
| 145 | 156 |
| 146 // EncryptedMediaClient attached to this frame; lazily initialized. | 157 // EncryptedMediaClient attached to this frame; lazily initialized. |
| 147 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_; | 158 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_; |
| 148 scoped_ptr<media::MediaPermission> media_permission_; | 159 scoped_ptr<media::MediaPermission> media_permission_; |
| 149 | 160 |
| 150 // HTMLDocument owns these pointers. | 161 // HTMLDocument owns these pointers. |
| 151 std::set<AxProviderImpl*> ax_provider_impls_; | 162 std::set<mojo::InterfaceRequest<mojo::AxProvider>*> ax_provider_requests_; |
| 163 std::set<AxProviderImpl*> ax_providers_; |
| 164 bool did_finish_load_ = false; |
| 152 | 165 |
| 153 // Set if the content will never be displayed. | 166 // Set if the content will never be displayed. |
| 154 bool is_headless_; | 167 bool is_headless_; |
| 155 | 168 |
| 156 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); | 169 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); |
| 157 }; | 170 }; |
| 158 | 171 |
| 159 } // namespace html_viewer | 172 } // namespace html_viewer |
| 160 | 173 |
| 161 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ | 174 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_H_ |
| OLD | NEW |