--- a/components/google/core/browser/google_url_tracker.cc 2018-05-12 14:58:47.830426938 -0400 +++ b/components/google/core/browser/google_url_tracker.cc.new 2018-05-12 15:03:04.653460391 -0400 @@ -25,11 +25,11 @@ #include "services/network/public/cpp/simple_url_loader.h" const char GoogleURLTracker::kDefaultGoogleHomepage[] = - "https://www.google.com/"; + ""; const char GoogleURLTracker::kSearchDomainCheckURL[] = - "https://www.google.com/searchdomaincheck?format=domain&type=chrome"; + ""; const base::Feature GoogleURLTracker::kNoSearchDomainCheck{ - "NoSearchDomainCheck", base::FEATURE_DISABLED_BY_DEFAULT}; + "NoSearchDomainCheck", base::FEATURE_ENABLED_BY_DEFAULT}; GoogleURLTracker::GoogleURLTracker( std::unique_ptr client, @@ -146,83 +146,4 @@ } void GoogleURLTracker::StartLoadIfDesirable() { - // Bail if a load isn't appropriate right now. This function will be called - // again each time one of the preconditions changes, so we'll load - // 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_loaded_ || !need_to_load_) - return; - - // Some switches should disable the Google URL tracker entirely. If we can't - // do background networking, we can't do the necessary load, 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_loaded_ = 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." - })"); - auto resource_request = std::make_unique(); - resource_request->url = GURL(kSearchDomainCheckURL); - // We don't want this load to set new entries in the cache or cookies, lest - // we alarm the user. - resource_request->load_flags = - (net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SAVE_COOKIES); - simple_loader_ = network::SimpleURLLoader::Create(std::move(resource_request), - traffic_annotation); - // Configure to retry at most kMaxRetries times for 5xx errors and network - // changes. - // 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 load 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. - static const int kMaxRetries = 5; - simple_loader_->SetRetryOptions( - kMaxRetries, - network::SimpleURLLoader::RetryMode::RETRY_ON_5XX | - network::SimpleURLLoader::RetryMode::RETRY_ON_NETWORK_CHANGE); - simple_loader_->DownloadToString( - client_->GetURLLoaderFactory(), - base::BindOnce(&GoogleURLTracker::OnURLLoaderComplete, - base::Unretained(this)), - 2 * 1024 /* max_body_size */); }