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 { |
| 21 class MessageLoopProxy; |
| 22 } |
| 23 |
20 namespace mojo { | 24 namespace mojo { |
21 | 25 |
22 class ViewManager; | 26 class ViewManager; |
23 class View; | 27 class View; |
| 28 class WebLayerTreeViewImpl; |
24 | 29 |
25 // A view for a single HTML document. | 30 // A view for a single HTML document. |
26 class HTMLDocumentView : public blink::WebViewClient, | 31 class HTMLDocumentView : public blink::WebViewClient, |
27 public blink::WebFrameClient, | 32 public blink::WebFrameClient, |
28 public ViewManagerDelegate, | 33 public ViewManagerDelegate, |
29 public ViewObserver { | 34 public ViewObserver { |
30 public: | 35 public: |
31 // Load a new HTMLDocument with |response|. | 36 // Load a new HTMLDocument with |response|. |
32 // | 37 // |
33 // |service_provider_request| should be used to implement a | 38 // |service_provider_request| should be used to implement a |
34 // ServiceProvider which exposes services to the connecting application. | 39 // ServiceProvider which exposes services to the connecting application. |
35 // Commonly, the connecting application is the ViewManager and it will | 40 // Commonly, the connecting application is the ViewManager and it will |
36 // request ViewManagerClient. | 41 // request ViewManagerClient. |
37 // | 42 // |
38 // |shell| is the Shell connection for this mojo::Application. | 43 // |shell| is the Shell connection for this mojo::Application. |
39 HTMLDocumentView(URLResponsePtr response, | 44 HTMLDocumentView(URLResponsePtr response, |
40 InterfaceRequest<ServiceProvider> service_provider_request, | 45 InterfaceRequest<ServiceProvider> service_provider_request, |
41 Shell* shell); | 46 Shell* shell, |
| 47 scoped_refptr<base::MessageLoopProxy> compositor_thread); |
42 virtual ~HTMLDocumentView(); | 48 virtual ~HTMLDocumentView(); |
43 | 49 |
44 private: | 50 private: |
45 // WebViewClient methods: | 51 // WebViewClient methods: |
46 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); | 52 virtual blink::WebStorageNamespace* createSessionStorageNamespace(); |
47 | 53 |
48 // WebWidgetClient methods: | 54 // WebWidgetClient methods: |
49 virtual void didInvalidateRect(const blink::WebRect& rect); | 55 virtual void initializeLayerTreeView(); |
50 virtual bool allowsBrokenNullLayerTreeView() const; | 56 virtual blink::WebLayerTreeView* layerTreeView(); |
51 | 57 |
52 // WebFrameClient methods: | 58 // WebFrameClient methods: |
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); |
(...skipping 16 matching lines...) Expand all Loading... |
77 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE; | 83 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE; |
78 | 84 |
79 // ViewObserver methods: | 85 // ViewObserver methods: |
80 virtual void OnViewBoundsChanged(View* view, | 86 virtual void OnViewBoundsChanged(View* view, |
81 const gfx::Rect& old_bounds, | 87 const gfx::Rect& old_bounds, |
82 const gfx::Rect& new_bounds) OVERRIDE; | 88 const gfx::Rect& new_bounds) OVERRIDE; |
83 virtual void OnViewDestroyed(View* view) OVERRIDE; | 89 virtual void OnViewDestroyed(View* view) OVERRIDE; |
84 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE; | 90 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE; |
85 | 91 |
86 void Load(URLResponsePtr response); | 92 void Load(URLResponsePtr response); |
87 void Repaint(); | |
88 | 93 |
89 URLResponsePtr response_; | 94 URLResponsePtr response_; |
90 scoped_ptr<ServiceProvider> embedder_service_provider_; | 95 scoped_ptr<ServiceProvider> embedder_service_provider_; |
91 Shell* shell_; | 96 Shell* shell_; |
92 LazyInterfacePtr<NavigatorHost> navigator_host_; | 97 LazyInterfacePtr<NavigatorHost> navigator_host_; |
93 blink::WebView* web_view_; | 98 blink::WebView* web_view_; |
94 View* root_; | 99 View* root_; |
95 ViewManagerClientFactory view_manager_client_factory_; | 100 ViewManagerClientFactory view_manager_client_factory_; |
96 bool repaint_pending_; | 101 scoped_ptr<WebLayerTreeViewImpl> web_layer_tree_view_impl_; |
| 102 scoped_refptr<base::MessageLoopProxy> compositor_thread_; |
97 | 103 |
98 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; | 104 base::WeakPtrFactory<HTMLDocumentView> weak_factory_; |
99 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); | 105 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); |
100 }; | 106 }; |
101 | 107 |
102 } // namespace mojo | 108 } // namespace mojo |
103 | 109 |
104 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ | 110 #endif // MOJO_SERVICES_HTML_VIEWER_HTML_DOCUMENT_VIEW_H_ |
OLD | NEW |