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

Unified Diff: content/browser/download/download_file_impl.cc

Issue 11238044: Refactor BaseFile methods to return a DownloadInterruptReason instead of a net::Error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove SHFILE_TO_REASON macro Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/base_file_win.cc ('k') | content/browser/download/download_net_log_parameters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_file_impl.cc
diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc
index 102081668d7868ca7ac728a4d8ced0877f846d7f..c01859972fc80793d8da752b159cbd5b997fba19 100644
--- a/content/browser/download/download_file_impl.cc
+++ b/content/browser/download/download_file_impl.cc
@@ -66,12 +66,11 @@ void DownloadFileImpl::Initialize(const InitializeCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
update_timer_.reset(new base::RepeatingTimer<DownloadFileImpl>());
- net::Error net_result = file_.Initialize(default_download_directory_);
- if (net_result != net::OK) {
+ content::DownloadInterruptReason result =
+ file_.Initialize(default_download_directory_);
+ if (result != content::DOWNLOAD_INTERRUPT_REASON_NONE) {
BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE, base::Bind(
- callback, content::ConvertNetErrorToInterruptReason(
- net_result, content::DOWNLOAD_INTERRUPT_FROM_DISK)));
+ BrowserThread::UI, FROM_HERE, base::Bind(callback, result));
return;
}
@@ -99,9 +98,7 @@ content::DownloadInterruptReason DownloadFileImpl::AppendDataToFile(
base::TimeDelta::FromMilliseconds(kUpdatePeriodMs),
this, &DownloadFileImpl::SendUpdate);
}
- return content::ConvertNetErrorToInterruptReason(
- file_.AppendDataToFile(data, data_len),
- content::DOWNLOAD_INTERRUPT_FROM_DISK);
+ return file_.AppendDataToFile(data, data_len);
}
void DownloadFileImpl::Rename(const FilePath& full_path,
@@ -120,10 +117,8 @@ void DownloadFileImpl::Rename(const FilePath& full_path,
}
}
- net::Error rename_error = file_.Rename(new_path);
- content::DownloadInterruptReason reason(
- content::DOWNLOAD_INTERRUPT_REASON_NONE);
- if (net::OK != rename_error) {
+ content::DownloadInterruptReason reason = file_.Rename(new_path);
+ if (reason != content::DOWNLOAD_INTERRUPT_REASON_NONE) {
// Make sure our information is updated, since we're about to
// error out.
SendUpdate();
@@ -131,10 +126,6 @@ void DownloadFileImpl::Rename(const FilePath& full_path,
// Null out callback so that we don't do any more stream processing.
stream_reader_->RegisterCallback(base::Closure());
- reason =
- content::ConvertNetErrorToInterruptReason(
- rename_error,
- content::DOWNLOAD_INTERRUPT_FROM_DISK);
new_path.clear();
}
« no previous file with comments | « content/browser/download/base_file_win.cc ('k') | content/browser/download/download_net_log_parameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698