Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Side by Side Diff: chrome/browser/google/google_url_tracker.cc

Issue 10412050: Change most content::URLFetcher references to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS, address comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/google/google_url_tracker.h ('k') | chrome/browser/importer/toolbar_importer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 switches::kDisableBackgroundNetworking)) 276 switches::kDisableBackgroundNetworking))
277 return; 277 return;
278 278
279 std::string fetch_url = CommandLine::ForCurrentProcess()-> 279 std::string fetch_url = CommandLine::ForCurrentProcess()->
280 GetSwitchValueASCII(switches::kGoogleSearchDomainCheckURL); 280 GetSwitchValueASCII(switches::kGoogleSearchDomainCheckURL);
281 if (fetch_url.empty()) 281 if (fetch_url.empty())
282 fetch_url = kSearchDomainCheckURL; 282 fetch_url = kSearchDomainCheckURL;
283 283
284 already_fetched_ = true; 284 already_fetched_ = true;
285 fetcher_.reset(content::URLFetcher::Create(fetcher_id_, GURL(fetch_url), 285 fetcher_.reset(content::URLFetcher::Create(fetcher_id_, GURL(fetch_url),
286 content::URLFetcher::GET, this)); 286 net::URLFetcher::GET, this));
287 ++fetcher_id_; 287 ++fetcher_id_;
288 // We don't want this fetch to set new entries in the cache or cookies, lest 288 // We don't want this fetch to set new entries in the cache or cookies, lest
289 // we alarm the user. 289 // we alarm the user.
290 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | 290 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE |
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 net::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<net::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
312 // "<scheme>://[www.]google.<TLD>/". 312 // "<scheme>://[www.]google.<TLD>/".
313 std::string url_str; 313 std::string url_str;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker.h ('k') | chrome/browser/importer/toolbar_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698