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

Unified Diff: chrome/browser/component_updater/crx_downloader.cc

Issue 101043010: Added support for multiple urls in the component updater. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/component_updater/crx_downloader.cc
diff --git a/chrome/browser/component_updater/crx_downloader.cc b/chrome/browser/component_updater/crx_downloader.cc
index ac8b2405dc90375bb2272875e567905b12e17620..606c2ca273042dd3af65d4a9288bf5feabbffcad 100644
--- a/chrome/browser/component_updater/crx_downloader.cc
+++ b/chrome/browser/component_updater/crx_downloader.cc
@@ -74,17 +74,22 @@ CrxDownloader::download_metrics() const {
return retval;
}
-bool CrxDownloader::StartDownloadFromUrl(const GURL& url) {
+void CrxDownloader::StartDownloadFromUrl(const GURL& url) {
std::vector<GURL> urls;
urls.push_back(url);
- return StartDownload(urls);
+ StartDownload(urls);
}
-bool CrxDownloader::StartDownload(const std::vector<GURL>& urls) {
+void CrxDownloader::StartDownload(const std::vector<GURL>& urls) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (urls.empty())
- return false;
+ if (urls.empty()) {
+ // Make a result and complete the download with a generic error for now.
+ Result result;
+ result.error = -1;
+ download_callback_.Run(result);
+ return;
+ }
// If the urls are mutated while this downloader is active, then the
// behavior is undefined in the sense that the outcome of the download could
@@ -94,7 +99,6 @@ bool CrxDownloader::StartDownload(const std::vector<GURL>& urls) {
current_url_ = urls_.begin();
DoStartDownload(*current_url_);
- return true;
}
void CrxDownloader::OnDownloadComplete(
@@ -128,8 +132,10 @@ void CrxDownloader::OnDownloadComplete(
// the request over to it so that the successor can try the pruned list
// of urls. Otherwise, the request ends here since the current downloader
// has tried all urls and it can't fall back on any other downloader.
- if (successor_ && successor_->StartDownload(urls_))
+ if (successor_ && !urls_.empty()) {
+ successor_->StartDownload(urls_);
return;
+ }
}
download_callback_.Run(result);
« no previous file with comments | « chrome/browser/component_updater/crx_downloader.h ('k') | chrome/browser/component_updater/crx_update_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698