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

Unified Diff: content/browser/renderer_host/resource_dispatcher_host.cc

Issue 6992081: Make --allow-cross-domain-auth-prompt equivalent to a preference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/resource_dispatcher_host.cc
===================================================================
--- content/browser/renderer_host/resource_dispatcher_host.cc (revision 86721)
+++ content/browser/renderer_host/resource_dispatcher_host.cc (working copy)
@@ -236,32 +236,6 @@
#pragma warning(default: 4748)
#endif
-// Relationship of resource being authenticated with the top level page.
-enum HttpAuthResourceType {
- HTTP_AUTH_RESOURCE_TOP, // Top-level page itself
- HTTP_AUTH_RESOURCE_SAME_DOMAIN, // Sub-content from same domain
- HTTP_AUTH_RESOURCE_BLOCKED_CROSS, // Blocked Sub-content from cross domain
- HTTP_AUTH_RESOURCE_ALLOWED_CROSS, // Allowed Sub-content per command line
- HTTP_AUTH_RESOURCE_LAST
-};
-
-HttpAuthResourceType HttpAuthResourceTypeOf(net::URLRequest* request) {
- // Use the same critera as for cookies to determine the sub-resource type
- // that is requesting to be authenticated.
- if (!request->first_party_for_cookies().is_valid())
- return HTTP_AUTH_RESOURCE_TOP;
-
- if (net::RegistryControlledDomainService::SameDomainOrHost(
- request->first_party_for_cookies(), request->url()))
- return HTTP_AUTH_RESOURCE_SAME_DOMAIN;
-
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAllowCrossOriginAuthPrompt))
- return HTTP_AUTH_RESOURCE_ALLOWED_CROSS;
-
- return HTTP_AUTH_RESOURCE_BLOCKED_CROSS;
-}
-
} // namespace
ResourceDispatcherHost::ResourceDispatcherHost(
@@ -279,7 +253,8 @@
max_outstanding_requests_cost_per_process_(
kMaxOutstandingRequestsCostPerProcess),
filter_(NULL),
- observer_(NULL) {
+ observer_(NULL),
+ allow_cross_origin_auth_prompt_(false) {
resource_queue_.Initialize(resource_queue_delegates);
}
@@ -2022,3 +1997,30 @@
// static
bool ResourceDispatcherHost::is_prefetch_enabled_ = false;
+
+ResourceDispatcherHost::HttpAuthResourceType
+ResourceDispatcherHost::HttpAuthResourceTypeOf(net::URLRequest* request) {
+ // Use the same critera as for cookies to determine the sub-resource type
+ // that is requesting to be authenticated.
+ if (!request->first_party_for_cookies().is_valid())
+ return HTTP_AUTH_RESOURCE_TOP;
+
+ if (net::RegistryControlledDomainService::SameDomainOrHost(
+ request->first_party_for_cookies(), request->url()))
+ return HTTP_AUTH_RESOURCE_SAME_DOMAIN;
+
+ if (allow_cross_origin_auth_prompt())
+ return HTTP_AUTH_RESOURCE_ALLOWED_CROSS;
+
+ return HTTP_AUTH_RESOURCE_BLOCKED_CROSS;
+}
+
+bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() {
+ return allow_cross_origin_auth_prompt_;
+}
+
+void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) {
+ allow_cross_origin_auth_prompt_ = value;
+}
+
+
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698