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

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

Issue 105853002: Implement a background downloader using BITS in Windows Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed error codes. 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
« no previous file with comments | « chrome/browser/component_updater/url_fetcher_downloader.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/component_updater/url_fetcher_downloader.cc
diff --git a/chrome/browser/component_updater/url_fetcher_downloader.cc b/chrome/browser/component_updater/url_fetcher_downloader.cc
index d76303aace5852f4c9cc80fdff87a68630ce29a5..6c3e9473857f379ac8da3774d000e16a79c2c210 100644
--- a/chrome/browser/component_updater/url_fetcher_downloader.cc
+++ b/chrome/browser/component_updater/url_fetcher_downloader.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/component_updater/url_fetcher_downloader.h"
+
#include "chrome/browser/component_updater/component_updater_utils.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/load_flags.h"
@@ -14,9 +15,12 @@ using content::BrowserThread;
namespace component_updater {
UrlFetcherDownloader::UrlFetcherDownloader(
+ scoped_ptr<CrxDownloader> successor,
net::URLRequestContextGetter* context_getter,
- scoped_refptr<base::SequencedTaskRunner> task_runner)
- : context_getter_(context_getter),
+ scoped_refptr<base::SequencedTaskRunner> task_runner,
+ const DownloadCallback& download_callback)
+ : CrxDownloader(successor.Pass(), download_callback),
+ context_getter_(context_getter),
task_runner_(task_runner) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}
@@ -43,17 +47,20 @@ void UrlFetcherDownloader::DoStartDownload(const GURL& url) {
void UrlFetcherDownloader::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ // Consider a 5xx response from the server as an indication to terminate
+ // the request and avoid overloading the server in this case.
+ // is not accepting requests for the moment.
const int fetch_error(GetFetchError(*url_fetcher_));
- base::FilePath response;
+ const bool is_handled = fetch_error == 0 || IsHttpServerError(fetch_error);
+
+ Result result;
+ result.error = fetch_error;
+ result.is_background_download = false;
if (!fetch_error) {
- source->GetResponseAsFilePath(true, &response);
+ source->GetResponseAsFilePath(true, &result.response);
}
- // Consider a "503 Service Unavailable" response from the server as an
- // indication to terminate the request and avoid overloading a server which
- // is not accepting requests for the moment.
- const bool is_handled = fetch_error == 0 || fetch_error == 503;
- OnDownloadComplete(is_handled, fetch_error, response);
+ CrxDownloader::OnDownloadComplete(is_handled, result);
}
} // namespace component_updater
« no previous file with comments | « chrome/browser/component_updater/url_fetcher_downloader.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698