diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 22:25:16 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 22:25:16 +0000 |
commit | 2cee72cad9aa14ad897c3b2c52e700ae4c909afb (patch) | |
tree | 6bb4b889adf76545db6f4c6113341b1941ef2410 /chrome/browser/download/download_file.cc | |
parent | 0483cf1851e39d333d5fdab34506e1ef1006fc8a (diff) | |
download | chromium_src-2cee72cad9aa14ad897c3b2c52e700ae4c909afb.zip chromium_src-2cee72cad9aa14ad897c3b2c52e700ae4c909afb.tar.gz chromium_src-2cee72cad9aa14ad897c3b2c52e700ae4c909afb.tar.bz2 |
Support dragging a virtual file out of the browser on MacOSX. This is based on the discussion of drag-out feature on whatwg: http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-August/022122.html
BUG=none
TEST=To test, drag an element that adds the DownloadURL format data via event.DataTransfer.setData, to the desktop or a folder.
Review URL: http://codereview.chromium.org/598043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_file.cc')
-rw-r--r-- | chrome/browser/download/download_file.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc index 40aa900..09d5e1d 100644 --- a/chrome/browser/download/download_file.cc +++ b/chrome/browser/download/download_file.cc @@ -100,11 +100,19 @@ void DownloadFile::Cancel() { // The UI has provided us with our finalized name. bool DownloadFile::Rename(const FilePath& new_path) { - Close(); + // If the new path is same as the old one, there is no need to perform the + // following renaming logic. + if (new_path == full_path_) { + path_renamed_ = true; + + // Don't close the file if we're not done (finished or canceled). + if (!in_progress_) + Close(); - // Nothing more to do if the new path is same as the old one. - if (new_path == full_path_) return true; + } + + Close(); #if defined(OS_WIN) // We cannot rename because rename will keep the same security descriptor |