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

Unified Diff: chrome/browser/net/preconnect.cc

Issue 1131293004: Add cross origin to Blink-driven preconnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Ryan's concerns Created 5 years, 5 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 | « chrome/browser/net/preconnect.h ('k') | chrome/browser/net/predictor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/preconnect.cc
diff --git a/chrome/browser/net/preconnect.cc b/chrome/browser/net/preconnect.cc
index dfa91a3195341b58603112fbae57b665a2d314b5..17673c31bed256fdd2dc02dca27964b8938d7905 100644
--- a/chrome/browser/net/preconnect.cc
+++ b/chrome/browser/net/preconnect.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "content/public/browser/browser_thread.h"
+#include "net/base/load_flags.h"
#include "net/http/http_network_session.h"
#include "net/http/http_request_info.h"
#include "net/http/http_stream_factory.h"
@@ -30,20 +31,18 @@ void PreconnectOnUIThread(
net::URLRequestContextGetter* getter) {
// Prewarm connection to Search URL.
BrowserThread::PostTask(
- BrowserThread::IO,
- FROM_HERE,
+ BrowserThread::IO, FROM_HERE,
base::Bind(&PreconnectOnIOThread, url, first_party_for_cookies,
- motivation, count, make_scoped_refptr(getter)));
+ motivation, count, make_scoped_refptr(getter), true));
return;
}
-
-void PreconnectOnIOThread(
- const GURL& url,
- const GURL& first_party_for_cookies,
- UrlInfo::ResolutionMotivation motivation,
- int count,
- net::URLRequestContextGetter* getter) {
+void PreconnectOnIOThread(const GURL& url,
+ const GURL& first_party_for_cookies,
+ UrlInfo::ResolutionMotivation motivation,
+ int count,
+ net::URLRequestContextGetter* getter,
+ bool allow_credentials) {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
LOG(DFATAL) << "This must be run only on the IO thread.";
return;
@@ -71,6 +70,16 @@ void PreconnectOnIOThread(
if (delegate->CanEnablePrivacyMode(url, first_party_for_cookies))
request_info.privacy_mode = net::PRIVACY_MODE_ENABLED;
mmenke 2015/07/24 15:48:20 Setting the load flags for only some privacy mode
Ryan Sleevi 2015/07/24 16:32:26 Fundamentally, yes. At the lower layer, we basical
+ // TODO(yoav): Fix this layering violation, since when credentials are not
+ // allowed we should turn on a flag indicating that, rather then turn on
+ // private mode, even if lower layers would treat both the same.
+ if (!allow_credentials) {
+ request_info.privacy_mode = net::PRIVACY_MODE_ENABLED;
Ryan Sleevi 2015/07/24 16:32:26 I don't think you need to set this (forcing pm mod
+ request_info.load_flags = net::LOAD_DO_NOT_SEND_COOKIES |
+ net::LOAD_DO_NOT_SAVE_COOKIES |
+ net::LOAD_DO_NOT_SEND_AUTH_DATA;
+ }
+
// Translate the motivation from UrlRequest motivations to HttpRequest
// motivations.
switch (motivation) {
« no previous file with comments | « chrome/browser/net/preconnect.h ('k') | chrome/browser/net/predictor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698