| 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 mojo { | 20 namespace mojo { |
| 21 | 21 |
| 22 class WebMediaPlayerFactory; |
| 22 class ViewManager; | 23 class ViewManager; |
| 23 class View; | 24 class View; |
| 24 | 25 |
| 25 // A view for a single HTML document. | 26 // A view for a single HTML document. |
| 26 class HTMLDocumentView : public blink::WebViewClient, | 27 class HTMLDocumentView : public blink::WebViewClient, |
| 27 public blink::WebFrameClient, | 28 public blink::WebFrameClient, |
| 28 public ViewManagerDelegate, | 29 public ViewManagerDelegate, |
| 29 public ViewObserver { | 30 public ViewObserver { |
| 30 public: | 31 public: |
| 31 // Load a new HTMLDocument with |response|. | 32 // Load a new HTMLDocument with |response|. |
| 32 // | 33 // |
| 33 // |service_provider_request| should be used to implement a | 34 // |service_provider_request| should be used to implement a |
| 34 // ServiceProvider which exposes services to the connecting application. | 35 // ServiceProvider which exposes services to the connecting application. |
| 35 // Commonly, the connecting application is the ViewManager and it will | 36 // Commonly, the connecting application is the ViewManager and it will |
| 36 // request ViewManagerClient. | 37 // request ViewManagerClient. |
| 37 // | 38 // |
| 38 // |shell| is the Shell connection for this mojo::Application. | 39 // |shell| is the Shell connection for this mojo::Application. |
| 39 HTMLDocumentView(URLResponsePtr response, | 40 HTMLDocumentView(URLResponsePtr response, |
| 40 InterfaceRequest<ServiceProvider> service_provider_request, | 41 InterfaceRequest<ServiceProvider> service_provider_request, |
| 41 Shell* shell); | 42 Shell* shell, |
| 43 WebMediaPlayerFactory* web_media_player_factory); |
| 42 virtual ~HTMLDocumentView(); | 44 virtual ~HTMLDocumentView(); |
| 43 | 45 |
| 44 private: | 46 private: |
| 45 // WebViewClient methods: | 47 // WebViewClient methods: |
| 46 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); | 48 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); |
| 47 | 49 |
| 48 // WebWidgetClient methods: | 50 // WebWidgetClient methods: |
| 49 virtual void didInvalidateRect(const blink::WebRect& rect); | 51 virtual void didInvalidateRect(const blink::WebRect& rect); |
| 50 virtual bool allowsBrokenNullLayerTreeView() const; | 52 virtual bool allowsBrokenNullLayerTreeView() const; |
| 51 | 53 |
| 52 // WebFrameClient methods: | 54 // WebFrameClient methods: |
| 55 virtual blink::WebMediaPlayer* createMediaPlayer( |
| 56 blink::WebLocalFrame* frame, |
| 57 const blink::WebURL& url, |
| 58 blink::WebMediaPlayerClient* client); |
| 53 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, | 59 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, |
| 54 const blink::WebString& frameName); | 60 const blink::WebString& frameName); |
| 55 virtual void frameDetached(blink::WebFrame*); | 61 virtual void frameDetached(blink::WebFrame*); |
| 56 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame); | 62 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame); |
| 57 virtual blink::WebNavigationPolicy decidePolicyForNavigation( | 63 virtual blink::WebNavigationPolicy decidePolicyForNavigation( |
| 58 blink::WebLocalFrame* frame, blink::WebDataSource::ExtraData* data, | 64 blink::WebLocalFrame* frame, blink::WebDataSource::ExtraData* data, |
| 59 const blink::WebURLRequest& request, blink::WebNavigationType nav_type, | 65 const blink::WebURLRequest& request, blink::WebNavigationType nav_type, |
| 60 blink::WebNavigationPolicy default_policy, bool isRedirect); | 66 blink::WebNavigationPolicy default_policy, bool isRedirect); |
| 61 virtual void didAddMessageToConsole( | 67 virtual void didAddMessageToConsole( |
| 62 const blink::WebConsoleMessage& message, | 68 const blink::WebConsoleMessage& message, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 88 | 94 |
| 89 URLResponsePtr response_; | 95 URLResponsePtr response_; |
| 90 scoped_ptr<ServiceProvider> embedder_service_provider_; | 96 scoped_ptr<ServiceProvider> embedder_service_provider_; |
| 91 Shell* shell_; | 97 Shell* shell_; |
| 92 LazyInterfacePtr<NavigatorHost> navigator_host_; | 98 LazyInterfacePtr<NavigatorHost> navigator_host_; |
| 93 blink::WebView* web_view_; | 99 blink::WebView* web_view_; |
| 94 View* root_; | 100 View* root_; |
| 95 ViewManagerClientFactory view_manager_client_factory_; | 101 ViewManagerClientFactory view_manager_client_factory_; |
| 96 bool repaint_pending_; | 102 bool repaint_pending_; |
| 97 | 103 |
| 104 WebMediaPlayerFactory* web_media_player_factory_; |
| 105 |
| 98 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; | 106 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; |
| 99 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); | 107 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); |
| 100 }; | 108 }; |
| 101 | 109 |
| 102 } // namespace mojo | 110 } // namespace mojo |
| 103 | 111 |
| 104 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 112 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
| OLD | NEW |