Commit 3c437e51 authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Make PreviewsLitePageDecider preconnect with a NetworkIsolationKey.

Also make PreconnectManager::StartPreconnectUrl()'s NetworkIsolationKey
mandatory, as all callers are now passing one in.

Bug: 966896
Change-Id: Id10c410225c5d8248569443381856a3c12d452aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1721513
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Reviewed-by: default avatarAlex Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682815}
parent 1391b306
...@@ -152,16 +152,10 @@ class PreconnectManager { ...@@ -152,16 +152,10 @@ class PreconnectManager {
// |network_isolation_key| specifies the key that network requests for the // |network_isolation_key| specifies the key that network requests for the
// preconnected URL are expected to use. If a request is issued with a // preconnected URL are expected to use. If a request is issued with a
// different key, it may not use the preconnected socket. // different key, it may not use the preconnected socket.
//
// TODO(https://crbug.com/966896): Update consumers and make
// |network_isolation_key| a mandatory argument. Note that this is a temporary
// style guide violation, but keeping this until all consumers correctly fill
// the argument reduces the chances of forgetting to update one.
virtual void StartPreconnectUrl( virtual void StartPreconnectUrl(
const GURL& url, const GURL& url,
bool allow_credentials, bool allow_credentials,
net::NetworkIsolationKey network_isolation_key = net::NetworkIsolationKey network_isolation_key);
net::NetworkIsolationKey());
// No additional jobs keyed by the |url| will be queued after this. // No additional jobs keyed by the |url| will be queued after this.
virtual void Stop(const GURL& url); virtual void Stop(const GURL& url);
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "net/base/network_isolation_key.h"
#include "url/origin.h"
namespace { namespace {
const char kUserNeedsNotification[] = const char kUserNeedsNotification[] =
...@@ -92,8 +94,11 @@ void PreconnectToLitePagesServer(content::BrowserContext* browser_context) { ...@@ -92,8 +94,11 @@ void PreconnectToLitePagesServer(content::BrowserContext* browser_context) {
if (!loading_predictor || !loading_predictor->preconnect_manager()) if (!loading_predictor || !loading_predictor->preconnect_manager())
return; return;
url::Origin previews_origin =
url::Origin::Create(previews::params::GetLitePagePreviewsDomainURL());
loading_predictor->preconnect_manager()->StartPreconnectUrl( loading_predictor->preconnect_manager()->StartPreconnectUrl(
previews::params::GetLitePagePreviewsDomainURL(), true); previews::params::GetLitePagePreviewsDomainURL(), true,
net::NetworkIsolationKey(previews_origin, previews_origin));
} }
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment