| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace mojo { | 39 namespace mojo { |
| 40 class ViewManager; | 40 class ViewManager; |
| 41 class View; | 41 class View; |
| 42 } | 42 } |
| 43 | 43 |
| 44 namespace html_viewer { | 44 namespace html_viewer { |
| 45 | 45 |
| 46 class AxProviderImpl; | 46 class AxProviderImpl; |
| 47 class Setup; |
| 47 class WebLayerTreeViewImpl; | 48 class WebLayerTreeViewImpl; |
| 48 class WebMediaPlayerFactory; | 49 class WebMediaPlayerFactory; |
| 49 | 50 |
| 50 // A view for a single HTML document. | 51 // A view for a single HTML document. |
| 51 class HTMLDocument : public blink::WebViewClient, | 52 class HTMLDocument : public blink::WebViewClient, |
| 52 public blink::WebFrameClient, | 53 public blink::WebFrameClient, |
| 53 public mojo::ViewManagerDelegate, | 54 public mojo::ViewManagerDelegate, |
| 54 public mojo::ViewObserver, | 55 public mojo::ViewObserver, |
| 55 public mojo::InterfaceFactory<mojo::AxProvider> { | 56 public mojo::InterfaceFactory<mojo::AxProvider> { |
| 56 public: | 57 public: |
| 57 // Load a new HTMLDocument with |response|. | 58 // Load a new HTMLDocument with |response|. |
| 58 // | 59 // |
| 59 // |services| should be used to implement a ServiceProvider which exposes | 60 // |services| should be used to implement a ServiceProvider which exposes |
| 60 // services to the connecting application. | 61 // services to the connecting application. |
| 61 // Commonly, the connecting application is the ViewManager and it will | 62 // Commonly, the connecting application is the ViewManager and it will |
| 62 // request ViewManagerClient. | 63 // request ViewManagerClient. |
| 63 // | 64 // |
| 64 // |shell| is the Shell connection for this mojo::Application. | 65 // |shell| is the Shell connection for this mojo::Application. |
| 65 HTMLDocument(mojo::InterfaceRequest<mojo::ServiceProvider> services, | 66 HTMLDocument(mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 66 mojo::URLResponsePtr response, | 67 mojo::URLResponsePtr response, |
| 67 mojo::Shell* shell, | 68 mojo::Shell* shell, |
| 68 scoped_refptr<base::MessageLoopProxy> compositor_thread, | 69 Setup* setup); |
| 69 WebMediaPlayerFactory* web_media_player_factory, | |
| 70 bool is_headless); | |
| 71 ~HTMLDocument() override; | 70 ~HTMLDocument() override; |
| 72 | 71 |
| 73 private: | 72 private: |
| 74 // 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 |
| 75 // |root_|. | 74 // |root_|. |
| 76 void UpdateWebviewSizeFromViewSize(); | 75 void UpdateWebviewSizeFromViewSize(); |
| 77 | 76 |
| 77 void InitSetupAndLoadIfNecessary(); |
| 78 |
| 78 // WebViewClient methods: | 79 // WebViewClient methods: |
| 79 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); | 80 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); |
| 80 | 81 |
| 81 // WebWidgetClient methods: | 82 // WebWidgetClient methods: |
| 82 void initializeLayerTreeView() override; | 83 void initializeLayerTreeView() override; |
| 83 blink::WebLayerTreeView* layerTreeView() override; | 84 blink::WebLayerTreeView* layerTreeView() override; |
| 84 | 85 |
| 85 // WebFrameClient methods: | 86 // WebFrameClient methods: |
| 86 virtual blink::WebMediaPlayer* createMediaPlayer( | 87 virtual blink::WebMediaPlayer* createMediaPlayer( |
| 87 blink::WebLocalFrame* frame, | 88 blink::WebLocalFrame* frame, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 118 // ViewManagerDelegate methods: | 119 // ViewManagerDelegate methods: |
| 119 void OnEmbed(mojo::View* root, | 120 void OnEmbed(mojo::View* root, |
| 120 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 121 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 121 mojo::ServiceProviderPtr exposed_services) override; | 122 mojo::ServiceProviderPtr exposed_services) override; |
| 122 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; | 123 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override; |
| 123 | 124 |
| 124 // ViewObserver methods: | 125 // ViewObserver methods: |
| 125 void OnViewBoundsChanged(mojo::View* view, | 126 void OnViewBoundsChanged(mojo::View* view, |
| 126 const mojo::Rect& old_bounds, | 127 const mojo::Rect& old_bounds, |
| 127 const mojo::Rect& new_bounds) override; | 128 const mojo::Rect& new_bounds) override; |
| 129 void OnViewViewportMetricsChanged( |
| 130 mojo::View* view, |
| 131 const mojo::ViewportMetrics& old_metrics, |
| 132 const mojo::ViewportMetrics& new_metrics) override; |
| 128 void OnViewDestroyed(mojo::View* view) override; | 133 void OnViewDestroyed(mojo::View* view) override; |
| 129 void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; | 134 void OnViewInputEvent(mojo::View* view, const mojo::EventPtr& event) override; |
| 130 | 135 |
| 131 // mojo::InterfaceFactory<mojo::AxProvider> | 136 // mojo::InterfaceFactory<mojo::AxProvider> |
| 132 void Create(mojo::ApplicationConnection* connection, | 137 void Create(mojo::ApplicationConnection* connection, |
| 133 mojo::InterfaceRequest<mojo::AxProvider> request) override; | 138 mojo::InterfaceRequest<mojo::AxProvider> request) override; |
| 134 | 139 |
| 135 void Load(mojo::URLResponsePtr response); | 140 void Load(mojo::URLResponsePtr response); |
| 136 | 141 |
| 137 media::MediaPermission* GetMediaPermission(); | 142 media::MediaPermission* GetMediaPermission(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 155 scoped_ptr<media::MediaPermission> media_permission_; | 160 scoped_ptr<media::MediaPermission> media_permission_; |
| 156 scoped_ptr<media::CdmFactory> cdm_factory_; | 161 scoped_ptr<media::CdmFactory> cdm_factory_; |
| 157 | 162 |
| 158 // HTMLDocument owns these pointers; binding requests after document load. | 163 // HTMLDocument owns these pointers; binding requests after document load. |
| 159 std::set<mojo::InterfaceRequest<mojo::AxProvider>*> ax_provider_requests_; | 164 std::set<mojo::InterfaceRequest<mojo::AxProvider>*> ax_provider_requests_; |
| 160 std::set<AxProviderImpl*> ax_providers_; | 165 std::set<AxProviderImpl*> ax_providers_; |
| 161 | 166 |
| 162 // A flag set on didFinishLoad. | 167 // A flag set on didFinishLoad. |
| 163 bool did_finish_load_ = false; | 168 bool did_finish_load_ = false; |
| 164 | 169 |
| 165 // Set if the content will never be displayed. | 170 Setup* setup_; |
| 166 bool is_headless_; | |
| 167 | 171 |
| 168 scoped_ptr<TouchHandler> touch_handler_; | 172 scoped_ptr<TouchHandler> touch_handler_; |
| 169 | 173 |
| 170 float device_pixel_ratio_; | |
| 171 | |
| 172 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); | 174 DISALLOW_COPY_AND_ASSIGN(HTMLDocument); |
| 173 }; | 175 }; |
| 174 | 176 |
| 175 } // namespace html_viewer | 177 } // namespace html_viewer |
| 176 | 178 |
| 177 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ | 179 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_H_ |
| OLD | NEW |