Chromium Code Reviews| 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 if (webview) { | 160 if (webview) { |
| 161 WebKit::WebVector<WebKit::WebElement> images; | 161 WebKit::WebVector<WebKit::WebElement> images; |
| 162 webview->mainFrame()->document().images(images); | 162 webview->mainFrame()->document().images(images); |
| 163 hasImages = !images.isEmpty(); | 163 hasImages = !images.isEmpty(); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 Send(new AwViewHostMsg_DocumentHasImagesResponse(routing_id(), id, | 166 Send(new AwViewHostMsg_DocumentHasImagesResponse(routing_id(), id, |
| 167 hasImages)); | 167 hasImages)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool AwRenderViewExt::allowImage(WebKit::WebFrame* frame, | |
| 171 bool enabled_per_settings, | |
| 172 const WebKit::WebURL& image_url) { | |
|
abarth-chromium
2013/06/13 18:20:10
Oh, it's great that you don't need this override a
joth
2013/06/14 00:25:25
Hmmm I looked again, and I'm not sure we don't?
Th
| |
| 173 // Implementing setBlockNetworkImages, so allow local scheme images to be | |
| 174 // loaded. | |
| 175 if (enabled_per_settings) | |
| 176 return true; | |
| 177 | |
| 178 // For compatibility, only blacklist network schemes instead of whitelisting. | |
| 179 const GURL url(image_url); | |
| 180 return !(url.SchemeIs(chrome::kHttpScheme) || | |
| 181 url.SchemeIs(chrome::kHttpsScheme) || | |
| 182 url.SchemeIs(chrome::kFtpScheme)); | |
| 183 } | |
| 184 | |
| 185 void AwRenderViewExt::DidCommitProvisionalLoad(WebKit::WebFrame* frame, | 170 void AwRenderViewExt::DidCommitProvisionalLoad(WebKit::WebFrame* frame, |
| 186 bool is_new_navigation) { | 171 bool is_new_navigation) { |
| 187 content::DocumentState* document_state = | 172 content::DocumentState* document_state = |
| 188 content::DocumentState::FromDataSource(frame->dataSource()); | 173 content::DocumentState::FromDataSource(frame->dataSource()); |
| 189 if (document_state->can_load_local_resources()) { | 174 if (document_state->can_load_local_resources()) { |
| 190 WebKit::WebSecurityOrigin origin = frame->document().securityOrigin(); | 175 WebKit::WebSecurityOrigin origin = frame->document().securityOrigin(); |
| 191 origin.grantLoadLocalResources(); | 176 origin.grantLoadLocalResources(); |
| 192 } | 177 } |
| 193 } | 178 } |
| 194 | 179 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 } | 254 } |
| 270 | 255 |
| 271 void AwRenderViewExt::OnSetInitialPageScale(double page_scale_factor) { | 256 void AwRenderViewExt::OnSetInitialPageScale(double page_scale_factor) { |
| 272 if (!render_view() || !render_view()->GetWebView()) | 257 if (!render_view() || !render_view()->GetWebView()) |
| 273 return; | 258 return; |
| 274 render_view()->GetWebView()->setInitialPageScaleOverride( | 259 render_view()->GetWebView()->setInitialPageScaleOverride( |
| 275 page_scale_factor); | 260 page_scale_factor); |
| 276 } | 261 } |
| 277 | 262 |
| 278 } // namespace android_webview | 263 } // namespace android_webview |
| OLD | NEW |