Added support for multiple urls in the component updater.
BUG=304354
Review URL: https://codereview.chromium.org/101043010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241734 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/component_updater/crx_downloader.cc b/chrome/browser/component_updater/crx_downloader.cc
index ac8b2405..606c2ca2 100644
--- a/chrome/browser/component_updater/crx_downloader.cc
+++ b/chrome/browser/component_updater/crx_downloader.cc
@@ -74,17 +74,22 @@
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 @@
current_url_ = urls_.begin();
DoStartDownload(*current_url_);
- return true;
}
void CrxDownloader::OnDownloadComplete(
@@ -128,8 +132,10 @@
// 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);