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

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

Issue 246533006: Block renderer-initiated navigation to other chrome URLs on signin page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 const Extension* from_extension = 1143 const Extension* from_extension =
1144 service->extensions()->GetExtensionOrAppByURL( 1144 service->extensions()->GetExtensionOrAppByURL(
1145 site_instance->GetSiteURL()); 1145 site_instance->GetSiteURL());
1146 if (from_extension && from_extension->id() == extension->id()) 1146 if (from_extension && from_extension->id() == extension->id())
1147 return true; 1147 return true;
1148 1148
1149 if (!extensions::WebAccessibleResourcesInfo::IsResourceWebAccessible( 1149 if (!extensions::WebAccessibleResourcesInfo::IsResourceWebAccessible(
1150 extension, url.path())) 1150 extension, url.path()))
1151 return false; 1151 return false;
1152 } 1152 }
1153
1154 // Do not allow chrome://chrome-signin navigate to other chrome:// URLs, since
1155 // the signin page may host untrusted web content.
1156 if (from_url.GetOrigin().spec() == chrome::kChromeUIChromeSigninURL &&
1157 url.SchemeIs(content::kChromeUIScheme) &&
1158 url.host() != chrome::kChromeUIChromeSigninHost) {
1159 VLOG(1) << "Blocked navigation to " << url.spec() << " from "
1160 << chrome::kChromeUIChromeSigninURL;
1161 return false;
1162 }
1163
1153 return true; 1164 return true;
1154 } 1165 }
1155 1166
1156 bool ChromeContentBrowserClient::IsSuitableHost( 1167 bool ChromeContentBrowserClient::IsSuitableHost(
1157 content::RenderProcessHost* process_host, 1168 content::RenderProcessHost* process_host,
1158 const GURL& site_url) { 1169 const GURL& site_url) {
1159 Profile* profile = 1170 Profile* profile =
1160 Profile::FromBrowserContext(process_host->GetBrowserContext()); 1171 Profile::FromBrowserContext(process_host->GetBrowserContext());
1161 // This may be NULL during tests. In that case, just assume any site can 1172 // This may be NULL during tests. In that case, just assume any site can
1162 // share any host. 1173 // share any host.
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 switches::kDisableWebRtcEncryption, 2689 switches::kDisableWebRtcEncryption,
2679 }; 2690 };
2680 to_command_line->CopySwitchesFrom(from_command_line, 2691 to_command_line->CopySwitchesFrom(from_command_line,
2681 kWebRtcDevSwitchNames, 2692 kWebRtcDevSwitchNames,
2682 arraysize(kWebRtcDevSwitchNames)); 2693 arraysize(kWebRtcDevSwitchNames));
2683 } 2694 }
2684 } 2695 }
2685 #endif // defined(ENABLE_WEBRTC) 2696 #endif // defined(ENABLE_WEBRTC)
2686 2697
2687 } // namespace chrome 2698 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698