summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/google_url_tracker.cc6
-rw-r--r--net/base/load_flags.h4
-rw-r--r--net/url_request/url_request_http_job.cc18
3 files changed, 19 insertions, 9 deletions
diff --git a/chrome/browser/google_url_tracker.cc b/chrome/browser/google_url_tracker.cc
index be092c6..6bab5ec 100644
--- a/chrome/browser/google_url_tracker.cc
+++ b/chrome/browser/google_url_tracker.cc
@@ -120,7 +120,11 @@ void GoogleURLTracker::StartFetchIfDesirable() {
// run of the browser.
fetcher_.reset(new URLFetcher(GURL(kDefaultGoogleHomepage), URLFetcher::HEAD,
this));
- fetcher_->set_load_flags(net::LOAD_DISABLE_CACHE);
+ // We don't want this fetch to affect existing state in the profile. For
+ // example, if a user has no Google cookies, this automatic check should not
+ // cause one to be set, lest we alarm the user.
+ fetcher_->set_load_flags(net::LOAD_DISABLE_CACHE |
+ net::LOAD_DO_NOT_SAVE_COOKIES);
fetcher_->set_request_context(Profile::GetDefaultRequestContext());
fetcher_->Start();
}
diff --git a/net/base/load_flags.h b/net/base/load_flags.h
index 5df2d69..7ca5ffb 100644
--- a/net/base/load_flags.h
+++ b/net/base/load_flags.h
@@ -56,6 +56,10 @@ enum {
// If present, ignores wrong key usage of the certificate
// (The default behavior is to trigger an OnSSLCertificateError callback).
LOAD_IGNORE_CERT_WRONG_USAGE = 1 << 12,
+
+ // This load will not make any changes to cookies, including storing new
+ // cookies or updating existing ones.
+ LOAD_DO_NOT_SAVE_COOKIES = 1 << 13,
};
} // namespace net
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 303d245..8316e73 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -8,6 +8,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "net/base/cookie_monster.h"
+#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/http/http_response_info.h"
@@ -402,14 +403,15 @@ void URLRequestHttpJob::NotifyHeadersComplete() {
response_info_ = transaction_->GetResponseInfo();
// Get the Set-Cookie values, and send them to our cookie database.
-
- FetchResponseCookies();
-
- URLRequestContext* ctx = request_->context();
- if (ctx && ctx->cookie_store() &&
- ctx->cookie_policy()->CanSetCookie(request_->url(),
- request_->policy_url()))
- ctx->cookie_store()->SetCookies(request_->url(), response_cookies_);
+ if (!(request_info_.load_flags & net::LOAD_DO_NOT_SAVE_COOKIES)) {
+ URLRequestContext* ctx = request_->context();
+ if (ctx && ctx->cookie_store() &&
+ ctx->cookie_policy()->CanSetCookie(request_->url(),
+ request_->policy_url())) {
+ FetchResponseCookies();
+ ctx->cookie_store()->SetCookies(request_->url(), response_cookies_);
+ }
+ }
URLRequestJob::NotifyHeadersComplete();
}