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