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 /chrome/browser/download/download_shelf_context_menu.cc | |
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 'chrome/browser/download/download_shelf_context_menu.cc')
-rw-r--r-- | chrome/browser/download/download_shelf_context_menu.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/download/download_shelf_context_menu.cc b/chrome/browser/download/download_shelf_context_menu.cc index 6eb492f..6cb748e 100644 --- a/chrome/browser/download/download_shelf_context_menu.cc +++ b/chrome/browser/download/download_shelf_context_menu.cc @@ -44,10 +44,18 @@ bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const { switch (command_id) { case SHOW_IN_FOLDER: case OPEN_WHEN_COMPLETE: - return download_item_->CanShowInFolder(); + // Don't enable "Open when complete" if the download is no longer + // available or if it is temporary. We explicitly ignore "Open when + // complete" for temporary downloads. + return download_item_->CanShowInFolder() && + !download_item_->IsTemporary(); case ALWAYS_OPEN_TYPE: + // For temporary downloads, the target filename might be a temporary + // filename. Don't base an "Always open" decision based on it. Also + // exclude extensions. return download_item_->CanOpenDownload() && - !Extension::IsExtension(download_item_->GetTargetName()); + !Extension::IsExtension(download_item_->GetTargetName()) && + !download_item_->IsTemporary(); case CANCEL: return download_item_->IsPartialDownload(); case TOGGLE_PAUSE: |