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

Unified Diff: net/url_request/url_request.cc

Issue 9865018: Enable cookies per default in net. Add an API to disable them by default, and do that in Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
« net/url_request/url_request.h ('K') | « net/url_request/url_request.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request.cc
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 4c2e2c35385be5fd4baa4fe832b27a35bc6c1822..41a30cb0d5818241c6c639713a3dd1ee773616f7 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -64,6 +64,12 @@ uint64 GenerateURLRequestIdentifier() {
return g_next_url_request_identifier++;
}
+// True once the first URLRequest was started.
+bool g_url_requests_started = false;
+
+// True if cookies are accepted by default.
+bool g_default_cookie_policy = true;
wtc 2012/03/28 17:51:05 This variable name does not sound like a boolean.
jochen (gone - plz use gerrit) 2012/03/29 18:33:24 Done.
+
} // namespace
URLRequest::ProtocolFactory*
@@ -321,6 +327,12 @@ int URLRequest::GetResponseCode() {
}
// static
+void URLRequest::SetDefaultCookiePolicyToBlock() {
+ CHECK(!g_url_requests_started);
+ g_default_cookie_policy = false;
+}
+
+// static
bool URLRequest::IsHandledProtocol(const std::string& scheme) {
return URLRequestJobManager::GetInstance()->SupportsScheme(scheme);
}
@@ -379,6 +391,7 @@ void URLRequest::set_delegate(Delegate* delegate) {
}
void URLRequest::Start() {
+ g_url_requests_started = true;
response_info_.request_time = Time::Now();
// Only notify the delegate for the initial request.
@@ -819,7 +832,7 @@ bool URLRequest::CanGetCookies(const CookieList& cookie_list) const {
return context_->network_delegate()->NotifyReadingCookies(this,
cookie_list);
}
- return false;
wtc 2012/03/28 17:51:05 IMPORTANT: this means the original code is more st
+ return g_default_cookie_policy;
}
bool URLRequest::CanSetCookie(const std::string& cookie_line,
@@ -830,7 +843,7 @@ bool URLRequest::CanSetCookie(const std::string& cookie_line,
cookie_line,
options);
}
- return false;
+ return g_default_cookie_policy;
}
« net/url_request/url_request.h ('K') | « net/url_request/url_request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698