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 "content/browser/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 GURL url = delegate_ ? delegate_->ResolveURL(src) : GURL(src); | 1250 GURL url = delegate_ ? delegate_->ResolveURL(src) : GURL(src); |
1251 | 1251 |
1252 // Do not allow navigating a guest to schemes other than known safe schemes. | 1252 // Do not allow navigating a guest to schemes other than known safe schemes. |
1253 // This will block the embedder trying to load unwanted schemes, e.g. | 1253 // This will block the embedder trying to load unwanted schemes, e.g. |
1254 // chrome://settings. | 1254 // chrome://settings. |
1255 bool scheme_is_blocked = | 1255 bool scheme_is_blocked = |
1256 (!ChildProcessSecurityPolicyImpl::GetInstance()->IsWebSafeScheme( | 1256 (!ChildProcessSecurityPolicyImpl::GetInstance()->IsWebSafeScheme( |
1257 url.scheme()) && | 1257 url.scheme()) && |
1258 !ChildProcessSecurityPolicyImpl::GetInstance()->IsPseudoScheme( | 1258 !ChildProcessSecurityPolicyImpl::GetInstance()->IsPseudoScheme( |
1259 url.scheme())) || | 1259 url.scheme())) || |
1260 url.SchemeIs(kJavaScriptScheme); | 1260 url.SchemeIs(url::kJavaScriptScheme); |
1261 if (scheme_is_blocked || !url.is_valid()) { | 1261 if (scheme_is_blocked || !url.is_valid()) { |
1262 if (delegate_) { | 1262 if (delegate_) { |
1263 std::string error_type; | 1263 std::string error_type; |
1264 base::RemoveChars(net::ErrorToString(net::ERR_ABORTED), "net::", | 1264 base::RemoveChars(net::ErrorToString(net::ERR_ABORTED), "net::", |
1265 &error_type); | 1265 &error_type); |
1266 delegate_->LoadAbort(true /* is_top_level */, url, error_type); | 1266 delegate_->LoadAbort(true /* is_top_level */, url, error_type); |
1267 } | 1267 } |
1268 return; | 1268 return; |
1269 } | 1269 } |
1270 | 1270 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 const GURL& url) { | 1557 const GURL& url) { |
1558 if (!url.is_valid()) { | 1558 if (!url.is_valid()) { |
1559 callback.Run(false); | 1559 callback.Run(false); |
1560 return; | 1560 return; |
1561 } | 1561 } |
1562 | 1562 |
1563 delegate_->CanDownload(request_method, url, callback); | 1563 delegate_->CanDownload(request_method, url, callback); |
1564 } | 1564 } |
1565 | 1565 |
1566 } // namespace content | 1566 } // namespace content |
OLD | NEW |