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/debug/stack_trace.h" | 7 #include "base/debug/stack_trace.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 void WebViewGuest::NavigateGuest(const std::string& src) { | 1065 void WebViewGuest::NavigateGuest(const std::string& src) { |
1066 GURL url = ResolveURL(src); | 1066 GURL url = ResolveURL(src); |
1067 | 1067 |
1068 // Do not allow navigating a guest to schemes other than known safe schemes. | 1068 // Do not allow navigating a guest to schemes other than known safe schemes. |
1069 // This will block the embedder trying to load unwanted schemes, e.g. | 1069 // This will block the embedder trying to load unwanted schemes, e.g. |
1070 // chrome://settings. | 1070 // chrome://settings. |
1071 bool scheme_is_blocked = | 1071 bool scheme_is_blocked = |
1072 (!content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 1072 (!content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
1073 url.scheme()) && | 1073 url.scheme()) && |
1074 !url.SchemeIs(content::kAboutScheme)) || | 1074 !url.SchemeIs(content::kAboutScheme)) || |
1075 url.SchemeIs(content::kJavaScriptScheme); | 1075 url.SchemeIs(url::kJavaScriptScheme); |
1076 if (scheme_is_blocked || !url.is_valid()) { | 1076 if (scheme_is_blocked || !url.is_valid()) { |
1077 std::string error_type; | 1077 std::string error_type; |
1078 base::RemoveChars(net::ErrorToString(net::ERR_ABORTED), "net::", | 1078 base::RemoveChars(net::ErrorToString(net::ERR_ABORTED), "net::", |
1079 &error_type); | 1079 &error_type); |
1080 LoadAbort(true /* is_top_level */, url, error_type); | 1080 LoadAbort(true /* is_top_level */, url, error_type); |
1081 return; | 1081 return; |
1082 } | 1082 } |
1083 | 1083 |
1084 GURL validated_url(url); | 1084 GURL validated_url(url); |
1085 guest_web_contents()->GetRenderProcessHost()-> | 1085 guest_web_contents()->GetRenderProcessHost()-> |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 bool allow, | 1410 bool allow, |
1411 const std::string& user_input) { | 1411 const std::string& user_input) { |
1412 WebViewGuest* guest = | 1412 WebViewGuest* guest = |
1413 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); | 1413 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); |
1414 if (!guest) | 1414 if (!guest) |
1415 return; | 1415 return; |
1416 | 1416 |
1417 if (!allow) | 1417 if (!allow) |
1418 guest->Destroy(); | 1418 guest->Destroy(); |
1419 } | 1419 } |
OLD | NEW |