OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 // Configure to max_retries at most kMaxRetries times for 5xx errors. | 207 // Configure to max_retries at most kMaxRetries times for 5xx errors. |
208 static const int kMaxRetries = 5; | 208 static const int kMaxRetries = 5; |
209 fetcher_->set_max_retries(kMaxRetries); | 209 fetcher_->set_max_retries(kMaxRetries); |
210 | 210 |
211 fetcher_->Start(); | 211 fetcher_->Start(); |
212 } | 212 } |
213 | 213 |
214 void GoogleURLTracker::OnURLFetchComplete(const URLFetcher* source, | 214 void GoogleURLTracker::OnURLFetchComplete(const URLFetcher* source, |
215 const GURL& url, | 215 const GURL& url, |
216 const URLRequestStatus& status, | 216 const net::URLRequestStatus& status, |
217 int response_code, | 217 int response_code, |
218 const ResponseCookies& cookies, | 218 const ResponseCookies& cookies, |
219 const std::string& data) { | 219 const std::string& data) { |
220 // Delete the fetcher on this function's exit. | 220 // Delete the fetcher on this function's exit. |
221 scoped_ptr<URLFetcher> clean_up_fetcher(fetcher_.release()); | 221 scoped_ptr<URLFetcher> clean_up_fetcher(fetcher_.release()); |
222 | 222 |
223 // Don't update the URL if the request didn't succeed. | 223 // Don't update the URL if the request didn't succeed. |
224 if (!status.is_success() || (response_code != 200)) { | 224 if (!status.is_success() || (response_code != 200)) { |
225 already_fetched_ = false; | 225 already_fetched_ = false; |
226 return; | 226 return; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 371 } |
372 | 372 |
373 void GoogleURLTracker::ShowGoogleURLInfoBarIfNecessary( | 373 void GoogleURLTracker::ShowGoogleURLInfoBarIfNecessary( |
374 TabContents* tab_contents) { | 374 TabContents* tab_contents) { |
375 if (!need_to_prompt_) | 375 if (!need_to_prompt_) |
376 return; | 376 return; |
377 DCHECK(!fetched_google_url_.is_empty()); | 377 DCHECK(!fetched_google_url_.is_empty()); |
378 | 378 |
379 infobar_ = (*infobar_creator_)(tab_contents, this, fetched_google_url_); | 379 infobar_ = (*infobar_creator_)(tab_contents, this, fetched_google_url_); |
380 } | 380 } |
OLD | NEW |