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 #include "android_webview/common/aw_hit_test_data.h" | 5 #include "android_webview/common/aw_hit_test_data.h" |
6 #include "android_webview/common/render_view_messages.h" | 6 #include "android_webview/common/render_view_messages.h" |
7 #include "android_webview/renderer/aw_render_frame_ext.h" | 7 #include "android_webview/renderer/aw_render_frame_ext.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/public/renderer/android_content_detection_prefixes.h" | 9 #include "content/public/renderer/android_content_detection_prefixes.h" |
10 #include "content/public/renderer/document_state.h" | 10 #include "content/public/renderer/document_state.h" |
11 #include "content/public/renderer/render_frame.h" | 11 #include "content/public/renderer/render_frame.h" |
12 #include "content/public/renderer/render_view.h" | 12 #include "content/public/renderer/render_view.h" |
13 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 13 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
14 #include "third_party/WebKit/public/platform/WebSize.h" | 14 #include "third_party/WebKit/public/platform/WebSize.h" |
15 #include "third_party/WebKit/public/web/WebDocument.h" | 15 #include "third_party/WebKit/public/web/WebDocument.h" |
16 #include "third_party/WebKit/public/web/WebElement.h" | 16 #include "third_party/WebKit/public/web/WebElement.h" |
17 #include "third_party/WebKit/public/web/WebElementCollection.h" | 17 #include "third_party/WebKit/public/web/WebElementCollection.h" |
| 18 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
18 #include "third_party/WebKit/public/web/WebHitTestResult.h" | 19 #include "third_party/WebKit/public/web/WebHitTestResult.h" |
19 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 20 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
20 #include "third_party/WebKit/public/web/WebMeaningfulLayout.h" | 21 #include "third_party/WebKit/public/web/WebMeaningfulLayout.h" |
21 #include "third_party/WebKit/public/web/WebNode.h" | 22 #include "third_party/WebKit/public/web/WebNode.h" |
22 #include "third_party/WebKit/public/web/WebView.h" | 23 #include "third_party/WebKit/public/web/WebView.h" |
23 #include "url/url_canon.h" | 24 #include "url/url_canon.h" |
24 #include "url/url_constants.h" | 25 #include "url/url_constants.h" |
25 #include "url/url_util.h" | 26 #include "url/url_util.h" |
26 | 27 |
27 namespace android_webview { | 28 namespace android_webview { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 247 |
247 void AwRenderFrameExt::OnSetInitialPageScale(double page_scale_factor) { | 248 void AwRenderFrameExt::OnSetInitialPageScale(double page_scale_factor) { |
248 blink::WebView* webview = GetWebView(); | 249 blink::WebView* webview = GetWebView(); |
249 if (!webview) | 250 if (!webview) |
250 return; | 251 return; |
251 | 252 |
252 webview->setInitialPageScaleOverride(page_scale_factor); | 253 webview->setInitialPageScaleOverride(page_scale_factor); |
253 } | 254 } |
254 | 255 |
255 void AwRenderFrameExt::OnSetBackgroundColor(SkColor c) { | 256 void AwRenderFrameExt::OnSetBackgroundColor(SkColor c) { |
256 blink::WebView* webview = GetWebView(); | 257 blink::WebFrameWidget* web_frame_widget = GetWebFrameWidget(); |
257 if (!webview) | 258 if (!web_frame_widget) |
258 return; | 259 return; |
259 | 260 |
260 webview->setBaseBackgroundColor(c); | 261 web_frame_widget->setBaseBackgroundColor(c); |
261 } | 262 } |
262 | 263 |
263 void AwRenderFrameExt::OnSmoothScroll(int target_x, | 264 void AwRenderFrameExt::OnSmoothScroll(int target_x, |
264 int target_y, | 265 int target_y, |
265 int duration_ms) { | 266 int duration_ms) { |
266 blink::WebView* webview = GetWebView(); | 267 blink::WebView* webview = GetWebView(); |
267 if (!webview) | 268 if (!webview) |
268 return; | 269 return; |
269 | 270 |
270 webview->smoothScroll(target_x, target_y, static_cast<long>(duration_ms)); | 271 webview->smoothScroll(target_x, target_y, static_cast<long>(duration_ms)); |
271 } | 272 } |
272 | 273 |
273 blink::WebView* AwRenderFrameExt::GetWebView() { | 274 blink::WebView* AwRenderFrameExt::GetWebView() { |
274 if (!render_frame() || !render_frame()->GetRenderView() || | 275 if (!render_frame() || !render_frame()->GetRenderView() || |
275 !render_frame()->GetRenderView()->GetWebView()) | 276 !render_frame()->GetRenderView()->GetWebView()) |
276 return nullptr; | 277 return nullptr; |
277 | 278 |
278 return render_frame()->GetRenderView()->GetWebView(); | 279 return render_frame()->GetRenderView()->GetWebView(); |
279 } | 280 } |
280 | 281 |
| 282 blink::WebFrameWidget* AwRenderFrameExt::GetWebFrameWidget() { |
| 283 if (!render_frame() || !render_frame()->GetRenderView()) |
| 284 return nullptr; |
| 285 |
| 286 return render_frame()->GetRenderView()->GetWebFrameWidget(); |
| 287 } |
| 288 |
281 } // namespace android_webview | 289 } // namespace android_webview |
OLD | NEW |