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

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

Issue 6905049: Detect removed files and reflect the state in chrome://downloads and the download shelf (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge with the latest revision Created 9 years, 6 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_context_menu.h" 5 #include "chrome/browser/download/download_shelf_context_menu.h"
6 6
7 #include "chrome/browser/download/download_item.h" 7 #include "chrome/browser/download/download_item.h"
8 #include "chrome/browser/download/download_item_model.h" 8 #include "chrome/browser/download/download_item_model.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
11 11
12 DownloadShelfContextMenu::~DownloadShelfContextMenu() {} 12 DownloadShelfContextMenu::~DownloadShelfContextMenu() {}
13 13
14 DownloadShelfContextMenu::DownloadShelfContextMenu( 14 DownloadShelfContextMenu::DownloadShelfContextMenu(
15 BaseDownloadItemModel* download_model) 15 BaseDownloadItemModel* download_model)
16 : download_model_(download_model), 16 : download_model_(download_model),
17 download_item_(download_model->download()) { 17 download_item_(download_model->download()) {
18 } 18 }
19 19
20 ui::SimpleMenuModel* DownloadShelfContextMenu::GetMenuModel() { 20 ui::SimpleMenuModel* DownloadShelfContextMenu::GetMenuModel() {
21 return download_item_->IsComplete() ? GetFinishedMenuModel() 21 return download_item_->IsComplete() ? GetFinishedMenuModel()
22 : GetInProgressMenuModel(); 22 : GetInProgressMenuModel();
23 } 23 }
24 24
25 bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const { 25 bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const {
26 switch (command_id) { 26 switch (command_id) {
27 case SHOW_IN_FOLDER: 27 case SHOW_IN_FOLDER:
28 case OPEN_WHEN_COMPLETE: 28 case OPEN_WHEN_COMPLETE:
29 return !download_item_->IsCancelled(); 29 return download_item_->CanShowInFolder();
30 case ALWAYS_OPEN_TYPE: 30 case ALWAYS_OPEN_TYPE:
31 return download_item_->CanOpenDownload(); 31 return download_item_->CanOpenDownload();
32 case CANCEL: 32 case CANCEL:
33 return download_item_->IsPartialDownload(); 33 return download_item_->IsPartialDownload();
34 case TOGGLE_PAUSE: 34 case TOGGLE_PAUSE:
35 return download_item_->IsInProgress(); 35 return download_item_->IsInProgress();
36 default: 36 default:
37 return command_id > 0 && command_id < MENU_LAST; 37 return command_id > 0 && command_id < MENU_LAST;
38 } 38 }
39 } 39 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 ALWAYS_OPEN_TYPE, IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE); 145 ALWAYS_OPEN_TYPE, IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
146 finished_download_menu_model_->AddSeparator(); 146 finished_download_menu_model_->AddSeparator();
147 finished_download_menu_model_->AddItemWithStringId( 147 finished_download_menu_model_->AddItemWithStringId(
148 SHOW_IN_FOLDER, IDS_DOWNLOAD_MENU_SHOW); 148 SHOW_IN_FOLDER, IDS_DOWNLOAD_MENU_SHOW);
149 finished_download_menu_model_->AddSeparator(); 149 finished_download_menu_model_->AddSeparator();
150 finished_download_menu_model_->AddItemWithStringId( 150 finished_download_menu_model_->AddItemWithStringId(
151 CANCEL, IDS_DOWNLOAD_MENU_CANCEL); 151 CANCEL, IDS_DOWNLOAD_MENU_CANCEL);
152 152
153 return finished_download_menu_model_.get(); 153 return finished_download_menu_model_.get();
154 } 154 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager_unittest.cc ('k') | chrome/browser/download/download_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698