Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chrome/browser/download/download_shelf.cc

Issue 159769: Allow cancellable download items to be removable from download shelf.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/download/download_shelf.h" 5 #include "chrome/browser/download/download_shelf.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/dom_ui/downloads_ui.h" 10 #include "chrome/browser/dom_ui/downloads_ui.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 bool DownloadShelfContextMenu::IsItemCommandEnabled(int id) const { 66 bool DownloadShelfContextMenu::IsItemCommandEnabled(int id) const {
67 switch (id) { 67 switch (id) {
68 case SHOW_IN_FOLDER: 68 case SHOW_IN_FOLDER:
69 case OPEN_WHEN_COMPLETE: 69 case OPEN_WHEN_COMPLETE:
70 return download_->state() != DownloadItem::CANCELLED; 70 return download_->state() != DownloadItem::CANCELLED;
71 case ALWAYS_OPEN_TYPE: 71 case ALWAYS_OPEN_TYPE:
72 return download_util::CanOpenDownload(download_); 72 return download_util::CanOpenDownload(download_);
73 case CANCEL: 73 case CANCEL:
74 return download_->state() == DownloadItem::IN_PROGRESS; 74 return download_->state() == DownloadItem::IN_PROGRESS;
75 case REMOVE_ITEM: 75 case REMOVE_ITEM:
76 return download_->state() == DownloadItem::COMPLETE; 76 return download_->state() == DownloadItem::COMPLETE ||
77 download_->state() == DownloadItem::CANCELLED;
77 default: 78 default:
78 return id > 0 && id < MENU_LAST; 79 return id > 0 && id < MENU_LAST;
79 } 80 }
80 } 81 }
81 82
82 void DownloadShelfContextMenu::ExecuteItemCommand(int id) { 83 void DownloadShelfContextMenu::ExecuteItemCommand(int id) {
83 switch (id) { 84 switch (id) {
84 case SHOW_IN_FOLDER: 85 case SHOW_IN_FOLDER:
85 download_->manager()->ShowDownloadInShell(download_); 86 download_->manager()->ShowDownloadInShell(download_);
86 break; 87 break;
(...skipping 10 matching lines...) Expand all
97 case CANCEL: 98 case CANCEL:
98 model_->CancelTask(); 99 model_->CancelTask();
99 break; 100 break;
100 case REMOVE_ITEM: 101 case REMOVE_ITEM:
101 download_->Remove(false); 102 download_->Remove(false);
102 break; 103 break;
103 default: 104 default:
104 NOTREACHED(); 105 NOTREACHED();
105 } 106 }
106 } 107 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698