Commit 8e834534 authored by Ryan Sturm's avatar Ryan Sturm Committed by Commit Bot

Respect Autocomplete setting for DSE preconnect

This adds a check to prevent DSE preconnect when the user has opted out
of DSE automplete and URL uploads.

Bug: 1036489
Change-Id: I015f4111377657193e6db99ca7bf2f809629270f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2028296Reviewed-by: default avatarRyan Sturm <ryansturm@chromium.org>
Reviewed-by: default avatarRobert Ogden <robertogden@chromium.org>
Auto-Submit: Ryan Sturm <ryansturm@chromium.org>
Commit-Queue: Robert Ogden <robertogden@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736947}
parent ba3464d1
......@@ -11,7 +11,9 @@
#include "chrome/browser/predictors/loading_predictor_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/pref_names.h"
#include "components/google/core/common/google_util.h"
#include "components/prefs/pref_service.h"
#include "components/search_engines/template_url_service.h"
#include "content/public/browser/browser_context.h"
#include "net/base/features.h"
......@@ -61,6 +63,12 @@ void SearchEnginePreconnector::PreconnectDSE() {
if (!base::FeatureList::IsEnabled(features::kPreconnectToSearch))
return;
// Don't preconnect unless the user allows search suggestions.
if (!Profile::FromBrowserContext(browser_context_)
->GetPrefs()
->GetBoolean(prefs::kSearchSuggestEnabled))
return;
GURL preconnect_url = GetDefaultSearchEngineOriginURL();
if (preconnect_url.scheme() != url::kHttpScheme &&
preconnect_url.scheme() != url::kHttpsScheme) {
......
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