summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_manager.h
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-17 17:34:16 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-17 17:34:16 +0000
commit7a256ea78369c42083645a443dee4060a2f980cf (patch)
tree30b4d8ae86488c92e9a7b3136a5b077d77f1cd4c /chrome/browser/download/download_manager.h
parent9ae1f71009b7157673e0f34432304cdcddcccbf9 (diff)
downloadchromium_src-7a256ea78369c42083645a443dee4060a2f980cf.zip
chromium_src-7a256ea78369c42083645a443dee4060a2f980cf.tar.gz
chromium_src-7a256ea78369c42083645a443dee4060a2f980cf.tar.bz2
Fix bug 3470, where the download tab would show the temporary name for dangerous downloads (see download_tab_view.cc).
Also fixes bug 3471, where if the same file is downloaded again while the first one is not finished, they would get the same name. For dangerous downloads, we now uniquify the path on download start (so the UI shows a file name most likely to be the final name), and on download complete (so if there 2 simultaneous downloads of the same file the last one does not overwrite the first). BUG=3470, 3471 TEST=see bugs Review URL: http://codereview.chromium.org/7395 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3536 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_manager.h')
-rw-r--r--chrome/browser/download/download_manager.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
index 6e78fb6..cbae765 100644
--- a/chrome/browser/download/download_manager.h
+++ b/chrome/browser/download/download_manager.h
@@ -99,6 +99,7 @@ class DownloadItem {
// Constructing from user action:
DownloadItem(int32 download_id,
const std::wstring& path,
+ int path_uniquifier,
const std::wstring& url,
const std::wstring& original_name,
const Time start_time,
@@ -170,6 +171,8 @@ class DownloadItem {
void set_file_name(const std::wstring& name) { file_name_ = name; }
std::wstring full_path() const { return full_path_; }
void set_full_path(const std::wstring& path) { full_path_ = path; }
+ int path_uniquifier() const { return path_uniquifier_; }
+ void set_path_uniquifier(int uniquifier) { path_uniquifier_ = uniquifier; }
std::wstring url() const { return url_; }
int64 total_bytes() const { return total_bytes_; }
void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; }
@@ -194,7 +197,8 @@ class DownloadItem {
void set_original_name(const std::wstring& name) { original_name_ = name; }
// Returns the file-name that should be reported to the user, which is
- // file_name_ for safe downloads and original_name_ for dangerous ones.
+ // file_name_ for safe downloads and original_name_ for dangerous ones with
+ // the uniquifier number.
std::wstring GetFileName() const;
private:
@@ -207,6 +211,10 @@ class DownloadItem {
// Full path to the downloaded file
std::wstring full_path_;
+ // A number that should be appended to the path to make it unique, or 0 if the
+ // path should be used as is.
+ int path_uniquifier_;
+
// Short display version of the file
std::wstring file_name_;
@@ -456,7 +464,8 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
// Invoked on the UI thread when a dangerous downloaded file has been renamed.
void DangerousDownloadRenamed(int64 download_handle,
bool success,
- const std::wstring& new_path);
+ const std::wstring& new_path,
+ int new_path_uniquifier);
// Checks whether a file represents a risk if downloaded.
bool IsDangerous(const std::wstring& file_name);