--- a/components/google/core/browser/google_url_tracker.cc +++ b/components/google/core/browser/google_url_tracker.cc @@ -26,9 +26,9 @@ const char GoogleURLTracker::kDefaultGoogleHomepage[] = - "https://www.google.com/"; + ""; const char GoogleURLTracker::kSearchDomainCheckURL[] = - "https://www.google.com/searchdomaincheck?format=domain&type=chrome"; + ""; GoogleURLTracker::GoogleURLTracker( std::unique_ptr client, @@ -145,83 +145,4 @@ void GoogleURLTracker::FinishSleep() { } void GoogleURLTracker::StartFetchIfDesirable() { - // Bail if a fetch isn't appropriate right now. This function will be called - // again each time one of the preconditions changes, so we'll fetch - // immediately once all of them are met. - // - // See comments in header on the class, on RequestServerCheck(), and on the - // various members here for more detail on exactly what the conditions are. - if (in_startup_sleep_ || already_fetched_ || !need_to_fetch_) - return; - - // Some switches should disable the Google URL tracker entirely. If we can't - // do background networking, we can't do the necessary fetch, and if the user - // specified a Google base URL manually, we shouldn't bother to look up any - // alternatives or offer to switch to them. - if (!client_->IsBackgroundNetworkingEnabled() || - base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kGoogleBaseURL)) - return; - - already_fetched_ = true; - net::NetworkTrafficAnnotationTag traffic_annotation = - net::DefineNetworkTrafficAnnotation("google_url_tracker", R"( - semantics { - sender: "Google URL Tracker" - description: - "When the user's default search engine is Google, or Google " - "services are used to resolve navigation errors, the browser needs " - "to know the ideal origin for requests to Google services. In " - "these cases the browser makes a request to a global Google " - "service that returns this origin, potentially taking into account " - "the user's cookies or IP address." - trigger: "Browser startup or network change." - data: "None." - destination: GOOGLE_OWNED_SERVICE - } - policy { - cookies_allowed: YES - cookies_store: "user" - setting: - "To disable this check, users can change the default search engine " - "to something other than Google, and disable 'Use a web service to " - "help resolve navigation errors' in Chromium's settings under " - "Privacy.\nAlternately, running Chromium with " - "--google-base-url=\"https://www.google.com/\" will disable this, " - "and force Chromium to use the specified URL for Google service " - "requests.\nFinally, running Chromium with " - "--disable-background-networking will disable this, as well as " - "various other features that make network requests automatically." - policy_exception_justification: - "Setting DefaultSearchProviderEnabled Chrome settings policy to " - "false suffices as a way of setting the default search engine to " - "not be Google. But there is no policy that controls navigation " - "error resolution." - })"); - fetcher_ = - net::URLFetcher::Create(fetcher_id_, GURL(kSearchDomainCheckURL), - net::URLFetcher::GET, this, traffic_annotation); - data_use_measurement::DataUseUserData::AttachToFetcher( - fetcher_.get(), - data_use_measurement::DataUseUserData::GOOGLE_URL_TRACKER); - ++fetcher_id_; - // We don't want this fetch to set new entries in the cache or cookies, lest - // we alarm the user. - fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | - net::LOAD_DO_NOT_SAVE_COOKIES); - fetcher_->SetRequestContext(client_->GetRequestContext()); - - // Configure to retry at most kMaxRetries times for 5xx errors. - static const int kMaxRetries = 5; - fetcher_->SetMaxRetriesOn5xx(kMaxRetries); - - // Also retry kMaxRetries times on network change errors. A network change can - // propagate through Chrome in various stages, so it's possible for this code - // to be reached via OnNetworkChanged(), and then have the fetch we kick off - // be canceled due to e.g. the DNS server changing at a later time. In general - // it's not possible to ensure that by the time we reach here any requests we - // start won't be canceled in this fashion, so retrying is the best we can do. - fetcher_->SetAutomaticallyRetryOnNetworkChanges(kMaxRetries); - - fetcher_->Start(); }