OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/google/google_url_tracker.h" | 5 #include "chrome/browser/google/google_url_tracker.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 net::LOAD_DO_NOT_SAVE_COOKIES); | 291 net::LOAD_DO_NOT_SAVE_COOKIES); |
292 fetcher_->SetRequestContext(profile_->GetRequestContext()); | 292 fetcher_->SetRequestContext(profile_->GetRequestContext()); |
293 | 293 |
294 // Configure to max_retries at most kMaxRetries times for 5xx errors. | 294 // Configure to max_retries at most kMaxRetries times for 5xx errors. |
295 static const int kMaxRetries = 5; | 295 static const int kMaxRetries = 5; |
296 fetcher_->SetMaxRetries(kMaxRetries); | 296 fetcher_->SetMaxRetries(kMaxRetries); |
297 | 297 |
298 fetcher_->Start(); | 298 fetcher_->Start(); |
299 } | 299 } |
300 | 300 |
301 void GoogleURLTracker::OnURLFetchComplete(const content::URLFetcher* source) { | 301 void GoogleURLTracker::OnURLFetchComplete(const net::URLFetcher* source) { |
302 // Delete the fetcher on this function's exit. | 302 // Delete the fetcher on this function's exit. |
303 scoped_ptr<content::URLFetcher> clean_up_fetcher(fetcher_.release()); | 303 scoped_ptr<content::URLFetcher> clean_up_fetcher(fetcher_.release()); |
304 | 304 |
305 // Don't update the URL if the request didn't succeed. | 305 // Don't update the URL if the request didn't succeed. |
306 if (!source->GetStatus().is_success() || (source->GetResponseCode() != 200)) { | 306 if (!source->GetStatus().is_success() || (source->GetResponseCode() != 200)) { |
307 already_fetched_ = false; | 307 already_fetched_ = false; |
308 return; | 308 return; |
309 } | 309 } |
310 | 310 |
311 // See if the response data was valid. It should be | 311 // See if the response data was valid. It should be |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 | 511 |
512 void GoogleURLTracker::CloseAllInfoBars(bool redo_searches) { | 512 void GoogleURLTracker::CloseAllInfoBars(bool redo_searches) { |
513 // Close all infobars, whether they've been added to tabs or not. | 513 // Close all infobars, whether they've been added to tabs or not. |
514 while (!infobar_map_.empty()) | 514 while (!infobar_map_.empty()) |
515 infobar_map_.begin()->second->Close(redo_searches); | 515 infobar_map_.begin()->second->Close(redo_searches); |
516 | 516 |
517 // Any registered listeners for NAV_ENTRY_COMMITTED and TAB_CLOSED are now | 517 // Any registered listeners for NAV_ENTRY_COMMITTED and TAB_CLOSED are now |
518 // irrelevant as the associated infobars are gone. | 518 // irrelevant as the associated infobars are gone. |
519 registrar_.RemoveAll(); | 519 registrar_.RemoveAll(); |
520 } | 520 } |
OLD | NEW |