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_VIEW_H_ | 5 #ifndef MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
6 #define MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 6 #define MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "mojo/public/cpp/application/lazy_interface_ptr.h" | 10 #include "mojo/public/cpp/application/lazy_interface_ptr.h" |
11 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" | 11 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" |
12 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 12 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
13 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 13 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
14 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.
h" | 14 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.
h" |
15 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" | 15 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" |
16 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" | 16 #include "mojo/services/public/interfaces/network/url_loader.mojom.h" |
17 #include "third_party/WebKit/public/web/WebFrameClient.h" | 17 #include "third_party/WebKit/public/web/WebFrameClient.h" |
18 #include "third_party/WebKit/public/web/WebViewClient.h" | 18 #include "third_party/WebKit/public/web/WebViewClient.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class MessageLoopProxy; | 21 class MessageLoopProxy; |
22 } | 22 } |
23 | 23 |
24 namespace mojo { | 24 namespace mojo { |
25 | 25 |
| 26 class WebMediaPlayerFactory; |
26 class ViewManager; | 27 class ViewManager; |
27 class View; | 28 class View; |
28 class WebLayerTreeViewImpl; | 29 class WebLayerTreeViewImpl; |
29 | 30 |
30 // A view for a single HTML document. | 31 // A view for a single HTML document. |
31 class HTMLDocumentView : public blink::WebViewClient, | 32 class HTMLDocumentView : public blink::WebViewClient, |
32 public blink::WebFrameClient, | 33 public blink::WebFrameClient, |
33 public ViewManagerDelegate, | 34 public ViewManagerDelegate, |
34 public ViewObserver { | 35 public ViewObserver { |
35 public: | 36 public: |
36 // Load a new HTMLDocument with |response|. | 37 // Load a new HTMLDocument with |response|. |
37 // | 38 // |
38 // |service_provider_request| should be used to implement a | 39 // |service_provider_request| should be used to implement a |
39 // ServiceProvider which exposes services to the connecting application. | 40 // ServiceProvider which exposes services to the connecting application. |
40 // Commonly, the connecting application is the ViewManager and it will | 41 // Commonly, the connecting application is the ViewManager and it will |
41 // request ViewManagerClient. | 42 // request ViewManagerClient. |
42 // | 43 // |
43 // |shell| is the Shell connection for this mojo::Application. | 44 // |shell| is the Shell connection for this mojo::Application. |
44 HTMLDocumentView(URLResponsePtr response, | 45 HTMLDocumentView(URLResponsePtr response, |
45 InterfaceRequest<ServiceProvider> service_provider_request, | 46 InterfaceRequest<ServiceProvider> service_provider_request, |
46 Shell* shell, | 47 Shell* shell, |
47 scoped_refptr<base::MessageLoopProxy> compositor_thread); | 48 scoped_refptr<base::MessageLoopProxy> compositor_thread, |
| 49 WebMediaPlayerFactory* web_media_player_factory); |
48 virtual ~HTMLDocumentView(); | 50 virtual ~HTMLDocumentView(); |
49 | 51 |
50 private: | 52 private: |
51 // WebViewClient methods: | 53 // WebViewClient methods: |
52 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); | 54 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); |
53 | 55 |
54 // WebWidgetClient methods: | 56 // WebWidgetClient methods: |
55 virtual void initializeLayerTreeView(); | 57 virtual void initializeLayerTreeView(); |
56 virtual blink::WebLayerTreeView* layerTreeView(); | 58 virtual blink::WebLayerTreeView* layerTreeView(); |
57 | 59 |
58 // WebFrameClient methods: | 60 // WebFrameClient methods: |
| 61 virtual blink::WebMediaPlayer* createMediaPlayer( |
| 62 blink::WebLocalFrame* frame, |
| 63 const blink::WebURL& url, |
| 64 blink::WebMediaPlayerClient* client); |
59 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, | 65 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, |
60 const blink::WebString& frameName); | 66 const blink::WebString& frameName); |
61 virtual void frameDetached(blink::WebFrame*); | 67 virtual void frameDetached(blink::WebFrame*); |
62 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame); | 68 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame); |
63 virtual blink::WebNavigationPolicy decidePolicyForNavigation( | 69 virtual blink::WebNavigationPolicy decidePolicyForNavigation( |
64 blink::WebLocalFrame* frame, blink::WebDataSource::ExtraData* data, | 70 blink::WebLocalFrame* frame, blink::WebDataSource::ExtraData* data, |
65 const blink::WebURLRequest& request, blink::WebNavigationType nav_type, | 71 const blink::WebURLRequest& request, blink::WebNavigationType nav_type, |
66 blink::WebNavigationPolicy default_policy, bool isRedirect); | 72 blink::WebNavigationPolicy default_policy, bool isRedirect); |
67 virtual void didAddMessageToConsole( | 73 virtual void didAddMessageToConsole( |
68 const blink::WebConsoleMessage& message, | 74 const blink::WebConsoleMessage& message, |
(...skipping 24 matching lines...) Expand all Loading... |
93 | 99 |
94 URLResponsePtr response_; | 100 URLResponsePtr response_; |
95 scoped_ptr<ServiceProvider> embedder_service_provider_; | 101 scoped_ptr<ServiceProvider> embedder_service_provider_; |
96 Shell* shell_; | 102 Shell* shell_; |
97 LazyInterfacePtr<NavigatorHost> navigator_host_; | 103 LazyInterfacePtr<NavigatorHost> navigator_host_; |
98 blink::WebView* web_view_; | 104 blink::WebView* web_view_; |
99 View* root_; | 105 View* root_; |
100 ViewManagerClientFactory view_manager_client_factory_; | 106 ViewManagerClientFactory view_manager_client_factory_; |
101 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; | 107 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; |
102 scoped_refptr<base::MessageLoopProxy> compositor_thread_; | 108 scoped_refptr<base::MessageLoopProxy> compositor_thread_; |
| 109 WebMediaPlayerFactory* web_media_player_factory_; |
103 | 110 |
104 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; | 111 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; |
105 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); | 112 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); |
106 }; | 113 }; |
107 | 114 |
108 } // namespace mojo | 115 } // namespace mojo |
109 | 116 |
110 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 117 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
OLD | NEW |