| 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 "chrome/browser/guest_view/web_view/web_view_guest.h" | 5 #include "chrome/browser/guest_view/web_view/web_view_guest.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 | 1056 |
| 1057 void WebViewGuest::NavigateGuest(const std::string& src) { | 1057 void WebViewGuest::NavigateGuest(const std::string& src) { |
| 1058 GURL url = ResolveURL(src); | 1058 GURL url = ResolveURL(src); |
| 1059 | 1059 |
| 1060 // Do not allow navigating a guest to schemes other than known safe schemes. | 1060 // Do not allow navigating a guest to schemes other than known safe schemes. |
| 1061 // This will block the embedder trying to load unwanted schemes, e.g. | 1061 // This will block the embedder trying to load unwanted schemes, e.g. |
| 1062 // chrome://settings. | 1062 // chrome://settings. |
| 1063 bool scheme_is_blocked = | 1063 bool scheme_is_blocked = |
| 1064 (!content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 1064 (!content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 1065 url.scheme()) && | 1065 url.scheme()) && |
| 1066 !url.SchemeIs(content::kAboutScheme)) || | 1066 !url.SchemeIs(url::kAboutScheme)) || |
| 1067 url.SchemeIs(url::kJavaScriptScheme); | 1067 url.SchemeIs(url::kJavaScriptScheme); |
| 1068 if (scheme_is_blocked || !url.is_valid()) { | 1068 if (scheme_is_blocked || !url.is_valid()) { |
| 1069 std::string error_type(net::ErrorToString(net::ERR_ABORTED)); | 1069 std::string error_type(net::ErrorToString(net::ERR_ABORTED)); |
| 1070 DCHECK(StartsWithASCII(error_type, "net::", true)); | 1070 DCHECK(StartsWithASCII(error_type, "net::", true)); |
| 1071 error_type.erase(0, 5); | 1071 error_type.erase(0, 5); |
| 1072 LoadAbort(true /* is_top_level */, url, error_type); | 1072 LoadAbort(true /* is_top_level */, url, error_type); |
| 1073 return; | 1073 return; |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 GURL validated_url(url); | 1076 GURL validated_url(url); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 bool allow, | 1415 bool allow, |
| 1416 const std::string& user_input) { | 1416 const std::string& user_input) { |
| 1417 WebViewGuest* guest = | 1417 WebViewGuest* guest = |
| 1418 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); | 1418 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); |
| 1419 if (!guest) | 1419 if (!guest) |
| 1420 return; | 1420 return; |
| 1421 | 1421 |
| 1422 if (!allow) | 1422 if (!allow) |
| 1423 guest->Destroy(); | 1423 guest->Destroy(); |
| 1424 } | 1424 } |
| OLD | NEW |