diff options
author | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 04:09:02 +0000 |
---|---|---|
committer | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 04:09:02 +0000 |
commit | 71f55847499f7fa45e4468c27d593eb18f20fb10 (patch) | |
tree | f81e062f683d1d9fe78184da04295f1a933af2e9 /content/browser/download | |
parent | 37b4ea2428b736617aa2f0f3236e6a99f5aa0ea6 (diff) | |
download | chromium_src-71f55847499f7fa45e4468c27d593eb18f20fb10.zip chromium_src-71f55847499f7fa45e4468c27d593eb18f20fb10.tar.gz chromium_src-71f55847499f7fa45e4468c27d593eb18f20fb10.tar.bz2 |
Mark GData downloads as temporary.
This patch does the following:
1. Allow DownloadItems to transition to temporary downloads after they are created.
2. Prevent temporary downloads from affecting the last download directory. The last download directory is used as the default for subsequent "Save as" downloads.
3. Disable "Open when complete" and "Always open files of this type" for temporary downloads.
4. Mark GData downloads as temporary.
BUG=none
TEST=GData downloads don't show up in history and are removed automatically from the shelf
Review URL: http://codereview.chromium.org/9796010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/download')
-rw-r--r-- | content/browser/download/download_item_impl.cc | 8 | ||||
-rw-r--r-- | content/browser/download/download_item_impl.h | 1 | ||||
-rw-r--r-- | content/browser/download/download_manager_impl.cc | 4 |
3 files changed, 11 insertions, 2 deletions
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc index d8a808b..1a9e39e 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc @@ -347,7 +347,10 @@ void DownloadItemImpl::OpenDownload() { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (IsPartialDownload()) { - open_when_complete_ = !open_when_complete_; + // We don't honor the open_when_complete_ flag for temporary + // downloads. Don't set it because it shows up in the UI. + if (!IsTemporary()) + open_when_complete_ = !open_when_complete_; return; } @@ -1111,6 +1114,9 @@ const FilePath& DownloadItemImpl::GetSuggestedPath() const { return state_info_.suggested_path; } bool DownloadItemImpl::IsTemporary() const { return is_temporary_; } +void DownloadItemImpl::SetIsTemporary(bool temporary) { + is_temporary_ = temporary; +} void DownloadItemImpl::SetOpened(bool opened) { opened_ = opened; } bool DownloadItemImpl::GetOpened() const { return opened_; } const std::string& DownloadItemImpl::GetLastModifiedTime() const { diff --git a/content/browser/download/download_item_impl.h b/content/browser/download/download_item_impl.h index 0d52138..e6128cd 100644 --- a/content/browser/download/download_item_impl.h +++ b/content/browser/download/download_item_impl.h @@ -190,6 +190,7 @@ class CONTENT_EXPORT DownloadItemImpl : public content::DownloadItem { virtual bool IsOtr() const OVERRIDE; virtual const FilePath& GetSuggestedPath() const OVERRIDE; virtual bool IsTemporary() const OVERRIDE; + virtual void SetIsTemporary(bool temporary) OVERRIDE; virtual void SetOpened(bool opened) OVERRIDE; virtual bool GetOpened() const OVERRIDE; virtual const std::string& GetLastModifiedTime() const OVERRIDE; diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index f6d16f7..33b32d8 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -904,7 +904,9 @@ void DownloadManagerImpl::FileSelected(const FilePath& path, VLOG(20) << __FUNCTION__ << "()" << " path = \"" << path.value() << "\"" << " download = " << download->DebugString(true); - if (download->PromptUserForSaveLocation()) + // Retain the last directory that was picked by the user. Exclude temporary + // downloads since the path likely points at the location of a temporary file. + if (download->PromptUserForSaveLocation() && !download->IsTemporary()) last_download_path_ = path.DirName(); // Make sure the initial file name is set only once. |