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 #include "android_webview/renderer/aw_render_view_ext.h" | 5 #include "android_webview/renderer/aw_render_view_ext.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "android_webview/common/aw_hit_test_data.h" | 9 #include "android_webview/common/aw_hit_test_data.h" |
10 #include "android_webview/common/render_view_messages.h" | 10 #include "android_webview/common/render_view_messages.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 bool AwRenderViewExt::OnMessageReceived(const IPC::Message& message) { | 160 bool AwRenderViewExt::OnMessageReceived(const IPC::Message& message) { |
161 bool handled = true; | 161 bool handled = true; |
162 IPC_BEGIN_MESSAGE_MAP(AwRenderViewExt, message) | 162 IPC_BEGIN_MESSAGE_MAP(AwRenderViewExt, message) |
163 IPC_MESSAGE_HANDLER(AwViewMsg_DocumentHasImages, OnDocumentHasImagesRequest) | 163 IPC_MESSAGE_HANDLER(AwViewMsg_DocumentHasImages, OnDocumentHasImagesRequest) |
164 IPC_MESSAGE_HANDLER(AwViewMsg_DoHitTest, OnDoHitTest) | 164 IPC_MESSAGE_HANDLER(AwViewMsg_DoHitTest, OnDoHitTest) |
165 IPC_MESSAGE_HANDLER(AwViewMsg_SetTextZoomFactor, OnSetTextZoomFactor) | 165 IPC_MESSAGE_HANDLER(AwViewMsg_SetTextZoomFactor, OnSetTextZoomFactor) |
166 IPC_MESSAGE_HANDLER(AwViewMsg_ResetScrollAndScaleState, | 166 IPC_MESSAGE_HANDLER(AwViewMsg_ResetScrollAndScaleState, |
167 OnResetScrollAndScaleState) | 167 OnResetScrollAndScaleState) |
168 IPC_MESSAGE_HANDLER(AwViewMsg_SetInitialPageScale, OnSetInitialPageScale) | 168 IPC_MESSAGE_HANDLER(AwViewMsg_SetInitialPageScale, OnSetInitialPageScale) |
169 IPC_MESSAGE_HANDLER(AwViewMsg_SetBackgroundColor, OnSetBackgroundColor) | 169 IPC_MESSAGE_HANDLER(AwViewMsg_SetBackgroundColor, OnSetBackgroundColor) |
| 170 IPC_MESSAGE_HANDLER(AwViewMsg_SmoothScroll, OnSmoothScroll) |
170 IPC_MESSAGE_UNHANDLED(handled = false) | 171 IPC_MESSAGE_UNHANDLED(handled = false) |
171 IPC_END_MESSAGE_MAP() | 172 IPC_END_MESSAGE_MAP() |
172 return handled; | 173 return handled; |
173 } | 174 } |
174 | 175 |
175 void AwRenderViewExt::OnDocumentHasImagesRequest(int id) { | 176 void AwRenderViewExt::OnDocumentHasImagesRequest(int id) { |
176 bool hasImages = false; | 177 bool hasImages = false; |
177 if (render_view()) { | 178 if (render_view()) { |
178 blink::WebView* webview = render_view()->GetWebView(); | 179 blink::WebView* webview = render_view()->GetWebView(); |
179 if (webview) { | 180 if (webview) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 render_view()->GetWebView()->setInitialPageScaleOverride( | 314 render_view()->GetWebView()->setInitialPageScaleOverride( |
314 page_scale_factor); | 315 page_scale_factor); |
315 } | 316 } |
316 | 317 |
317 void AwRenderViewExt::OnSetBackgroundColor(SkColor c) { | 318 void AwRenderViewExt::OnSetBackgroundColor(SkColor c) { |
318 if (!render_view() || !render_view()->GetWebView()) | 319 if (!render_view() || !render_view()->GetWebView()) |
319 return; | 320 return; |
320 render_view()->GetWebView()->setBaseBackgroundColor(c); | 321 render_view()->GetWebView()->setBaseBackgroundColor(c); |
321 } | 322 } |
322 | 323 |
| 324 void AwRenderViewExt::OnSmoothScroll(int target_x, |
| 325 int target_y, |
| 326 long duration_ms) { |
| 327 if (!render_view() || !render_view()->GetWebView()) |
| 328 return; |
| 329 |
| 330 render_view()->GetWebView()->smoothScroll(target_x, target_y, duration_ms); |
| 331 } |
| 332 |
323 } // namespace android_webview | 333 } // namespace android_webview |
OLD | NEW |