summaryrefslogtreecommitdiff
path: root/www/chromium-uc/patches/core/ungoogled-chromium/disable-google-host-detection.patch
blob: adc4f3163ac73108aaa23004e49d27f07d0ac755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
# Disables various detections of Google hosts and functionality specific to them

--- a/chrome/common/google_url_loader_throttle.cc
+++ b/chrome/common/google_url_loader_throttle.cc
@@ -19,10 +19,6 @@
 #include "ui/base/device_form_factor.h"
 #endif
 
-#if BUILDFLAG(ENABLE_EXTENSIONS)
-#include "extensions/common/extension_urls.h"
-#endif
-
 namespace {
 
 #if BUILDFLAG(IS_ANDROID)
@@ -65,52 +61,6 @@ void GoogleURLLoaderThrottle::DetachFrom
 void GoogleURLLoaderThrottle::WillStartRequest(
     network::ResourceRequest* request,
     bool* defer) {
-  if (dynamic_params_.force_safe_search) {
-    GURL new_url;
-    safe_search_util::ForceGoogleSafeSearch(request->url, &new_url);
-    if (!new_url.is_empty())
-      request->url = new_url;
-  }
-
-  static_assert(safe_search_util::YOUTUBE_RESTRICT_OFF == 0,
-                "OFF must be first");
-  if (dynamic_params_.youtube_restrict >
-          safe_search_util::YOUTUBE_RESTRICT_OFF &&
-      dynamic_params_.youtube_restrict <
-          safe_search_util::YOUTUBE_RESTRICT_COUNT) {
-    safe_search_util::ForceYouTubeRestrict(
-        request->url, &request->cors_exempt_headers,
-        static_cast<safe_search_util::YouTubeRestrictMode>(
-            dynamic_params_.youtube_restrict));
-  }
-
-  if (!dynamic_params_.allowed_domains_for_apps.empty() &&
-      request->url.DomainIs("google.com")) {
-    request->cors_exempt_headers.SetHeader(
-        safe_search_util::kGoogleAppsAllowedDomains,
-        dynamic_params_.allowed_domains_for_apps);
-  }
-
-#if BUILDFLAG(IS_ANDROID)
-  if (!client_data_header_.empty() &&
-      google_util::IsGoogleAssociatedDomainUrl(request->url)) {
-    request->cors_exempt_headers.SetHeader(kCCTClientDataHeader,
-                                           client_data_header_);
-  }
-
-  bool is_google_homepage_or_search =
-      google_util::IsGoogleHomePageUrl(request->url) ||
-      google_util::IsGoogleSearchUrl(request->url);
-  if (is_google_homepage_or_search) {
-    if (base::FeatureList::IsEnabled(features::kRequestDesktopSiteForTablets) &&
-        ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) {
-      request->headers.SetHeader(kRequestDesktopDataHeader,
-                                 is_tab_large_enough_ ? "1" : "0");
-      base::UmaHistogramBoolean("Android.RequestDesktopSite.TabletEligible",
-                                is_tab_large_enough_);
-    }
-  }
-#endif
 }
 
 void GoogleURLLoaderThrottle::WillRedirectRequest(
@@ -120,37 +70,6 @@ void GoogleURLLoaderThrottle::WillRedire
     std::vector<std::string>* to_be_removed_headers,
     net::HttpRequestHeaders* modified_headers,
     net::HttpRequestHeaders* modified_cors_exempt_headers) {
-  // URLLoaderThrottles can only change the redirect URL when the network
-  // service is enabled. The non-network service path handles this in
-  // ChromeNetworkDelegate.
-  if (dynamic_params_.force_safe_search) {
-    safe_search_util::ForceGoogleSafeSearch(redirect_info->new_url,
-                                            &redirect_info->new_url);
-  }
-
-  if (dynamic_params_.youtube_restrict >
-          safe_search_util::YOUTUBE_RESTRICT_OFF &&
-      dynamic_params_.youtube_restrict <
-          safe_search_util::YOUTUBE_RESTRICT_COUNT) {
-    safe_search_util::ForceYouTubeRestrict(
-        redirect_info->new_url, modified_cors_exempt_headers,
-        static_cast<safe_search_util::YouTubeRestrictMode>(
-            dynamic_params_.youtube_restrict));
-  }
-
-  if (!dynamic_params_.allowed_domains_for_apps.empty() &&
-      redirect_info->new_url.DomainIs("google.com")) {
-    modified_cors_exempt_headers->SetHeader(
-        safe_search_util::kGoogleAppsAllowedDomains,
-        dynamic_params_.allowed_domains_for_apps);
-  }
-
-#if BUILDFLAG(IS_ANDROID)
-  if (!client_data_header_.empty() &&
-      !google_util::IsGoogleAssociatedDomainUrl(redirect_info->new_url)) {
-    to_be_removed_headers->push_back(kCCTClientDataHeader);
-  }
-#endif
 }
 
 #if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -158,23 +77,5 @@ void GoogleURLLoaderThrottle::WillProces
     const GURL& response_url,
     network::mojom::URLResponseHead* response_head,
     bool* defer) {
-  // Built-in additional protection for the chrome web store origin by ensuring
-  // that the X-Frame-Options protection mechanism is set to either DENY or
-  // SAMEORIGIN.
-  GURL webstore_url(extension_urls::GetWebstoreLaunchURL());
-  if (response_url.SchemeIsHTTPOrHTTPS() &&
-      response_url.DomainIs(webstore_url.host_piece())) {
-    // TODO(mkwst): Consider shifting this to a NavigationThrottle rather than
-    // relying on implicit ordering between this check and the time at which
-    // ParsedHeaders is created.
-    CHECK(response_head);
-    CHECK(response_head->parsed_headers);
-    if (response_head->parsed_headers->xfo !=
-        network::mojom::XFrameOptionsValue::kDeny) {
-      response_head->headers->SetHeader("X-Frame-Options", "SAMEORIGIN");
-      response_head->parsed_headers->xfo =
-          network::mojom::XFrameOptionsValue::kSameOrigin;
-    }
-  }
 }
 #endif
--- a/components/google/core/common/google_util.cc
+++ b/components/google/core/common/google_util.cc
@@ -31,112 +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::LowerCaseEqualsASCII(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::LowerCaseEqualsASCII(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).
-bool IsValidURL(const GURL& url, PortPermission port_permission) {
-  static bool g_ignore_port_numbers =
-      base::CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kIgnoreGooglePortNumbers);
-  return url.is_valid() && url.SchemeIsHTTPOrHTTPS() &&
-         (url.port().empty() || g_ignore_port_numbers ||
-          (port_permission == ALLOW_NON_STANDARD_PORTS));
-}
-
-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) ||
-         IsValidHostName(canonical_host, "youtubekids", 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);
-}
-
 }  // namespace
 
 // Global functions -----------------------------------------------------------
@@ -144,12 +38,6 @@ bool IsGoogleSearchSubdomainUrl(const GU
 const char kGoogleHomepageURL[] = "trk:113: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;
 }
 
@@ -160,161 +48,53 @@ std::string GetGoogleLocale(const std::s
 
 GURL AppendGoogleLocaleParam(const GURL& url,
                              const std::string& application_locale) {
-  return net::AppendQueryParameter(url, "hl",
-                                   GetGoogleLocale(application_locale));
+  return 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 "nolocale";
 }
 
 GURL GetGoogleSearchURL(const GURL& google_homepage_url) {
-  // To transform the homepage URL into the corresponding search URL, add the
-  // "search" and the "q=" query string.
-  GURL::Replacements replacements;
-  replacements.SetPathStr("search");
-  replacements.SetQueryStr("q=");
-  return google_homepage_url.ReplaceComponents(replacements);
+  return google_homepage_url;
 }
 
 const GURL& CommandLineGoogleBaseURL() {
-  // Unit tests may add command-line flags after the first call to this
-  // function, so we don't simply initialize a static |base_url| directly and
-  // then unconditionally return it.
-  static base::NoDestructor<std::string> switch_value;
   static base::NoDestructor<GURL> base_url;
-  std::string current_switch_value(
-      base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
-          switches::kGoogleBaseURL));
-  if (current_switch_value != *switch_value) {
-    *switch_value = current_switch_value;
-    *base_url = url_formatter::FixupURL(*switch_value, std::string());
-    if (!base_url->is_valid() || base_url->has_query() || base_url->has_ref())
-      *base_url = GURL();
-  }
+  *base_url = GURL();
   return *base_url;
 }
 
 bool StartsWithCommandLineGoogleBaseURL(const GURL& url) {
-  const GURL& base_url(CommandLineGoogleBaseURL());
-  return base_url.is_valid() &&
-         base::StartsWith(url.possibly_invalid_spec(), base_url.spec(),
-                          base::CompareCase::SENSITIVE);
+  return false;
 }
 
 bool IsGoogleHostname(base::StringPiece host,
                       SubdomainPermission subdomain_permission) {
-  url::CanonHostInfo host_info;
-  return IsCanonicalHostGoogleHostname(net::CanonicalizeHost(host, &host_info),
-                                       subdomain_permission);
+  return false;
 }
 
 bool IsGoogleDomainUrl(const GURL& url,
                        SubdomainPermission subdomain_permission,
                        PortPermission port_permission) {
-  return IsValidURL(url, port_permission) &&
-         IsCanonicalHostGoogleHostname(url.host_piece(), 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",
-      ".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::LowerCaseEqualsASCII(host, kHostsToSetHeadersFor[i]))
-      return true;
-  }
-
   return false;
 }
 
--- a/components/page_load_metrics/browser/page_load_metrics_util.cc
+++ b/components/page_load_metrics/browser/page_load_metrics_util.cc
@@ -210,9 +210,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) {
--- 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 =
 }  // 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 absl::optional<std::string>();
 }
 
 bool IsGoogleHostname(const GURL& url) {
--- a/components/search_engines/template_url.cc
+++ b/components/search_engines/template_url.cc
@@ -532,11 +532,7 @@ std::u16string TemplateURLRef::SearchTer
 bool TemplateURLRef::HasGoogleBaseURLs(
     const SearchTermsData& search_terms_data) const {
   ParseIfNecessary(search_terms_data);
-  return std::any_of(replacements_.begin(), replacements_.end(),
-                     [](const Replacement& replacement) {
-                       return replacement.type == GOOGLE_BASE_URL ||
-                              replacement.type == GOOGLE_BASE_SUGGEST_URL;
-                     });
+  return false;
 }
 
 bool TemplateURLRef::ExtractSearchTermsFromURL(
--- a/components/variations/net/variations_http_headers.cc
+++ b/components/variations/net/variations_http_headers.cc
@@ -33,10 +33,6 @@
 
 namespace variations {
 
-// The name string for the header for variations information.
-// Note that prior to M33 this header was named X-Chrome-Variations.
-const char kClientDataHeader[] = "X-Client-Data";
-
 namespace {
 
 // The result of checking whether a request to a URL should have variations
@@ -257,30 +253,7 @@ class VariationsHeaderHelper {
   VariationsHeaderHelper& operator=(const VariationsHeaderHelper&) = delete;
 
   bool AppendHeaderIfNeeded(const GURL& url, InIncognito incognito) {
-    AppendOmniboxOnDeviceSuggestionsHeaderIfNeeded(url, resource_request_);
-
-    // Note the criteria for attaching client experiment headers:
-    // 1. We only transmit to Google owned domains which can evaluate
-    // experiments.
-    //    1a. These include hosts which have a standard postfix such as:
-    //         *.doubleclick.net or *.googlesyndication.com or
-    //         exactly www.googleadservices.com or
-    //         international TLD domains *.google.<TLD> or *.youtube.<TLD>.
-    // 2. Only transmit for non-Incognito profiles.
-    // 3. For the X-Client-Data header, only include non-empty variation IDs.
-    if ((incognito == InIncognito::kYes) ||
-        !ShouldAppendVariationsHeader(url, "Append"))
-      return false;
-
-    if (variations_header_.empty())
-      return false;
-
-    // Set the variations header to cors_exempt_headers rather than headers to
-    // be exempted from CORS checks, and to avoid exposing the header to service
-    // workers.
-    resource_request_->cors_exempt_headers.SetHeaderIfMissing(
-        kClientDataHeader, variations_header_);
-    return true;
+    return false;
   }
 
  private:
@@ -348,8 +321,6 @@ void RemoveVariationsHeaderIfNeeded(
     const net::RedirectInfo& redirect_info,
     const network::mojom::URLResponseHead& response_head,
     std::vector<std::string>* to_be_removed_headers) {
-  if (!ShouldAppendVariationsHeader(redirect_info.new_url, "Remove"))
-    to_be_removed_headers->push_back(kClientDataHeader);
 }
 
 std::unique_ptr<network::SimpleURLLoader>
@@ -379,9 +350,7 @@ CreateSimpleURLLoaderWithVariationsHeade
 }
 
 bool HasVariationsHeader(const network::ResourceRequest& request) {
-  // Note: kOmniboxOnDeviceSuggestionsHeader is not listed because this function
-  // is only used for testing.
-  return request.cors_exempt_headers.HasHeader(kClientDataHeader);
+  return false;
 }
 
 bool ShouldAppendVariationsHeaderForTesting(
@@ -392,12 +361,6 @@ bool ShouldAppendVariationsHeaderForTest
 
 void UpdateCorsExemptHeaderForVariations(
     network::mojom::NetworkContextParams* params) {
-  params->cors_exempt_header_list.push_back(kClientDataHeader);
-
-  if (base::FeatureList::IsEnabled(kReportOmniboxOnDeviceSuggestionsHeader)) {
-    params->cors_exempt_header_list.push_back(
-        kOmniboxOnDeviceSuggestionsHeader);
-  }
 }
 
 }  // namespace variations
--- a/net/base/url_util.cc
+++ b/net/base/url_util.cc
@@ -455,27 +455,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;
 }