OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "android_webview/renderer/aw_permission_client.h" |
| 6 |
| 7 #include "third_party/WebKit/public/platform/WebURL.h" |
| 8 #include "third_party/WebKit/public/web/WebFrame.h" |
| 9 #include "url/gurl.h" |
| 10 |
| 11 namespace android_webview { |
| 12 |
| 13 namespace { |
| 14 |
| 15 bool AllowMixedContent(const blink::WebURL& url) { |
| 16 // We treat non-standard schemes as "secure" in the WebView to allow them to |
| 17 // be used for request interception. |
| 18 // TODO(benm): Tighten this restriction by requiring embedders to register |
| 19 // their custom schemes? See b/9420953. |
| 20 GURL gurl(url); |
| 21 return !gurl.IsStandard(); |
| 22 } |
| 23 |
| 24 } |
| 25 |
| 26 AwPermissionClient::AwPermissionClient(content::RenderFrame* render_frame) |
| 27 : content::RenderFrameObserver(render_frame){ |
| 28 } |
| 29 |
| 30 AwPermissionClient::~AwPermissionClient() { |
| 31 } |
| 32 |
| 33 void AwPermissionClient::WebFrameCreated(blink::WebFrame* frame) { |
| 34 frame->setPermissionClient(this); |
| 35 } |
| 36 |
| 37 bool AwPermissionClient::allowDisplayingInsecureContent( |
| 38 blink::WebFrame* frame, |
| 39 bool enabled_per_settings, |
| 40 const blink::WebSecurityOrigin& origin, |
| 41 const blink::WebURL& url) { |
| 42 return enabled_per_settings ? true : AllowMixedContent(url); |
| 43 } |
| 44 |
| 45 bool AwPermissionClient::allowRunningInsecureContent( |
| 46 blink::WebFrame* frame, |
| 47 bool enabled_per_settings, |
| 48 const blink::WebSecurityOrigin& origin, |
| 49 const blink::WebURL& url) { |
| 50 return enabled_per_settings ? true : AllowMixedContent(url); |
| 51 } |
| 52 |
| 53 } // namespace android_webview |
OLD | NEW |