summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 20:01:43 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 20:01:43 +0000
commitcc7948aeb5fe21af08a2d5e868c0087ded0d244a (patch)
tree8d3078af6ecb3a8e5e558b53a4da20e1e35fb656 /chrome
parentc9938e6d17e8464ce8577dccb98e19e7e5515cf0 (diff)
downloadchromium_src-cc7948aeb5fe21af08a2d5e868c0087ded0d244a.zip
chromium_src-cc7948aeb5fe21af08a2d5e868c0087ded0d244a.tar.gz
chromium_src-cc7948aeb5fe21af08a2d5e868c0087ded0d244a.tar.bz2
Implement DownloadFile::Rename() for posix. Downloads work on linux!
Review URL: http://codereview.chromium.org/46020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11659 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/download/download_file.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc
index 8a3444a..e70615a 100644
--- a/chrome/browser/download/download_file.cc
+++ b/chrome/browser/download/download_file.cc
@@ -89,17 +89,20 @@ void DownloadFile::Cancel() {
// The UI has provided us with our finalized name.
bool DownloadFile::Rename(const FilePath& new_path) {
-#if defined(OS_WIN)
Close();
+#if defined(OS_WIN)
// We cannot rename because rename will keep the same security descriptor
// on the destination file. We want to recreate the security descriptor
// with the security that makes sense in the new path.
- if (!file_util::RenameFileAndResetSecurityDescriptor(full_path_, new_path)) {
+ if (!file_util::RenameFileAndResetSecurityDescriptor(full_path_, new_path))
return false;
- }
-
- file_util::Delete(full_path_, false);
+#elif defined(OS_POSIX)
+ // TODO(estade): Move() falls back to copying and deleting when a simple
+ // rename fails. Copying sucks for large downloads. crbug.com/8737
+ if (!file_util::Move(full_path_, new_path))
+ return false;
+#endif
full_path_ = new_path;
path_renamed_ = true;
@@ -111,11 +114,6 @@ bool DownloadFile::Rename(const FilePath& new_path) {
if (!Open("a+b"))
return false;
return true;
-#elif defined(OS_POSIX)
- // TODO(port): Port this function to posix (we need file_util::Rename()).
- NOTIMPLEMENTED();
- return false;
-#endif
}
void DownloadFile::Close() {