Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2454563003: Fix web accessible resource checks in ShouldAllowOpenURL (Closed)
Patch Set: Tighten check a bit more Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 #if defined(ENABLE_EXTENSIONS) 1189 #if defined(ENABLE_EXTENSIONS)
1190 return ChromeContentBrowserClientExtensionsPart::CanCommitURL( 1190 return ChromeContentBrowserClientExtensionsPart::CanCommitURL(
1191 process_host, url); 1191 process_host, url);
1192 #else 1192 #else
1193 return true; 1193 return true;
1194 #endif 1194 #endif
1195 } 1195 }
1196 1196
1197 bool ChromeContentBrowserClient::ShouldAllowOpenURL( 1197 bool ChromeContentBrowserClient::ShouldAllowOpenURL(
1198 content::SiteInstance* site_instance, const GURL& url) { 1198 content::SiteInstance* site_instance, const GURL& url) {
1199 GURL from_url = site_instance->GetSiteURL();
1200
1201 #if defined(ENABLE_EXTENSIONS) 1199 #if defined(ENABLE_EXTENSIONS)
1202 bool result; 1200 bool result;
1203 if (ChromeContentBrowserClientExtensionsPart::ShouldAllowOpenURL( 1201 if (ChromeContentBrowserClientExtensionsPart::ShouldAllowOpenURL(
1204 site_instance, from_url, url, &result)) 1202 site_instance, url, &result))
1205 return result; 1203 return result;
1206 #endif 1204 #endif
1207 1205
1208 // Do not allow chrome://chrome-signin navigate to other chrome:// URLs, since 1206 // Do not allow chrome://chrome-signin navigate to other chrome:// URLs, since
1209 // the signin page may host untrusted web content. 1207 // the signin page may host untrusted web content.
1208 GURL from_url = site_instance->GetSiteURL();
1210 if (from_url.GetOrigin().spec() == chrome::kChromeUIChromeSigninURL && 1209 if (from_url.GetOrigin().spec() == chrome::kChromeUIChromeSigninURL &&
1211 url.SchemeIs(content::kChromeUIScheme) && 1210 url.SchemeIs(content::kChromeUIScheme) &&
1212 url.host_piece() != chrome::kChromeUIChromeSigninHost) { 1211 url.host_piece() != chrome::kChromeUIChromeSigninHost) {
1213 VLOG(1) << "Blocked navigation to " << url.spec() << " from " 1212 VLOG(1) << "Blocked navigation to " << url.spec() << " from "
1214 << chrome::kChromeUIChromeSigninURL; 1213 << chrome::kChromeUIChromeSigninURL;
1215 return false; 1214 return false;
1216 } 1215 }
1217 1216
1218 return true; 1217 return true;
1219 } 1218 }
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
3231 kWebRtcDevSwitchNames, 3230 kWebRtcDevSwitchNames,
3232 arraysize(kWebRtcDevSwitchNames)); 3231 arraysize(kWebRtcDevSwitchNames));
3233 } 3232 }
3234 } 3233 }
3235 #endif // defined(ENABLE_WEBRTC) 3234 #endif // defined(ENABLE_WEBRTC)
3236 3235
3237 std::unique_ptr<content::MemoryCoordinatorDelegate> 3236 std::unique_ptr<content::MemoryCoordinatorDelegate>
3238 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { 3237 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() {
3239 return memory::ChromeMemoryCoordinatorDelegate::Create(); 3238 return memory::ChromeMemoryCoordinatorDelegate::Create();
3240 } 3239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698