| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/google/core/browser/google_url_tracker.h" | 5 #include "components/google/core/browser/google_url_tracker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // See comments in header on the class, on RequestServerCheck(), and on the | 226 // See comments in header on the class, on RequestServerCheck(), and on the |
| 227 // various members here for more detail on exactly what the conditions are. | 227 // various members here for more detail on exactly what the conditions are. |
| 228 if (in_startup_sleep_ || already_fetched_ || !need_to_fetch_) | 228 if (in_startup_sleep_ || already_fetched_ || !need_to_fetch_) |
| 229 return; | 229 return; |
| 230 | 230 |
| 231 // Some switches should disable the Google URL tracker entirely. If we can't | 231 // Some switches should disable the Google URL tracker entirely. If we can't |
| 232 // do background networking, we can't do the necessary fetch, and if the user | 232 // do background networking, we can't do the necessary fetch, and if the user |
| 233 // specified a Google base URL manually, we shouldn't bother to look up any | 233 // specified a Google base URL manually, we shouldn't bother to look up any |
| 234 // alternatives or offer to switch to them. | 234 // alternatives or offer to switch to them. |
| 235 if (!client_->IsBackgroundNetworkingEnabled() || | 235 if (!client_->IsBackgroundNetworkingEnabled() || |
| 236 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGoogleBaseURL)) | 236 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 237 switches::kGoogleBaseURL)) |
| 237 return; | 238 return; |
| 238 | 239 |
| 239 already_fetched_ = true; | 240 already_fetched_ = true; |
| 240 fetcher_.reset(net::URLFetcher::Create( | 241 fetcher_.reset(net::URLFetcher::Create( |
| 241 fetcher_id_, GURL(kSearchDomainCheckURL), net::URLFetcher::GET, this)); | 242 fetcher_id_, GURL(kSearchDomainCheckURL), net::URLFetcher::GET, this)); |
| 242 ++fetcher_id_; | 243 ++fetcher_id_; |
| 243 // We don't want this fetch to set new entries in the cache or cookies, lest | 244 // We don't want this fetch to set new entries in the cache or cookies, lest |
| 244 // we alarm the user. | 245 // we alarm the user. |
| 245 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | | 246 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | |
| 246 net::LOAD_DO_NOT_SAVE_COOKIES); | 247 net::LOAD_DO_NOT_SAVE_COOKIES); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } | 407 } |
| 407 if (client_->IsListeningForNavigationStart()) { | 408 if (client_->IsListeningForNavigationStart()) { |
| 408 DCHECK(!search_committed_); | 409 DCHECK(!search_committed_); |
| 409 client_->SetListeningForNavigationStart(false); | 410 client_->SetListeningForNavigationStart(false); |
| 410 } | 411 } |
| 411 } | 412 } |
| 412 | 413 |
| 413 void GoogleURLTracker::NotifyGoogleURLUpdated() { | 414 void GoogleURLTracker::NotifyGoogleURLUpdated() { |
| 414 callback_list_.Notify(); | 415 callback_list_.Notify(); |
| 415 } | 416 } |
| OLD | NEW |