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

Side by Side Diff: chrome/browser/extensions/updater/extension_downloader.cc

Issue 11572044: Automatically retry the following URLFetchers when the network changes: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Document the retry behavior Created 8 years 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 | « no previous file | chrome/browser/net/gaia/gaia_oauth_fetcher.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/extensions/updater/extension_downloader.h" 5 #include "chrome/browser/extensions/updater/extension_downloader.h"
6 6
7 #include <utility> 7 #include <utility>
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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 << " for " << id_list; 422 << " for " << id_list;
423 } 423 }
424 424
425 manifest_fetcher_.reset(net::URLFetcher::Create( 425 manifest_fetcher_.reset(net::URLFetcher::Create(
426 kManifestFetcherId, manifests_queue_.active_request()->full_url(), 426 kManifestFetcherId, manifests_queue_.active_request()->full_url(),
427 net::URLFetcher::GET, this)); 427 net::URLFetcher::GET, this));
428 manifest_fetcher_->SetRequestContext(request_context_); 428 manifest_fetcher_->SetRequestContext(request_context_);
429 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 429 manifest_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
430 net::LOAD_DO_NOT_SAVE_COOKIES | 430 net::LOAD_DO_NOT_SAVE_COOKIES |
431 net::LOAD_DISABLE_CACHE); 431 net::LOAD_DISABLE_CACHE);
432 // Update checks can be interrupted if a network change is detected; this is
433 // common for the retail mode AppPack on ChromeOS. Retrying once should be
434 // enough to recover in those cases; let the fetcher retry up to 3 times
435 // just in case. http://crosbug.com/130602
436 manifest_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3);
432 manifest_fetcher_->Start(); 437 manifest_fetcher_->Start();
433 } 438 }
434 439
435 void ExtensionDownloader::OnURLFetchComplete( 440 void ExtensionDownloader::OnURLFetchComplete(
436 const net::URLFetcher* source) { 441 const net::URLFetcher* source) {
437 VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); 442 VLOG(2) << source->GetResponseCode() << " " << source->GetURL();
438 443
439 if (source == manifest_fetcher_.get()) { 444 if (source == manifest_fetcher_.get()) {
440 std::string data; 445 std::string data;
441 source->GetResponseAsString(&data); 446 source->GetResponseAsString(&data);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 672 }
668 673
669 void ExtensionDownloader::CreateExtensionFetcher() { 674 void ExtensionDownloader::CreateExtensionFetcher() {
670 extension_fetcher_.reset(net::URLFetcher::Create( 675 extension_fetcher_.reset(net::URLFetcher::Create(
671 kExtensionFetcherId, extensions_queue_.active_request()->url, 676 kExtensionFetcherId, extensions_queue_.active_request()->url,
672 net::URLFetcher::GET, this)); 677 net::URLFetcher::GET, this));
673 extension_fetcher_->SetRequestContext(request_context_); 678 extension_fetcher_->SetRequestContext(request_context_);
674 extension_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 679 extension_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
675 net::LOAD_DO_NOT_SAVE_COOKIES | 680 net::LOAD_DO_NOT_SAVE_COOKIES |
676 net::LOAD_DISABLE_CACHE); 681 net::LOAD_DISABLE_CACHE);
682 extension_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3);
677 // Download CRX files to a temp file. The blacklist is small and will be 683 // Download CRX files to a temp file. The blacklist is small and will be
678 // processed in memory, so it is fetched into a string. 684 // processed in memory, so it is fetched into a string.
679 if (extensions_queue_.active_request()->id != kBlacklistAppID) { 685 if (extensions_queue_.active_request()->id != kBlacklistAppID) {
680 extension_fetcher_->SaveResponseToTemporaryFile( 686 extension_fetcher_->SaveResponseToTemporaryFile(
681 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 687 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
682 } 688 }
683 689
684 VLOG(2) << "Starting fetch of " << extensions_queue_.active_request()->url 690 VLOG(2) << "Starting fetch of " << extensions_queue_.active_request()->url
685 << " for " << extensions_queue_.active_request()->id; 691 << " for " << extensions_queue_.active_request()->id;
686 692
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 void ExtensionDownloader::NotifyUpdateFound(const std::string& id, 770 void ExtensionDownloader::NotifyUpdateFound(const std::string& id,
765 const std::string& version) { 771 const std::string& version) {
766 UpdateDetails updateInfo(id, Version(version)); 772 UpdateDetails updateInfo(id, Version(version));
767 content::NotificationService::current()->Notify( 773 content::NotificationService::current()->Notify(
768 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, 774 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND,
769 content::NotificationService::AllBrowserContextsAndSources(), 775 content::NotificationService::AllBrowserContextsAndSources(),
770 content::Details<UpdateDetails>(&updateInfo)); 776 content::Details<UpdateDetails>(&updateInfo));
771 } 777 }
772 778
773 } // namespace extensions 779 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/gaia/gaia_oauth_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698