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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 already_fetched_ = true; | 239 already_fetched_ = true; |
240 fetcher_.reset(net::URLFetcher::Create( | 240 fetcher_.reset(net::URLFetcher::Create( |
241 fetcher_id_, GURL(kSearchDomainCheckURL), net::URLFetcher::GET, this)); | 241 fetcher_id_, GURL(kSearchDomainCheckURL), net::URLFetcher::GET, this)); |
242 ++fetcher_id_; | 242 ++fetcher_id_; |
243 // We don't want this fetch to set new entries in the cache or cookies, lest | 243 // We don't want this fetch to set new entries in the cache or cookies, lest |
244 // we alarm the user. | 244 // we alarm the user. |
245 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | | 245 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | |
246 net::LOAD_DO_NOT_SAVE_COOKIES); | 246 net::LOAD_DO_NOT_SAVE_COOKIES); |
247 fetcher_->SetRequestContext(client_->GetRequestContext()); | 247 fetcher_->SetRequestContext(client_->GetRequestContext()); |
248 | 248 |
249 // Configure to max_retries at most kMaxRetries times for 5xx errors. | 249 // Configure to retry at most kMaxRetries times for 5xx errors. |
250 static const int kMaxRetries = 5; | 250 static const int kMaxRetries = 5; |
251 fetcher_->SetMaxRetriesOn5xx(kMaxRetries); | 251 fetcher_->SetMaxRetriesOn5xx(kMaxRetries); |
252 // Configure to retry at most kMaxRetries times for network changes. | |
Peter Kasting
2014/09/05 22:43:18
Nit: How about this comment:
Also retry kMaxRetri
Jaekyun Seok (inactive)
2014/09/06 03:14:43
Done.
| |
253 fetcher_->SetAutomaticallyRetryOnNetworkChanges(kMaxRetries); | |
252 | 254 |
253 fetcher_->Start(); | 255 fetcher_->Start(); |
254 } | 256 } |
255 | 257 |
256 void GoogleURLTracker::OnNavigationPending( | 258 void GoogleURLTracker::OnNavigationPending( |
257 scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper, | 259 scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper, |
258 infobars::InfoBarManager* infobar_manager, | 260 infobars::InfoBarManager* infobar_manager, |
259 int pending_id) { | 261 int pending_id) { |
260 GoogleURLTrackerMapEntry* map_entry = NULL; | 262 GoogleURLTrackerMapEntry* map_entry = NULL; |
261 | 263 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 } | 400 } |
399 if (client_->IsListeningForNavigationStart()) { | 401 if (client_->IsListeningForNavigationStart()) { |
400 DCHECK(!search_committed_); | 402 DCHECK(!search_committed_); |
401 client_->SetListeningForNavigationStart(false); | 403 client_->SetListeningForNavigationStart(false); |
402 } | 404 } |
403 } | 405 } |
404 | 406 |
405 void GoogleURLTracker::NotifyGoogleURLUpdated() { | 407 void GoogleURLTracker::NotifyGoogleURLUpdated() { |
406 callback_list_.Notify(); | 408 callback_list_.Notify(); |
407 } | 409 } |
OLD | NEW |