diff options
| author | Shokara Kou <kou@13f0.net> | 2022-12-10 11:07:13 -0500 |
|---|---|---|
| committer | Shokara Kou <kou@13f0.net> | 2022-12-10 11:07:13 -0500 |
| commit | 04ed026966c1c801a05839ac3b42aff6741fde71 (patch) | |
| tree | f670f3e21c86da27a8a7c6679318d2e0668a66ea /www/chromium-uc/patches/core/ungoogled-chromium/disable-google-host-detection.patch | |
| parent | 706327693b4fcc1ce8d5b6cf100beb729ddd1bd1 (diff) | |
remove ungoogled-chromium
Diffstat (limited to 'www/chromium-uc/patches/core/ungoogled-chromium/disable-google-host-detection.patch')
| -rw-r--r-- | www/chromium-uc/patches/core/ungoogled-chromium/disable-google-host-detection.patch | 613 |
1 files changed, 0 insertions, 613 deletions
diff --git a/www/chromium-uc/patches/core/ungoogled-chromium/disable-google-host-detection.patch b/www/chromium-uc/patches/core/ungoogled-chromium/disable-google-host-detection.patch deleted file mode 100644 index 846904d..0000000 --- a/www/chromium-uc/patches/core/ungoogled-chromium/disable-google-host-detection.patch +++ /dev/null | |||
| @@ -1,613 +0,0 @@ | |||
| 1 | # Disables various detections of Google hosts and functionality specific to them | ||
| 2 | |||
| 3 | --- chrome/common/google_url_loader_throttle.cc.orig | ||
| 4 | +++ chrome/common/google_url_loader_throttle.cc | ||
| 5 | @@ -19,10 +19,6 @@ | ||
| 6 | #include "ui/base/device_form_factor.h" | ||
| 7 | #endif | ||
| 8 | |||
| 9 | -#if BUILDFLAG(ENABLE_EXTENSIONS) | ||
| 10 | -#include "extensions/common/extension_urls.h" | ||
| 11 | -#endif | ||
| 12 | - | ||
| 13 | namespace { | ||
| 14 | |||
| 15 | #if defined(OS_ANDROID) | ||
| 16 | @@ -65,52 +61,6 @@ void GoogleURLLoaderThrottle::DetachFrom | ||
| 17 | void GoogleURLLoaderThrottle::WillStartRequest( | ||
| 18 | network::ResourceRequest* request, | ||
| 19 | bool* defer) { | ||
| 20 | - if (dynamic_params_.force_safe_search) { | ||
| 21 | - GURL new_url; | ||
| 22 | - safe_search_util::ForceGoogleSafeSearch(request->url, &new_url); | ||
| 23 | - if (!new_url.is_empty()) | ||
| 24 | - request->url = new_url; | ||
| 25 | - } | ||
| 26 | - | ||
| 27 | - static_assert(safe_search_util::YOUTUBE_RESTRICT_OFF == 0, | ||
| 28 | - "OFF must be first"); | ||
| 29 | - if (dynamic_params_.youtube_restrict > | ||
| 30 | - safe_search_util::YOUTUBE_RESTRICT_OFF && | ||
| 31 | - dynamic_params_.youtube_restrict < | ||
| 32 | - safe_search_util::YOUTUBE_RESTRICT_COUNT) { | ||
| 33 | - safe_search_util::ForceYouTubeRestrict( | ||
| 34 | - request->url, &request->cors_exempt_headers, | ||
| 35 | - static_cast<safe_search_util::YouTubeRestrictMode>( | ||
| 36 | - dynamic_params_.youtube_restrict)); | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - if (!dynamic_params_.allowed_domains_for_apps.empty() && | ||
| 40 | - request->url.DomainIs("google.com")) { | ||
| 41 | - request->cors_exempt_headers.SetHeader( | ||
| 42 | - safe_search_util::kGoogleAppsAllowedDomains, | ||
| 43 | - dynamic_params_.allowed_domains_for_apps); | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | -#if defined(OS_ANDROID) | ||
| 47 | - if (!client_data_header_.empty() && | ||
| 48 | - google_util::IsGoogleAssociatedDomainUrl(request->url)) { | ||
| 49 | - request->cors_exempt_headers.SetHeader(kCCTClientDataHeader, | ||
| 50 | - client_data_header_); | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - bool is_google_homepage_or_search = | ||
| 54 | - google_util::IsGoogleHomePageUrl(request->url) || | ||
| 55 | - google_util::IsGoogleSearchUrl(request->url); | ||
| 56 | - if (is_google_homepage_or_search) { | ||
| 57 | - if (base::FeatureList::IsEnabled(features::kRequestDesktopSiteForTablets) && | ||
| 58 | - ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) { | ||
| 59 | - request->headers.SetHeader(kRequestDesktopDataHeader, | ||
| 60 | - is_tab_large_enough_ ? "1" : "0"); | ||
| 61 | - base::UmaHistogramBoolean("Android.RequestDesktopSite.TabletEligible", | ||
| 62 | - is_tab_large_enough_); | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | -#endif | ||
| 66 | } | ||
| 67 | |||
| 68 | void GoogleURLLoaderThrottle::WillRedirectRequest( | ||
| 69 | @@ -120,37 +70,6 @@ void GoogleURLLoaderThrottle::WillRedire | ||
| 70 | std::vector<std::string>* to_be_removed_headers, | ||
| 71 | net::HttpRequestHeaders* modified_headers, | ||
| 72 | net::HttpRequestHeaders* modified_cors_exempt_headers) { | ||
| 73 | - // URLLoaderThrottles can only change the redirect URL when the network | ||
| 74 | - // service is enabled. The non-network service path handles this in | ||
| 75 | - // ChromeNetworkDelegate. | ||
| 76 | - if (dynamic_params_.force_safe_search) { | ||
| 77 | - safe_search_util::ForceGoogleSafeSearch(redirect_info->new_url, | ||
| 78 | - &redirect_info->new_url); | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - if (dynamic_params_.youtube_restrict > | ||
| 82 | - safe_search_util::YOUTUBE_RESTRICT_OFF && | ||
| 83 | - dynamic_params_.youtube_restrict < | ||
| 84 | - safe_search_util::YOUTUBE_RESTRICT_COUNT) { | ||
| 85 | - safe_search_util::ForceYouTubeRestrict( | ||
| 86 | - redirect_info->new_url, modified_cors_exempt_headers, | ||
| 87 | - static_cast<safe_search_util::YouTubeRestrictMode>( | ||
| 88 | - dynamic_params_.youtube_restrict)); | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - if (!dynamic_params_.allowed_domains_for_apps.empty() && | ||
| 92 | - redirect_info->new_url.DomainIs("google.com")) { | ||
| 93 | - modified_cors_exempt_headers->SetHeader( | ||
| 94 | - safe_search_util::kGoogleAppsAllowedDomains, | ||
| 95 | - dynamic_params_.allowed_domains_for_apps); | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | -#if defined(OS_ANDROID) | ||
| 99 | - if (!client_data_header_.empty() && | ||
| 100 | - !google_util::IsGoogleAssociatedDomainUrl(redirect_info->new_url)) { | ||
| 101 | - to_be_removed_headers->push_back(kCCTClientDataHeader); | ||
| 102 | - } | ||
| 103 | -#endif | ||
| 104 | } | ||
| 105 | |||
| 106 | #if BUILDFLAG(ENABLE_EXTENSIONS) | ||
| 107 | @@ -158,23 +77,5 @@ void GoogleURLLoaderThrottle::WillProces | ||
| 108 | const GURL& response_url, | ||
| 109 | network::mojom::URLResponseHead* response_head, | ||
| 110 | bool* defer) { | ||
| 111 | - // Built-in additional protection for the chrome web store origin by ensuring | ||
| 112 | - // that the X-Frame-Options protection mechanism is set to either DENY or | ||
| 113 | - // SAMEORIGIN. | ||
| 114 | - GURL webstore_url(extension_urls::GetWebstoreLaunchURL()); | ||
| 115 | - if (response_url.SchemeIsHTTPOrHTTPS() && | ||
| 116 | - response_url.DomainIs(webstore_url.host_piece())) { | ||
| 117 | - // TODO(mkwst): Consider shifting this to a NavigationThrottle rather than | ||
| 118 | - // relying on implicit ordering between this check and the time at which | ||
| 119 | - // ParsedHeaders is created. | ||
| 120 | - CHECK(response_head); | ||
| 121 | - CHECK(response_head->parsed_headers); | ||
| 122 | - if (response_head->parsed_headers->xfo != | ||
| 123 | - network::mojom::XFrameOptionsValue::kDeny) { | ||
| 124 | - response_head->headers->SetHeader("X-Frame-Options", "SAMEORIGIN"); | ||
| 125 | - response_head->parsed_headers->xfo = | ||
| 126 | - network::mojom::XFrameOptionsValue::kSameOrigin; | ||
| 127 | - } | ||
| 128 | - } | ||
| 129 | } | ||
| 130 | #endif | ||
| 131 | --- components/google/core/common/google_util.cc.orig | ||
| 132 | +++ components/google/core/common/google_util.cc | ||
| 133 | @@ -33,112 +33,6 @@ namespace google_util { | ||
| 134 | |||
| 135 | namespace { | ||
| 136 | |||
| 137 | -bool IsPathHomePageBase(base::StringPiece path) { | ||
| 138 | - return (path == "/") || (path == "/webhp"); | ||
| 139 | -} | ||
| 140 | - | ||
| 141 | -// Removes a single trailing dot if present in |host|. | ||
| 142 | -void StripTrailingDot(base::StringPiece* host) { | ||
| 143 | - if (base::EndsWith(*host, ".")) | ||
| 144 | - host->remove_suffix(1); | ||
| 145 | -} | ||
| 146 | - | ||
| 147 | -// True if the given canonical |host| is "[www.]<domain_in_lower_case>.<TLD>" | ||
| 148 | -// with a valid TLD that appears in |allowed_tlds|. If |subdomain_permission| is | ||
| 149 | -// ALLOW_SUBDOMAIN, we check against host "*.<domain_in_lower_case>.<TLD>" | ||
| 150 | -// instead. | ||
| 151 | -template <typename Container> | ||
| 152 | -bool IsValidHostName(base::StringPiece host, | ||
| 153 | - base::StringPiece domain_in_lower_case, | ||
| 154 | - SubdomainPermission subdomain_permission, | ||
| 155 | - const Container& allowed_tlds) { | ||
| 156 | - // Fast path to avoid searching the registry set. | ||
| 157 | - if (host.find(domain_in_lower_case) == base::StringPiece::npos) | ||
| 158 | - return false; | ||
| 159 | - | ||
| 160 | - size_t tld_length = | ||
| 161 | - net::registry_controlled_domains::GetCanonicalHostRegistryLength( | ||
| 162 | - host, net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | ||
| 163 | - net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | ||
| 164 | - if ((tld_length == 0) || (tld_length == std::string::npos)) | ||
| 165 | - return false; | ||
| 166 | - | ||
| 167 | - // Removes the tld and the preceding dot. | ||
| 168 | - base::StringPiece host_minus_tld = | ||
| 169 | - host.substr(0, host.length() - tld_length - 1); | ||
| 170 | - | ||
| 171 | - base::StringPiece tld = host.substr(host.length() - tld_length); | ||
| 172 | - // Remove the trailing dot from tld if present, as for Google domains it's the | ||
| 173 | - // same page. | ||
| 174 | - StripTrailingDot(&tld); | ||
| 175 | - if (!allowed_tlds.contains(tld)) | ||
| 176 | - return false; | ||
| 177 | - | ||
| 178 | - if (base::LowerCaseEqualsASCII(host_minus_tld, domain_in_lower_case)) | ||
| 179 | - return true; | ||
| 180 | - | ||
| 181 | - if (subdomain_permission == ALLOW_SUBDOMAIN) { | ||
| 182 | - std::string dot_domain = base::StrCat({".", domain_in_lower_case}); | ||
| 183 | - return base::EndsWith(host_minus_tld, dot_domain, | ||
| 184 | - base::CompareCase::INSENSITIVE_ASCII); | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - std::string www_domain = base::StrCat({"www.", domain_in_lower_case}); | ||
| 188 | - return base::LowerCaseEqualsASCII(host_minus_tld, www_domain); | ||
| 189 | -} | ||
| 190 | - | ||
| 191 | -// True if |url| is a valid URL with HTTP or HTTPS scheme. If |port_permission| | ||
| 192 | -// is DISALLOW_NON_STANDARD_PORTS, this also requires |url| to use the standard | ||
| 193 | -// port for its scheme (80 for HTTP, 443 for HTTPS). | ||
| 194 | -bool IsValidURL(const GURL& url, PortPermission port_permission) { | ||
| 195 | - static bool g_ignore_port_numbers = | ||
| 196 | - base::CommandLine::ForCurrentProcess()->HasSwitch( | ||
| 197 | - switches::kIgnoreGooglePortNumbers); | ||
| 198 | - return url.is_valid() && url.SchemeIsHTTPOrHTTPS() && | ||
| 199 | - (url.port().empty() || g_ignore_port_numbers || | ||
| 200 | - (port_permission == ALLOW_NON_STANDARD_PORTS)); | ||
| 201 | -} | ||
| 202 | - | ||
| 203 | -bool IsCanonicalHostGoogleHostname(base::StringPiece canonical_host, | ||
| 204 | - SubdomainPermission subdomain_permission) { | ||
| 205 | - const GURL& base_url(CommandLineGoogleBaseURL()); | ||
| 206 | - if (base_url.is_valid() && (canonical_host == base_url.host_piece())) | ||
| 207 | - return true; | ||
| 208 | - | ||
| 209 | - static constexpr auto google_tlds = | ||
| 210 | - base::MakeFixedFlatSet<base::StringPiece>({GOOGLE_TLD_LIST}); | ||
| 211 | - return IsValidHostName(canonical_host, "google", subdomain_permission, | ||
| 212 | - google_tlds); | ||
| 213 | -} | ||
| 214 | - | ||
| 215 | -bool IsCanonicalHostYoutubeHostname(base::StringPiece canonical_host, | ||
| 216 | - SubdomainPermission subdomain_permission) { | ||
| 217 | - static constexpr auto youtube_tlds = | ||
| 218 | - base::MakeFixedFlatSet<base::StringPiece>({YOUTUBE_TLD_LIST}); | ||
| 219 | - | ||
| 220 | - return IsValidHostName(canonical_host, "youtube", subdomain_permission, | ||
| 221 | - youtube_tlds) || | ||
| 222 | - IsValidHostName(canonical_host, "youtubekids", subdomain_permission, | ||
| 223 | - youtube_tlds); | ||
| 224 | -} | ||
| 225 | - | ||
| 226 | -// True if |url| is a valid URL with a host that is in the static list of | ||
| 227 | -// Google subdomains for google search, and an HTTP or HTTPS scheme. Requires | ||
| 228 | -// |url| to use the standard port for its scheme (80 for HTTP, 443 for HTTPS). | ||
| 229 | -bool IsGoogleSearchSubdomainUrl(const GURL& url) { | ||
| 230 | - if (!IsValidURL(url, PortPermission::DISALLOW_NON_STANDARD_PORTS)) | ||
| 231 | - return false; | ||
| 232 | - | ||
| 233 | - base::StringPiece host(url.host_piece()); | ||
| 234 | - StripTrailingDot(&host); | ||
| 235 | - | ||
| 236 | - static constexpr auto google_subdomains = | ||
| 237 | - base::MakeFixedFlatSet<base::StringPiece>( | ||
| 238 | - {"ipv4.google.com", "ipv6.google.com"}); | ||
| 239 | - | ||
| 240 | - return google_subdomains.contains(host); | ||
| 241 | -} | ||
| 242 | - | ||
| 243 | } // namespace | ||
| 244 | |||
| 245 | // Global functions ----------------------------------------------------------- | ||
| 246 | @@ -146,12 +40,6 @@ bool IsGoogleSearchSubdomainUrl(const GU | ||
| 247 | const char kGoogleHomepageURL[] = "trk:113:https://www.google.com/"; | ||
| 248 | |||
| 249 | bool HasGoogleSearchQueryParam(base::StringPiece str) { | ||
| 250 | - url::Component query(0, static_cast<int>(str.length())), key, value; | ||
| 251 | - while (url::ExtractQueryKeyValue(str.data(), &query, &key, &value)) { | ||
| 252 | - base::StringPiece key_str = str.substr(key.begin, key.len); | ||
| 253 | - if (key_str == "q" || key_str == "as_q" || key_str == "imgurl") | ||
| 254 | - return true; | ||
| 255 | - } | ||
| 256 | return false; | ||
| 257 | } | ||
| 258 | |||
| 259 | @@ -162,161 +50,53 @@ std::string GetGoogleLocale(const std::s | ||
| 260 | |||
| 261 | GURL AppendGoogleLocaleParam(const GURL& url, | ||
| 262 | const std::string& application_locale) { | ||
| 263 | - return net::AppendQueryParameter(url, "hl", | ||
| 264 | - GetGoogleLocale(application_locale)); | ||
| 265 | + return url; | ||
| 266 | } | ||
| 267 | |||
| 268 | std::string GetGoogleCountryCode(const GURL& google_homepage_url) { | ||
| 269 | - base::StringPiece google_hostname = google_homepage_url.host_piece(); | ||
| 270 | - // TODO(igorcov): This needs a fix for case when the host has a trailing dot, | ||
| 271 | - // like "google.com./". https://crbug.com/720295. | ||
| 272 | - const size_t last_dot = google_hostname.find_last_of('.'); | ||
| 273 | - if (last_dot == std::string::npos) | ||
| 274 | - return std::string(); | ||
| 275 | - base::StringPiece country_code = google_hostname.substr(last_dot + 1); | ||
| 276 | - // Assume the com TLD implies the US. | ||
| 277 | - if (country_code == "com") | ||
| 278 | - return "us"; | ||
| 279 | - // Google uses the Unicode Common Locale Data Repository (CLDR), and the CLDR | ||
| 280 | - // code for the UK is "gb". | ||
| 281 | - if (country_code == "uk") | ||
| 282 | - return "gb"; | ||
| 283 | - // Catalonia does not have a CLDR country code, since it's a region in Spain, | ||
| 284 | - // so use Spain instead. | ||
| 285 | - if (country_code == "cat") | ||
| 286 | - return "es"; | ||
| 287 | - return std::string(country_code); | ||
| 288 | + return "nolocale"; | ||
| 289 | } | ||
| 290 | |||
| 291 | GURL GetGoogleSearchURL(const GURL& google_homepage_url) { | ||
| 292 | - // To transform the homepage URL into the corresponding search URL, add the | ||
| 293 | - // "search" and the "q=" query string. | ||
| 294 | - GURL::Replacements replacements; | ||
| 295 | - replacements.SetPathStr("search"); | ||
| 296 | - replacements.SetQueryStr("q="); | ||
| 297 | - return google_homepage_url.ReplaceComponents(replacements); | ||
| 298 | + return google_homepage_url; | ||
| 299 | } | ||
| 300 | |||
| 301 | const GURL& CommandLineGoogleBaseURL() { | ||
| 302 | - // Unit tests may add command-line flags after the first call to this | ||
| 303 | - // function, so we don't simply initialize a static |base_url| directly and | ||
| 304 | - // then unconditionally return it. | ||
| 305 | - static base::NoDestructor<std::string> switch_value; | ||
| 306 | static base::NoDestructor<GURL> base_url; | ||
| 307 | - std::string current_switch_value( | ||
| 308 | - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | ||
| 309 | - switches::kGoogleBaseURL)); | ||
| 310 | - if (current_switch_value != *switch_value) { | ||
| 311 | - *switch_value = current_switch_value; | ||
| 312 | - *base_url = url_formatter::FixupURL(*switch_value, std::string()); | ||
| 313 | - if (!base_url->is_valid() || base_url->has_query() || base_url->has_ref()) | ||
| 314 | - *base_url = GURL(); | ||
| 315 | - } | ||
| 316 | + *base_url = GURL(); | ||
| 317 | return *base_url; | ||
| 318 | } | ||
| 319 | |||
| 320 | bool StartsWithCommandLineGoogleBaseURL(const GURL& url) { | ||
| 321 | - const GURL& base_url(CommandLineGoogleBaseURL()); | ||
| 322 | - return base_url.is_valid() && | ||
| 323 | - base::StartsWith(url.possibly_invalid_spec(), base_url.spec(), | ||
| 324 | - base::CompareCase::SENSITIVE); | ||
| 325 | + return false; | ||
| 326 | } | ||
| 327 | |||
| 328 | bool IsGoogleHostname(base::StringPiece host, | ||
| 329 | SubdomainPermission subdomain_permission) { | ||
| 330 | - url::CanonHostInfo host_info; | ||
| 331 | - return IsCanonicalHostGoogleHostname(net::CanonicalizeHost(host, &host_info), | ||
| 332 | - subdomain_permission); | ||
| 333 | + return false; | ||
| 334 | } | ||
| 335 | |||
| 336 | bool IsGoogleDomainUrl(const GURL& url, | ||
| 337 | SubdomainPermission subdomain_permission, | ||
| 338 | PortPermission port_permission) { | ||
| 339 | - return IsValidURL(url, port_permission) && | ||
| 340 | - IsCanonicalHostGoogleHostname(url.host_piece(), subdomain_permission); | ||
| 341 | + return false; | ||
| 342 | } | ||
| 343 | |||
| 344 | bool IsGoogleHomePageUrl(const GURL& url) { | ||
| 345 | - // First check to see if this has a Google domain. | ||
| 346 | - if (!IsGoogleDomainUrl(url, DISALLOW_SUBDOMAIN, | ||
| 347 | - DISALLOW_NON_STANDARD_PORTS) && | ||
| 348 | - !IsGoogleSearchSubdomainUrl(url)) { | ||
| 349 | - return false; | ||
| 350 | - } | ||
| 351 | - | ||
| 352 | - // Make sure the path is a known home page path. | ||
| 353 | - base::StringPiece path(url.path_piece()); | ||
| 354 | - return IsPathHomePageBase(path) || | ||
| 355 | - base::StartsWith(path, "/ig", base::CompareCase::INSENSITIVE_ASCII); | ||
| 356 | + return false; | ||
| 357 | } | ||
| 358 | |||
| 359 | bool IsGoogleSearchUrl(const GURL& url) { | ||
| 360 | - // First check to see if this has a Google domain. | ||
| 361 | - if (!IsGoogleDomainUrl(url, DISALLOW_SUBDOMAIN, | ||
| 362 | - DISALLOW_NON_STANDARD_PORTS) && | ||
| 363 | - !IsGoogleSearchSubdomainUrl(url)) { | ||
| 364 | - return false; | ||
| 365 | - } | ||
| 366 | - | ||
| 367 | - // Make sure the path is a known search path. | ||
| 368 | - base::StringPiece path(url.path_piece()); | ||
| 369 | - bool is_home_page_base = IsPathHomePageBase(path); | ||
| 370 | - if (!is_home_page_base && path != "/search" && path != "/imgres") | ||
| 371 | - return false; | ||
| 372 | - | ||
| 373 | - // Check for query parameter in URL parameter and hash fragment, depending on | ||
| 374 | - // the path type. | ||
| 375 | - return HasGoogleSearchQueryParam(url.ref_piece()) || | ||
| 376 | - (!is_home_page_base && HasGoogleSearchQueryParam(url.query_piece())); | ||
| 377 | + return false; | ||
| 378 | } | ||
| 379 | |||
| 380 | bool IsYoutubeDomainUrl(const GURL& url, | ||
| 381 | SubdomainPermission subdomain_permission, | ||
| 382 | PortPermission port_permission) { | ||
| 383 | - return IsValidURL(url, port_permission) && | ||
| 384 | - IsCanonicalHostYoutubeHostname(url.host_piece(), subdomain_permission); | ||
| 385 | + return false; | ||
| 386 | } | ||
| 387 | |||
| 388 | bool IsGoogleAssociatedDomainUrl(const GURL& url) { | ||
| 389 | - if (IsGoogleDomainUrl(url, ALLOW_SUBDOMAIN, ALLOW_NON_STANDARD_PORTS)) | ||
| 390 | - return true; | ||
| 391 | - | ||
| 392 | - if (IsYoutubeDomainUrl(url, ALLOW_SUBDOMAIN, ALLOW_NON_STANDARD_PORTS)) | ||
| 393 | - return true; | ||
| 394 | - | ||
| 395 | - // Some domains don't have international TLD extensions, so testing for them | ||
| 396 | - // is very straightforward. | ||
| 397 | - static const char* kSuffixesToSetHeadersFor[] = { | ||
| 398 | - ".android.com", | ||
| 399 | - ".doubleclick.com", | ||
| 400 | - ".doubleclick.net", | ||
| 401 | - ".ggpht.com", | ||
| 402 | - ".googleadservices.com", | ||
| 403 | - ".googleapis.com", | ||
| 404 | - ".googlesyndication.com", | ||
| 405 | - ".googleusercontent.com", | ||
| 406 | - ".googlevideo.com", | ||
| 407 | - ".gstatic.com", | ||
| 408 | - ".litepages.googlezip.net", | ||
| 409 | - ".ytimg.com", | ||
| 410 | - }; | ||
| 411 | - const std::string host = url.host(); | ||
| 412 | - for (size_t i = 0; i < base::size(kSuffixesToSetHeadersFor); ++i) { | ||
| 413 | - if (base::EndsWith(host, kSuffixesToSetHeadersFor[i], | ||
| 414 | - base::CompareCase::INSENSITIVE_ASCII)) { | ||
| 415 | - return true; | ||
| 416 | - } | ||
| 417 | - } | ||
| 418 | - | ||
| 419 | - // Exact hostnames in lowercase to set headers for. | ||
| 420 | - static const char* kHostsToSetHeadersFor[] = { | ||
| 421 | - "googleweblight.com", | ||
| 422 | - }; | ||
| 423 | - for (size_t i = 0; i < base::size(kHostsToSetHeadersFor); ++i) { | ||
| 424 | - if (base::LowerCaseEqualsASCII(host, kHostsToSetHeadersFor[i])) | ||
| 425 | - return true; | ||
| 426 | - } | ||
| 427 | - | ||
| 428 | return false; | ||
| 429 | } | ||
| 430 | |||
| 431 | --- components/page_load_metrics/browser/page_load_metrics_util.cc.orig | ||
| 432 | +++ components/page_load_metrics/browser/page_load_metrics_util.cc | ||
| 433 | @@ -196,9 +196,7 @@ bool DidObserveLoadingBehaviorInAnyFrame | ||
| 434 | } | ||
| 435 | |||
| 436 | bool IsGoogleSearchHostname(const GURL& url) { | ||
| 437 | - absl::optional<std::string> result = | ||
| 438 | - page_load_metrics::GetGoogleHostnamePrefix(url); | ||
| 439 | - return result && result.value() == "www"; | ||
| 440 | + return false; | ||
| 441 | } | ||
| 442 | |||
| 443 | bool IsGoogleSearchResultUrl(const GURL& url) { | ||
| 444 | --- components/page_load_metrics/common/page_load_metrics_util.cc.orig | ||
| 445 | +++ components/page_load_metrics/common/page_load_metrics_util.cc | ||
| 446 | @@ -36,38 +36,7 @@ const char* kBufferTimerDelayParamName = | ||
| 447 | } // namespace | ||
| 448 | |||
| 449 | absl::optional<std::string> GetGoogleHostnamePrefix(const GURL& url) { | ||
| 450 | - const size_t registry_length = | ||
| 451 | - net::registry_controlled_domains::GetRegistryLength( | ||
| 452 | - url, | ||
| 453 | - | ||
| 454 | - // Do not include unknown registries (registries that don't have any | ||
| 455 | - // matches in effective TLD names). | ||
| 456 | - net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | ||
| 457 | - | ||
| 458 | - // Do not include private registries, such as appspot.com. We don't | ||
| 459 | - // want to match URLs like www.google.appspot.com. | ||
| 460 | - net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | ||
| 461 | - | ||
| 462 | - const base::StringPiece hostname = url.host_piece(); | ||
| 463 | - if (registry_length == 0 || registry_length == std::string::npos || | ||
| 464 | - registry_length >= hostname.length()) { | ||
| 465 | - return absl::optional<std::string>(); | ||
| 466 | - } | ||
| 467 | - | ||
| 468 | - // Removes the tld and the preceding dot. | ||
| 469 | - const base::StringPiece hostname_minus_registry = | ||
| 470 | - hostname.substr(0, hostname.length() - (registry_length + 1)); | ||
| 471 | - | ||
| 472 | - if (hostname_minus_registry == "google") | ||
| 473 | - return std::string(""); | ||
| 474 | - | ||
| 475 | - if (!base::EndsWith(hostname_minus_registry, ".google", | ||
| 476 | - base::CompareCase::INSENSITIVE_ASCII)) { | ||
| 477 | - return absl::optional<std::string>(); | ||
| 478 | - } | ||
| 479 | - | ||
| 480 | - return std::string(hostname_minus_registry.substr( | ||
| 481 | - 0, hostname_minus_registry.length() - strlen(".google"))); | ||
| 482 | + return absl::optional<std::string>(); | ||
| 483 | } | ||
| 484 | |||
| 485 | bool IsGoogleHostname(const GURL& url) { | ||
| 486 | --- components/search_engines/template_url.cc.orig | ||
| 487 | +++ components/search_engines/template_url.cc | ||
| 488 | @@ -527,11 +527,7 @@ std::u16string TemplateURLRef::SearchTer | ||
| 489 | bool TemplateURLRef::HasGoogleBaseURLs( | ||
| 490 | const SearchTermsData& search_terms_data) const { | ||
| 491 | ParseIfNecessary(search_terms_data); | ||
| 492 | - return std::any_of(replacements_.begin(), replacements_.end(), | ||
| 493 | - [](const Replacement& replacement) { | ||
| 494 | - return replacement.type == GOOGLE_BASE_URL || | ||
| 495 | - replacement.type == GOOGLE_BASE_SUGGEST_URL; | ||
| 496 | - }); | ||
| 497 | + return false; | ||
| 498 | } | ||
| 499 | |||
| 500 | bool TemplateURLRef::ExtractSearchTermsFromURL( | ||
| 501 | --- components/variations/net/variations_http_headers.cc.orig | ||
| 502 | +++ components/variations/net/variations_http_headers.cc | ||
| 503 | @@ -26,10 +26,6 @@ | ||
| 504 | |||
| 505 | namespace variations { | ||
| 506 | |||
| 507 | -// The name string for the header for variations information. | ||
| 508 | -// Note that prior to M33 this header was named X-Chrome-Variations. | ||
| 509 | -const char kClientDataHeader[] = "X-Client-Data"; | ||
| 510 | - | ||
| 511 | namespace { | ||
| 512 | |||
| 513 | // The result of checking whether a request to a URL should have variations | ||
| 514 | @@ -238,29 +234,7 @@ class VariationsHeaderHelper { | ||
| 515 | VariationsHeaderHelper& operator=(const VariationsHeaderHelper&) = delete; | ||
| 516 | |||
| 517 | bool AppendHeaderIfNeeded(const GURL& url, InIncognito incognito) { | ||
| 518 | - AppendOmniboxOnDeviceSuggestionsHeaderIfNeeded(url, resource_request_); | ||
| 519 | - | ||
| 520 | - // Note the criteria for attaching client experiment headers: | ||
| 521 | - // 1. We only transmit to Google owned domains which can evaluate | ||
| 522 | - // experiments. | ||
| 523 | - // 1a. These include hosts which have a standard postfix such as: | ||
| 524 | - // *.doubleclick.net or *.googlesyndication.com or | ||
| 525 | - // exactly www.googleadservices.com or | ||
| 526 | - // international TLD domains *.google.<TLD> or *.youtube.<TLD>. | ||
| 527 | - // 2. Only transmit for non-Incognito profiles. | ||
| 528 | - // 3. For the X-Client-Data header, only include non-empty variation IDs. | ||
| 529 | - if ((incognito == InIncognito::kYes) || | ||
| 530 | - !ShouldAppendVariationsHeader(url, "Append")) | ||
| 531 | - return false; | ||
| 532 | - | ||
| 533 | - if (variations_header_.empty()) | ||
| 534 | - return false; | ||
| 535 | - | ||
| 536 | - // Set the variations header to cors_exempt_headers rather than headers | ||
| 537 | - // to be exempted from CORS checks. | ||
| 538 | - resource_request_->cors_exempt_headers.SetHeaderIfMissing( | ||
| 539 | - kClientDataHeader, variations_header_); | ||
| 540 | - return true; | ||
| 541 | + return false; | ||
| 542 | } | ||
| 543 | |||
| 544 | private: | ||
| 545 | @@ -328,8 +302,6 @@ void RemoveVariationsHeaderIfNeeded( | ||
| 546 | const net::RedirectInfo& redirect_info, | ||
| 547 | const network::mojom::URLResponseHead& response_head, | ||
| 548 | std::vector<std::string>* to_be_removed_headers) { | ||
| 549 | - if (!ShouldAppendVariationsHeader(redirect_info.new_url, "Remove")) | ||
| 550 | - to_be_removed_headers->push_back(kClientDataHeader); | ||
| 551 | } | ||
| 552 | |||
| 553 | std::unique_ptr<network::SimpleURLLoader> | ||
| 554 | @@ -359,14 +331,11 @@ CreateSimpleURLLoaderWithVariationsHeade | ||
| 555 | } | ||
| 556 | |||
| 557 | bool IsVariationsHeader(const std::string& header_name) { | ||
| 558 | - return header_name == kClientDataHeader || | ||
| 559 | - header_name == kOmniboxOnDeviceSuggestionsHeader; | ||
| 560 | + return false; | ||
| 561 | } | ||
| 562 | |||
| 563 | bool HasVariationsHeader(const network::ResourceRequest& request) { | ||
| 564 | - // Note: kOmniboxOnDeviceSuggestionsHeader is not listed because this function | ||
| 565 | - // is only used for testing. | ||
| 566 | - return request.cors_exempt_headers.HasHeader(kClientDataHeader); | ||
| 567 | + return false; | ||
| 568 | } | ||
| 569 | |||
| 570 | bool ShouldAppendVariationsHeaderForTesting( | ||
| 571 | @@ -377,12 +346,6 @@ bool ShouldAppendVariationsHeaderForTest | ||
| 572 | |||
| 573 | void UpdateCorsExemptHeaderForVariations( | ||
| 574 | network::mojom::NetworkContextParams* params) { | ||
| 575 | - params->cors_exempt_header_list.push_back(kClientDataHeader); | ||
| 576 | - | ||
| 577 | - if (base::FeatureList::IsEnabled(kReportOmniboxOnDeviceSuggestionsHeader)) { | ||
| 578 | - params->cors_exempt_header_list.push_back( | ||
| 579 | - kOmniboxOnDeviceSuggestionsHeader); | ||
| 580 | - } | ||
| 581 | } | ||
| 582 | |||
| 583 | } // namespace variations | ||
| 584 | --- net/base/url_util.cc.orig | ||
| 585 | +++ net/base/url_util.cc | ||
| 586 | @@ -442,27 +442,6 @@ bool HasGoogleHost(const GURL& url) { | ||
| 587 | } | ||
| 588 | |||
| 589 | bool IsGoogleHost(base::StringPiece host) { | ||
| 590 | - static const char* kGoogleHostSuffixes[] = { | ||
| 591 | - ".google.com", | ||
| 592 | - ".youtube.com", | ||
| 593 | - ".gmail.com", | ||
| 594 | - ".doubleclick.net", | ||
| 595 | - ".gstatic.com", | ||
| 596 | - ".googlevideo.com", | ||
| 597 | - ".googleusercontent.com", | ||
| 598 | - ".googlesyndication.com", | ||
| 599 | - ".google-analytics.com", | ||
| 600 | - ".googleadservices.com", | ||
| 601 | - ".googleapis.com", | ||
| 602 | - ".ytimg.com", | ||
| 603 | - }; | ||
| 604 | - for (const char* suffix : kGoogleHostSuffixes) { | ||
| 605 | - // Here it's possible to get away with faster case-sensitive comparisons | ||
| 606 | - // because the list above is all lowercase, and a GURL's host name will | ||
| 607 | - // always be canonicalized to lowercase as well. | ||
| 608 | - if (base::EndsWith(host, suffix)) | ||
| 609 | - return true; | ||
| 610 | - } | ||
| 611 | return false; | ||
| 612 | } | ||
| 613 | |||
