699 lines
27 KiB
Diff
699 lines
27 KiB
Diff
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
|
Date: Mon, 12 Feb 2018 21:36:33 +0100
|
|
Subject: ungoogled-chromium: no special hosts/domains
|
|
|
|
Disables various detections of Google hosts and functionality specific to them
|
|
Disable domain reliability detection
|
|
|
|
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
|
---
|
|
.../domain_reliability/service_factory.cc | 24 +-
|
|
.../from_gws_page_load_metrics_observer.cc | 6 +-
|
|
components/domain_reliability/BUILD.gn | 42 ++-
|
|
.../domain_reliability/bake_in_configs.py | 2 +-
|
|
.../domain_reliability/context_manager.cc | 22 +-
|
|
.../domain_reliability/google_configs.cc | 10 +-
|
|
.../domain_reliability/google_configs.h | 8 +-
|
|
components/domain_reliability/uploader.cc | 2 +-
|
|
components/google/core/common/google_util.cc | 243 +-----------------
|
|
components/google/core/common/google_util.h | 5 -
|
|
.../browser/page_load_metrics_util.cc | 4 +-
|
|
.../common/page_load_metrics_util.cc | 33 +--
|
|
components/search_engines/template_url.cc | 6 +-
|
|
net/base/url_util.cc | 21 --
|
|
services/network/network_context.cc | 2 +-
|
|
15 files changed, 41 insertions(+), 389 deletions(-)
|
|
|
|
diff --git a/chrome/browser/domain_reliability/service_factory.cc b/chrome/browser/domain_reliability/service_factory.cc
|
|
--- a/chrome/browser/domain_reliability/service_factory.cc
|
|
+++ b/chrome/browser/domain_reliability/service_factory.cc
|
|
@@ -11,34 +11,12 @@
|
|
|
|
namespace domain_reliability {
|
|
|
|
-namespace {
|
|
-
|
|
-// If Domain Reliability is enabled in the absence of a flag or field trial.
|
|
-const bool kDefaultEnabled = true;
|
|
-
|
|
-// The name and value of the field trial to turn Domain Reliability on.
|
|
-const char kFieldTrialName[] = "DomRel-Enable";
|
|
-const char kFieldTrialValueEnable[] = "enable";
|
|
-
|
|
-} // namespace
|
|
-
|
|
// Identifies Chrome as the source of Domain Reliability uploads it sends.
|
|
const char DomainReliabilityServiceFactory::kUploadReporterString[] = "chrome";
|
|
|
|
// static
|
|
bool DomainReliabilityServiceFactory::ShouldCreateService() {
|
|
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
|
- if (command_line->HasSwitch(switches::kDisableDomainReliability))
|
|
- return false;
|
|
- if (command_line->HasSwitch(switches::kEnableDomainReliability))
|
|
- return true;
|
|
- if (!ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled())
|
|
- return false;
|
|
- if (base::FieldTrialList::TrialExists(kFieldTrialName)) {
|
|
- std::string value = base::FieldTrialList::FindFullName(kFieldTrialName);
|
|
- return (value == kFieldTrialValueEnable);
|
|
- }
|
|
- return kDefaultEnabled;
|
|
+ return false;
|
|
}
|
|
|
|
} // namespace domain_reliability
|
|
diff --git a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
|
|
--- a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
|
|
+++ b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
|
|
@@ -394,8 +394,7 @@ FromGWSPageLoadMetricsLogger::~FromGWSPageLoadMetricsLogger() = default;
|
|
void FromGWSPageLoadMetricsLogger::SetPreviouslyCommittedUrl(const GURL& url) {
|
|
if (page_load_metrics::IsGoogleSearchResultUrl(url)) {
|
|
previously_committed_url_is_search_results_ = true;
|
|
- navigation_initiated_search_mode_ =
|
|
- google_util::GoogleSearchModeFromUrl(url);
|
|
+ navigation_initiated_search_mode_ = google_util::GoogleSearchMode::kWeb;
|
|
}
|
|
previously_committed_url_is_search_redirector_ =
|
|
page_load_metrics::IsGoogleSearchRedirectorUrl(url);
|
|
@@ -412,8 +411,7 @@ void FromGWSPageLoadMetricsLogger::SetNavigationStateForSidePanel(
|
|
initiating_side_panel_url_ = initiating_side_panel_url;
|
|
navigation_initiated_via_link_ = navigation_initiated_via_link;
|
|
if (page_load_metrics::IsGoogleSearchResultUrl(initiating_side_panel_url)) {
|
|
- navigation_initiated_search_mode_ =
|
|
- google_util::GoogleSearchModeFromUrl(initiating_side_panel_url);
|
|
+ navigation_initiated_search_mode_ = google_util::GoogleSearchMode::kWeb;
|
|
}
|
|
}
|
|
|
|
diff --git a/components/domain_reliability/BUILD.gn b/components/domain_reliability/BUILD.gn
|
|
--- a/components/domain_reliability/BUILD.gn
|
|
+++ b/components/domain_reliability/BUILD.gn
|
|
@@ -7,26 +7,6 @@ action("bake_in_configs") {
|
|
script = "bake_in_configs.py"
|
|
|
|
inputs = [
|
|
- "baked_in_configs/c_android_clients_google_com.json",
|
|
- "baked_in_configs/c_bigcache_googleapis_com.json",
|
|
- "baked_in_configs/c_doc-0-0-sj_sj_googleusercontent_com.json",
|
|
- "baked_in_configs/c_docs_google_com.json",
|
|
- "baked_in_configs/c_drive_google_com.json",
|
|
- "baked_in_configs/c_googlesyndication_com.json",
|
|
- "baked_in_configs/c_pack_google_com.json",
|
|
- "baked_in_configs/c_play_google_com.json",
|
|
- "baked_in_configs/c_youtube_com.json",
|
|
- "baked_in_configs/clients2_google_com.json",
|
|
- "baked_in_configs/docs_google_com.json",
|
|
- "baked_in_configs/gcp_gvt2_com.json",
|
|
- "baked_in_configs/gcp_gvt6_com.json",
|
|
- "baked_in_configs/google-analytics_com.json",
|
|
- "baked_in_configs/googlevideo_com.json",
|
|
- "baked_in_configs/gvt1_com.json",
|
|
- "baked_in_configs/gvt2_com.json",
|
|
- "baked_in_configs/gvt6_com.json",
|
|
- "baked_in_configs/ssl_gstatic_com.json",
|
|
- "baked_in_configs/www_google_com.json",
|
|
]
|
|
|
|
output_file = "$target_gen_dir/baked_in_configs.cc"
|
|
@@ -34,13 +14,21 @@ action("bake_in_configs") {
|
|
|
|
# The JSON file list is too long for the command line on Windows, so put
|
|
# them in a response file.
|
|
- response_file_contents = rebase_path(inputs, root_build_dir)
|
|
- args = [
|
|
- "--file-list",
|
|
- "{{response_file_name}}",
|
|
- "--output",
|
|
- rebase_path(output_file, root_build_dir),
|
|
- ]
|
|
+ if (is_win) {
|
|
+ args = [
|
|
+ "--file-list",
|
|
+ "nul",
|
|
+ "--output",
|
|
+ rebase_path(output_file, root_build_dir),
|
|
+ ]
|
|
+ } else {
|
|
+ args = [
|
|
+ "--file-list",
|
|
+ "/dev/null",
|
|
+ "--output",
|
|
+ rebase_path(output_file, root_build_dir),
|
|
+ ]
|
|
+ }
|
|
}
|
|
|
|
component("domain_reliability") {
|
|
diff --git a/components/domain_reliability/bake_in_configs.py b/components/domain_reliability/bake_in_configs.py
|
|
--- a/components/domain_reliability/bake_in_configs.py
|
|
+++ b/components/domain_reliability/bake_in_configs.py
|
|
@@ -490,7 +490,7 @@ def origin_is_whitelisted(origin):
|
|
domain = origin[8:-1]
|
|
else:
|
|
return False
|
|
- return any(domain == e or domain.endswith('.' + e) for e in DOMAIN_WHITELIST)
|
|
+ return False
|
|
|
|
|
|
def quote_and_wrap_text(text, width=79, prefix=' "', suffix='"'):
|
|
diff --git a/components/domain_reliability/context_manager.cc b/components/domain_reliability/context_manager.cc
|
|
--- a/components/domain_reliability/context_manager.cc
|
|
+++ b/components/domain_reliability/context_manager.cc
|
|
@@ -41,26 +41,8 @@ void DomainReliabilityContextManager::RouteBeacon(
|
|
DomainReliabilityContext* superdomain_context =
|
|
GetSuperdomainContext(beacon_host);
|
|
|
|
- // Try to get a Google config which may match the host itself, or the host's
|
|
- // parent domain.
|
|
- std::unique_ptr<const DomainReliabilityConfig> google_config =
|
|
- MaybeGetGoogleConfig(beacon_host);
|
|
-
|
|
- if (!google_config) {
|
|
- if (superdomain_context)
|
|
- superdomain_context->OnBeacon(std::move(beacon));
|
|
- return;
|
|
- }
|
|
-
|
|
- context_to_use = superdomain_context;
|
|
- bool google_config_is_exact = (google_config->origin.host() == beacon_host);
|
|
-
|
|
- // An exact match takes priority over an existing superdomain context, if any
|
|
- // exists.
|
|
- if (google_config_is_exact || !context_to_use)
|
|
- context_to_use = AddContextForConfig(std::move(google_config));
|
|
-
|
|
- context_to_use->OnBeacon(std::move(beacon));
|
|
+ if (superdomain_context)
|
|
+ superdomain_context->OnBeacon(std::move(beacon));
|
|
}
|
|
|
|
void DomainReliabilityContextManager::ClearBeacons(
|
|
diff --git a/components/domain_reliability/google_configs.cc b/components/domain_reliability/google_configs.cc
|
|
--- a/components/domain_reliability/google_configs.cc
|
|
+++ b/components/domain_reliability/google_configs.cc
|
|
@@ -9,7 +9,7 @@
|
|
#include "base/strings/string_util.h"
|
|
#include "net/base/url_util.h"
|
|
|
|
-namespace domain_reliability {
|
|
+namespace domain_reliability_disabled {
|
|
|
|
namespace {
|
|
|
|
@@ -28,7 +28,7 @@ struct GoogleConfigParams {
|
|
bool duplicate_for_www;
|
|
};
|
|
|
|
-const GoogleConfigParams kGoogleConfigs[] = {
|
|
+/*const GoogleConfigParams kGoogleConfigs[] = {
|
|
// Origins with subdomains and same-origin collectors. Currently, all
|
|
// origins with same-origin collectors also run collectors on their www
|
|
// subdomain. (e.g., both foo.com and www.foo.com.)
|
|
@@ -550,11 +550,11 @@ std::unique_ptr<const DomainReliabilityConfig> CreateGoogleConfig(
|
|
config->failure_sample_rate = 1.00;
|
|
config->path_prefixes.clear();
|
|
return config;
|
|
-}
|
|
+}*/
|
|
|
|
} // namespace
|
|
|
|
-std::unique_ptr<const DomainReliabilityConfig> MaybeGetGoogleConfig(
|
|
+/*std::unique_ptr<const DomainReliabilityConfig> MaybeGetGoogleConfig(
|
|
const std::string& hostname) {
|
|
bool is_www_subdomain =
|
|
base::StartsWith(hostname, "www.", base::CompareCase::SENSITIVE);
|
|
@@ -604,6 +604,6 @@ GetAllGoogleConfigsForTesting() {
|
|
configs_out.push_back(CreateGoogleConfig(params, true));
|
|
}
|
|
return configs_out;
|
|
-}
|
|
+} */
|
|
|
|
} // namespace domain_reliability
|
|
diff --git a/components/domain_reliability/google_configs.h b/components/domain_reliability/google_configs.h
|
|
--- a/components/domain_reliability/google_configs.h
|
|
+++ b/components/domain_reliability/google_configs.h
|
|
@@ -26,11 +26,11 @@ namespace domain_reliability {
|
|
// the www subdomain. A superdomain match occurs if removing the first label of
|
|
// |hostname| yields a string equal to a Google config's hostname and that
|
|
// config specifies that it includes subdomains.
|
|
-std::unique_ptr<const DomainReliabilityConfig> DOMAIN_RELIABILITY_EXPORT
|
|
-MaybeGetGoogleConfig(const std::string& hostname);
|
|
+//std::unique_ptr<const DomainReliabilityConfig> DOMAIN_RELIABILITY_EXPORT
|
|
+//MaybeGetGoogleConfig(const std::string& hostname);
|
|
|
|
-std::vector<std::unique_ptr<const DomainReliabilityConfig>>
|
|
- DOMAIN_RELIABILITY_EXPORT GetAllGoogleConfigsForTesting();
|
|
+//std::vector<std::unique_ptr<const DomainReliabilityConfig>>
|
|
+// DOMAIN_RELIABILITY_EXPORT GetAllGoogleConfigsForTesting();
|
|
|
|
} // namespace domain_reliability
|
|
|
|
diff --git a/components/domain_reliability/uploader.cc b/components/domain_reliability/uploader.cc
|
|
--- a/components/domain_reliability/uploader.cc
|
|
+++ b/components/domain_reliability/uploader.cc
|
|
@@ -80,7 +80,7 @@ class DomainReliabilityUploaderImpl : public DomainReliabilityUploader,
|
|
if (discard_uploads_)
|
|
discarded_upload_count_++;
|
|
|
|
- if (discard_uploads_ || shutdown_) {
|
|
+ if ((true)) {
|
|
DVLOG(1) << "Discarding report instead of uploading.";
|
|
UploadResult result;
|
|
result.status = UploadResult::SUCCESS;
|
|
diff --git a/components/google/core/common/google_util.cc b/components/google/core/common/google_util.cc
|
|
--- a/components/google/core/common/google_util.cc
|
|
+++ b/components/google/core/common/google_util.cc
|
|
@@ -31,60 +31,6 @@ namespace google_util {
|
|
|
|
namespace {
|
|
|
|
-bool IsPathHomePageBase(base::StringPiece path) {
|
|
- return (path == "/") || (path == "/webhp");
|
|
-}
|
|
-
|
|
-// Removes a single trailing dot if present in |host|.
|
|
-void StripTrailingDot(base::StringPiece* host) {
|
|
- if (base::EndsWith(*host, "."))
|
|
- host->remove_suffix(1);
|
|
-}
|
|
-
|
|
-// True if the given canonical |host| is "[www.]<domain_in_lower_case>.<TLD>"
|
|
-// with a valid TLD that appears in |allowed_tlds|. If |subdomain_permission| is
|
|
-// ALLOW_SUBDOMAIN, we check against host "*.<domain_in_lower_case>.<TLD>"
|
|
-// instead.
|
|
-template <typename Container>
|
|
-bool IsValidHostName(base::StringPiece host,
|
|
- base::StringPiece domain_in_lower_case,
|
|
- SubdomainPermission subdomain_permission,
|
|
- const Container& allowed_tlds) {
|
|
- // Fast path to avoid searching the registry set.
|
|
- if (host.find(domain_in_lower_case) == base::StringPiece::npos)
|
|
- return false;
|
|
-
|
|
- size_t tld_length =
|
|
- net::registry_controlled_domains::GetCanonicalHostRegistryLength(
|
|
- host, net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
|
|
- net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
|
|
- if ((tld_length == 0) || (tld_length == std::string::npos))
|
|
- return false;
|
|
-
|
|
- // Removes the tld and the preceding dot.
|
|
- base::StringPiece host_minus_tld =
|
|
- host.substr(0, host.length() - tld_length - 1);
|
|
-
|
|
- base::StringPiece tld = host.substr(host.length() - tld_length);
|
|
- // Remove the trailing dot from tld if present, as for Google domains it's the
|
|
- // same page.
|
|
- StripTrailingDot(&tld);
|
|
- if (!allowed_tlds.contains(tld))
|
|
- return false;
|
|
-
|
|
- if (base::EqualsCaseInsensitiveASCII(host_minus_tld, domain_in_lower_case))
|
|
- return true;
|
|
-
|
|
- if (subdomain_permission == ALLOW_SUBDOMAIN) {
|
|
- std::string dot_domain = base::StrCat({".", domain_in_lower_case});
|
|
- return base::EndsWith(host_minus_tld, dot_domain,
|
|
- base::CompareCase::INSENSITIVE_ASCII);
|
|
- }
|
|
-
|
|
- std::string www_domain = base::StrCat({"www.", domain_in_lower_case});
|
|
- return base::EqualsCaseInsensitiveASCII(host_minus_tld, www_domain);
|
|
-}
|
|
-
|
|
// True if |url| is a valid URL with HTTP or HTTPS scheme. If |port_permission|
|
|
// is DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard
|
|
// port for its scheme (80 for HTTP, 443 for HTTPS).
|
|
@@ -99,40 +45,7 @@ bool IsValidURL(const GURL& url, PortPermission port_permission) {
|
|
|
|
bool IsCanonicalHostGoogleHostname(base::StringPiece canonical_host,
|
|
SubdomainPermission subdomain_permission) {
|
|
- const GURL& base_url(CommandLineGoogleBaseURL());
|
|
- if (base_url.is_valid() && (canonical_host == base_url.host_piece()))
|
|
- return true;
|
|
-
|
|
- static constexpr auto google_tlds =
|
|
- base::MakeFixedFlatSet<base::StringPiece>({GOOGLE_TLD_LIST});
|
|
- return IsValidHostName(canonical_host, "google", subdomain_permission,
|
|
- google_tlds);
|
|
-}
|
|
-
|
|
-bool IsCanonicalHostYoutubeHostname(base::StringPiece canonical_host,
|
|
- SubdomainPermission subdomain_permission) {
|
|
- static constexpr auto youtube_tlds =
|
|
- base::MakeFixedFlatSet<base::StringPiece>({YOUTUBE_TLD_LIST});
|
|
-
|
|
- return IsValidHostName(canonical_host, "youtube", subdomain_permission,
|
|
- youtube_tlds);
|
|
-}
|
|
-
|
|
-// True if |url| is a valid URL with a host that is in the static list of
|
|
-// Google subdomains for google search, and an HTTP or HTTPS scheme. Requires
|
|
-// |url| to use the standard port for its scheme (80 for HTTP, 443 for HTTPS).
|
|
-bool IsGoogleSearchSubdomainUrl(const GURL& url) {
|
|
- if (!IsValidURL(url, PortPermission::DISALLOW_NON_STANDARD_PORTS))
|
|
- return false;
|
|
-
|
|
- base::StringPiece host(url.host_piece());
|
|
- StripTrailingDot(&host);
|
|
-
|
|
- static constexpr auto google_subdomains =
|
|
- base::MakeFixedFlatSet<base::StringPiece>(
|
|
- {"ipv4.google.com", "ipv6.google.com"});
|
|
-
|
|
- return google_subdomains.contains(host);
|
|
+ return false;
|
|
}
|
|
|
|
} // namespace
|
|
@@ -141,16 +54,6 @@ bool IsGoogleSearchSubdomainUrl(const GURL& url) {
|
|
|
|
const char kGoogleHomepageURL[] = "https://www.google.com/";
|
|
|
|
-bool HasGoogleSearchQueryParam(base::StringPiece str) {
|
|
- url::Component query(0, static_cast<int>(str.length())), key, value;
|
|
- while (url::ExtractQueryKeyValue(str.data(), &query, &key, &value)) {
|
|
- base::StringPiece key_str = str.substr(key.begin, key.len);
|
|
- if (key_str == "q" || key_str == "as_q" || key_str == "imgurl")
|
|
- return true;
|
|
- }
|
|
- return false;
|
|
-}
|
|
-
|
|
std::string GetGoogleLocale(const std::string& application_locale) {
|
|
// Google does not recognize "nb" for Norwegian Bokmal; it uses "no".
|
|
return (application_locale == "nb") ? "no" : application_locale;
|
|
@@ -163,25 +66,7 @@ GURL AppendGoogleLocaleParam(const GURL& url,
|
|
}
|
|
|
|
std::string GetGoogleCountryCode(const GURL& google_homepage_url) {
|
|
- base::StringPiece google_hostname = google_homepage_url.host_piece();
|
|
- // TODO(igorcov): This needs a fix for case when the host has a trailing dot,
|
|
- // like "google.com./". https://crbug.com/720295.
|
|
- const size_t last_dot = google_hostname.find_last_of('.');
|
|
- if (last_dot == std::string::npos)
|
|
- return std::string();
|
|
- base::StringPiece country_code = google_hostname.substr(last_dot + 1);
|
|
- // Assume the com TLD implies the US.
|
|
- if (country_code == "com")
|
|
- return "us";
|
|
- // Google uses the Unicode Common Locale Data Repository (CLDR), and the CLDR
|
|
- // code for the UK is "gb".
|
|
- if (country_code == "uk")
|
|
- return "gb";
|
|
- // Catalonia does not have a CLDR country code, since it's a region in Spain,
|
|
- // so use Spain instead.
|
|
- if (country_code == "cat")
|
|
- return "es";
|
|
- return std::string(country_code);
|
|
+ return std::string();
|
|
}
|
|
|
|
GURL GetGoogleSearchURL(const GURL& google_homepage_url) {
|
|
@@ -227,93 +112,24 @@ bool IsGoogleDomainUrl(const GURL& url,
|
|
|
|
bool IsGoogleHostname(base::StringPiece host,
|
|
SubdomainPermission subdomain_permission) {
|
|
- url::CanonHostInfo host_info;
|
|
- return IsCanonicalHostGoogleHostname(net::CanonicalizeHost(host, &host_info),
|
|
- subdomain_permission);
|
|
+ return false;
|
|
}
|
|
|
|
bool IsGoogleHomePageUrl(const GURL& url) {
|
|
- // First check to see if this has a Google domain.
|
|
- if (!IsGoogleDomainUrl(url, DISALLOW_SUBDOMAIN,
|
|
- DISALLOW_NON_STANDARD_PORTS) &&
|
|
- !IsGoogleSearchSubdomainUrl(url)) {
|
|
- return false;
|
|
- }
|
|
-
|
|
- // Make sure the path is a known home page path.
|
|
- base::StringPiece path(url.path_piece());
|
|
- return IsPathHomePageBase(path) ||
|
|
- base::StartsWith(path, "/ig", base::CompareCase::INSENSITIVE_ASCII);
|
|
+ return false;
|
|
}
|
|
|
|
bool IsGoogleSearchUrl(const GURL& url) {
|
|
- // First check to see if this has a Google domain.
|
|
- if (!IsGoogleDomainUrl(url, DISALLOW_SUBDOMAIN,
|
|
- DISALLOW_NON_STANDARD_PORTS) &&
|
|
- !IsGoogleSearchSubdomainUrl(url)) {
|
|
- return false;
|
|
- }
|
|
-
|
|
- // Make sure the path is a known search path.
|
|
- base::StringPiece path(url.path_piece());
|
|
- bool is_home_page_base = IsPathHomePageBase(path);
|
|
- if (!is_home_page_base && path != "/search" && path != "/imgres")
|
|
- return false;
|
|
-
|
|
- // Check for query parameter in URL parameter and hash fragment, depending on
|
|
- // the path type.
|
|
- return HasGoogleSearchQueryParam(url.ref_piece()) ||
|
|
- (!is_home_page_base && HasGoogleSearchQueryParam(url.query_piece()));
|
|
+ return false;
|
|
}
|
|
|
|
bool IsYoutubeDomainUrl(const GURL& url,
|
|
SubdomainPermission subdomain_permission,
|
|
PortPermission port_permission) {
|
|
- return IsValidURL(url, port_permission) &&
|
|
- IsCanonicalHostYoutubeHostname(url.host_piece(), subdomain_permission);
|
|
+ return false;
|
|
}
|
|
|
|
bool IsGoogleAssociatedDomainUrl(const GURL& url) {
|
|
- if (IsGoogleDomainUrl(url, ALLOW_SUBDOMAIN, ALLOW_NON_STANDARD_PORTS))
|
|
- return true;
|
|
-
|
|
- if (IsYoutubeDomainUrl(url, ALLOW_SUBDOMAIN, ALLOW_NON_STANDARD_PORTS))
|
|
- return true;
|
|
-
|
|
- // Some domains don't have international TLD extensions, so testing for them
|
|
- // is very straightforward.
|
|
- static const char* kSuffixesToSetHeadersFor[] = {
|
|
- ".android.com",
|
|
- ".doubleclick.com",
|
|
- ".doubleclick.net",
|
|
- ".ggpht.com",
|
|
- ".googleadservices.com",
|
|
- ".googleapis.com",
|
|
- ".googlesyndication.com",
|
|
- ".googleusercontent.com",
|
|
- ".googlevideo.com",
|
|
- ".gstatic.com",
|
|
- ".litepages.googlezip.net",
|
|
- ".youtubekids.com",
|
|
- ".ytimg.com",
|
|
- };
|
|
- const std::string host = url.host();
|
|
- for (size_t i = 0; i < std::size(kSuffixesToSetHeadersFor); ++i) {
|
|
- if (base::EndsWith(host, kSuffixesToSetHeadersFor[i],
|
|
- base::CompareCase::INSENSITIVE_ASCII)) {
|
|
- return true;
|
|
- }
|
|
- }
|
|
-
|
|
- // Exact hostnames in lowercase to set headers for.
|
|
- static const char* kHostsToSetHeadersFor[] = {
|
|
- "googleweblight.com",
|
|
- };
|
|
- for (size_t i = 0; i < std::size(kHostsToSetHeadersFor); ++i) {
|
|
- if (base::EqualsCaseInsensitiveASCII(host, kHostsToSetHeadersFor[i]))
|
|
- return true;
|
|
- }
|
|
-
|
|
return false;
|
|
}
|
|
|
|
@@ -382,51 +198,4 @@ GURL AppendToAsyncQueryParam(const GURL& url,
|
|
return url.ReplaceComponents(replacements);
|
|
}
|
|
|
|
-GoogleSearchMode GoogleSearchModeFromUrl(const GURL& url) {
|
|
- static_assert(GoogleSearchMode::kMaxValue == GoogleSearchMode::kFlights,
|
|
- "This function should be updated if new values are added to "
|
|
- "GoogleSearchMode");
|
|
-
|
|
- base::StringPiece query_str = url.query_piece();
|
|
- url::Component query(0, static_cast<int>(url.query_piece().length()));
|
|
- url::Component key, value;
|
|
- GoogleSearchMode mode = GoogleSearchMode::kUnspecified;
|
|
- while (url::ExtractQueryKeyValue(query_str.data(), &query, &key, &value)) {
|
|
- base::StringPiece key_str = query_str.substr(key.begin, key.len);
|
|
- if (key_str != "tbm") {
|
|
- continue;
|
|
- }
|
|
- if (mode != GoogleSearchMode::kUnspecified) {
|
|
- // There is more than one tbm parameter, which is not expected. Return
|
|
- // kUnknown to signify the result can't be trusted.
|
|
- return GoogleSearchMode::kUnknown;
|
|
- }
|
|
- base::StringPiece value_str = query_str.substr(value.begin, value.len);
|
|
- if (value_str == "isch") {
|
|
- mode = GoogleSearchMode::kImages;
|
|
- } else if (value_str == "web") {
|
|
- mode = GoogleSearchMode::kWeb;
|
|
- } else if (value_str == "nws") {
|
|
- mode = GoogleSearchMode::kNews;
|
|
- } else if (value_str == "shop") {
|
|
- mode = GoogleSearchMode::kShopping;
|
|
- } else if (value_str == "vid") {
|
|
- mode = GoogleSearchMode::kVideos;
|
|
- } else if (value_str == "bks") {
|
|
- mode = GoogleSearchMode::kBooks;
|
|
- } else if (value_str == "flm") {
|
|
- mode = GoogleSearchMode::kFlights;
|
|
- } else if (value_str == "lcl") {
|
|
- mode = GoogleSearchMode::kLocal;
|
|
- } else {
|
|
- mode = GoogleSearchMode::kUnknown;
|
|
- }
|
|
- }
|
|
- if (mode == GoogleSearchMode::kUnspecified) {
|
|
- // No tbm query parameter means this is the Web mode.
|
|
- mode = GoogleSearchMode::kWeb;
|
|
- }
|
|
- return mode;
|
|
-}
|
|
-
|
|
} // namespace google_util
|
|
diff --git a/components/google/core/common/google_util.h b/components/google/core/common/google_util.h
|
|
--- a/components/google/core/common/google_util.h
|
|
+++ b/components/google/core/common/google_util.h
|
|
@@ -154,11 +154,6 @@ GURL AppendToAsyncQueryParam(const GURL& url,
|
|
const std::string& key,
|
|
const std::string& value);
|
|
|
|
-// Returns Google Search mode used by the user. This corresponds to the tab
|
|
-// (e.g. web result, image results, video results, etc.) the user is on. This
|
|
-// information is extracted from the "tbm" query parameter on the Search URL.
|
|
-GoogleSearchMode GoogleSearchModeFromUrl(const GURL& url);
|
|
-
|
|
} // namespace google_util
|
|
|
|
#endif // COMPONENTS_GOOGLE_CORE_COMMON_GOOGLE_UTIL_H_
|
|
diff --git a/components/page_load_metrics/browser/page_load_metrics_util.cc b/components/page_load_metrics/browser/page_load_metrics_util.cc
|
|
--- a/components/page_load_metrics/browser/page_load_metrics_util.cc
|
|
+++ b/components/page_load_metrics/browser/page_load_metrics_util.cc
|
|
@@ -280,9 +280,7 @@ bool DidObserveLoadingBehaviorInAnyFrame(
|
|
}
|
|
|
|
bool IsGoogleSearchHostname(const GURL& url) {
|
|
- absl::optional<std::string> result =
|
|
- page_load_metrics::GetGoogleHostnamePrefix(url);
|
|
- return result && result.value() == "www";
|
|
+ return false;
|
|
}
|
|
|
|
bool IsGoogleSearchResultUrl(const GURL& url) {
|
|
diff --git a/components/page_load_metrics/common/page_load_metrics_util.cc b/components/page_load_metrics/common/page_load_metrics_util.cc
|
|
--- a/components/page_load_metrics/common/page_load_metrics_util.cc
|
|
+++ b/components/page_load_metrics/common/page_load_metrics_util.cc
|
|
@@ -24,38 +24,7 @@ const int kExtraBufferTimerDelayMillis = 50;
|
|
} // namespace
|
|
|
|
absl::optional<std::string> GetGoogleHostnamePrefix(const GURL& url) {
|
|
- const size_t registry_length =
|
|
- net::registry_controlled_domains::GetRegistryLength(
|
|
- url,
|
|
-
|
|
- // Do not include unknown registries (registries that don't have any
|
|
- // matches in effective TLD names).
|
|
- net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
|
|
-
|
|
- // Do not include private registries, such as appspot.com. We don't
|
|
- // want to match URLs like www.google.appspot.com.
|
|
- net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
|
|
-
|
|
- const base::StringPiece hostname = url.host_piece();
|
|
- if (registry_length == 0 || registry_length == std::string::npos ||
|
|
- registry_length >= hostname.length()) {
|
|
- return absl::optional<std::string>();
|
|
- }
|
|
-
|
|
- // Removes the tld and the preceding dot.
|
|
- const base::StringPiece hostname_minus_registry =
|
|
- hostname.substr(0, hostname.length() - (registry_length + 1));
|
|
-
|
|
- if (hostname_minus_registry == "google")
|
|
- return std::string("");
|
|
-
|
|
- if (!base::EndsWith(hostname_minus_registry, ".google",
|
|
- base::CompareCase::INSENSITIVE_ASCII)) {
|
|
- return absl::optional<std::string>();
|
|
- }
|
|
-
|
|
- return std::string(hostname_minus_registry.substr(
|
|
- 0, hostname_minus_registry.length() - strlen(".google")));
|
|
+ return std::string("");
|
|
}
|
|
|
|
bool IsGoogleHostname(const GURL& url) {
|
|
diff --git a/components/search_engines/template_url.cc b/components/search_engines/template_url.cc
|
|
--- a/components/search_engines/template_url.cc
|
|
+++ b/components/search_engines/template_url.cc
|
|
@@ -535,11 +535,7 @@ std::u16string TemplateURLRef::SearchTermToString16(
|
|
bool TemplateURLRef::HasGoogleBaseURLs(
|
|
const SearchTermsData& search_terms_data) const {
|
|
ParseIfNecessary(search_terms_data);
|
|
- return base::ranges::any_of(
|
|
- replacements_, [](const Replacement& replacement) {
|
|
- return replacement.type == GOOGLE_BASE_URL ||
|
|
- replacement.type == GOOGLE_BASE_SUGGEST_URL;
|
|
- });
|
|
+ return false;
|
|
}
|
|
|
|
bool TemplateURLRef::ExtractSearchTermsFromURL(
|
|
diff --git a/net/base/url_util.cc b/net/base/url_util.cc
|
|
--- a/net/base/url_util.cc
|
|
+++ b/net/base/url_util.cc
|
|
@@ -464,27 +464,6 @@ bool HasGoogleHost(const GURL& url) {
|
|
}
|
|
|
|
bool IsGoogleHost(base::StringPiece host) {
|
|
- static const char* kGoogleHostSuffixes[] = {
|
|
- ".google.com",
|
|
- ".youtube.com",
|
|
- ".gmail.com",
|
|
- ".doubleclick.net",
|
|
- ".gstatic.com",
|
|
- ".googlevideo.com",
|
|
- ".googleusercontent.com",
|
|
- ".googlesyndication.com",
|
|
- ".google-analytics.com",
|
|
- ".googleadservices.com",
|
|
- ".googleapis.com",
|
|
- ".ytimg.com",
|
|
- };
|
|
- for (const char* suffix : kGoogleHostSuffixes) {
|
|
- // Here it's possible to get away with faster case-sensitive comparisons
|
|
- // because the list above is all lowercase, and a GURL's host name will
|
|
- // always be canonicalized to lowercase as well.
|
|
- if (base::EndsWith(host, suffix))
|
|
- return true;
|
|
- }
|
|
return false;
|
|
}
|
|
|
|
diff --git a/services/network/network_context.cc b/services/network/network_context.cc
|
|
--- a/services/network/network_context.cc
|
|
+++ b/services/network/network_context.cc
|
|
@@ -2708,7 +2708,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
|
}
|
|
#endif // BUILDFLAG(IS_CT_SUPPORTED)
|
|
|
|
- if (params_->enable_domain_reliability) {
|
|
+ if ((false) /*params_->enable_domain_reliability*/) {
|
|
domain_reliability_monitor_ =
|
|
std::make_unique<domain_reliability::DomainReliabilityMonitor>(
|
|
result.url_request_context.get(),
|
|
--
|
|
2.25.1
|