OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
7 | 7 |
8 #include "content/public/browser/web_contents_observer.h" | 8 #include "content/public/browser/web_contents_observer.h" |
9 | 9 |
10 #include "android_webview/common/aw_hit_test_data.h" | 10 #include "android_webview/common/aw_hit_test_data.h" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 struct FrameNavigateParams; | 19 struct FrameNavigateParams; |
20 struct LoadCommittedDetails; | 20 struct LoadCommittedDetails; |
21 } // namespace content | 21 } // namespace content |
22 | 22 |
23 namespace android_webview { | 23 namespace android_webview { |
24 | 24 |
25 class AwRenderViewHostExtClient { | 25 class AwRenderViewHostExtClient { |
26 public: | 26 public: |
27 // Called when the RenderView page scale changes. | 27 // Called when the RenderView page scale changes. |
28 virtual void OnWebLayoutPageScaleFactorChanged(float page_scale_factor) = 0; | 28 virtual void OnWebLayoutPageScaleFactorChanged(float page_scale_factor) = 0; |
| 29 virtual void OnWebLayoutContentsSizeChanged( |
| 30 const gfx::Size& contents_size) = 0; |
29 | 31 |
30 protected: | 32 protected: |
31 virtual ~AwRenderViewHostExtClient() {} | 33 virtual ~AwRenderViewHostExtClient() {} |
32 }; | 34 }; |
33 | 35 |
34 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 36 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
35 // IPC messages to the renderer and from there to WebKit. | 37 // IPC messages to the renderer and from there to WebKit. |
36 class AwRenderViewHostExt : public content::WebContentsObserver, | 38 class AwRenderViewHostExt : public content::WebContentsObserver, |
37 public base::NonThreadSafe { | 39 public base::NonThreadSafe { |
38 public: | 40 public: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 virtual void RenderViewCreated(content::RenderViewHost* view_host) OVERRIDE; | 84 virtual void RenderViewCreated(content::RenderViewHost* view_host) OVERRIDE; |
83 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 85 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
84 virtual void DidNavigateAnyFrame( | 86 virtual void DidNavigateAnyFrame( |
85 const content::LoadCommittedDetails& details, | 87 const content::LoadCommittedDetails& details, |
86 const content::FrameNavigateParams& params) OVERRIDE; | 88 const content::FrameNavigateParams& params) OVERRIDE; |
87 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 89 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
88 | 90 |
89 void OnDocumentHasImagesResponse(int msg_id, bool has_images); | 91 void OnDocumentHasImagesResponse(int msg_id, bool has_images); |
90 void OnUpdateHitTestData(const AwHitTestData& hit_test_data); | 92 void OnUpdateHitTestData(const AwHitTestData& hit_test_data); |
91 void OnPageScaleFactorChanged(float page_scale_factor); | 93 void OnPageScaleFactorChanged(float page_scale_factor); |
| 94 void OnContentsSizeChanged(const gfx::Size& contents_size); |
92 | 95 |
93 bool IsRenderViewReady() const; | 96 bool IsRenderViewReady() const; |
94 | 97 |
95 AwRenderViewHostExtClient* client_; | 98 AwRenderViewHostExtClient* client_; |
96 | 99 |
97 SkColor background_color_; | 100 SkColor background_color_; |
98 | 101 |
99 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; | 102 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; |
100 | 103 |
101 // Master copy of hit test data on the browser side. This is updated | 104 // Master copy of hit test data on the browser side. This is updated |
102 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged | 105 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged |
103 // is called in AwRenderViewExt. | 106 // is called in AwRenderViewExt. |
104 AwHitTestData last_hit_test_data_; | 107 AwHitTestData last_hit_test_data_; |
105 | 108 |
106 bool has_new_hit_test_data_; | 109 bool has_new_hit_test_data_; |
107 | 110 |
108 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); | 111 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); |
109 }; | 112 }; |
110 | 113 |
111 } // namespace android_webview | 114 } // namespace android_webview |
112 | 115 |
113 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 116 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
OLD | NEW |