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

Side by Side Diff: chrome/browser/download/download_shelf.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: Correct typo Created 9 years, 7 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.h" 5 #include "chrome/browser/download/download_shelf.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "chrome/browser/download/download_item.h" 8 #include "chrome/browser/download/download_item.h"
9 #include "chrome/browser/download/download_item_model.h" 9 #include "chrome/browser/download/download_item_model.h"
10 #include "chrome/browser/download/download_manager.h" 10 #include "chrome/browser/download/download_manager.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 default: 63 default:
64 NOTREACHED(); 64 NOTREACHED();
65 } 65 }
66 return string16(); 66 return string16();
67 } 67 }
68 68
69 bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const { 69 bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const {
70 switch (command_id) { 70 switch (command_id) {
71 case SHOW_IN_FOLDER: 71 case SHOW_IN_FOLDER:
72 case OPEN_WHEN_COMPLETE: 72 case OPEN_WHEN_COMPLETE:
73 return !download_->IsCancelled(); 73 return !download_->IsCancelled() && download_->file_exists();
74 case ALWAYS_OPEN_TYPE: 74 case ALWAYS_OPEN_TYPE:
75 return download_->CanOpenDownload(); 75 return download_->CanOpenDownload();
76 case CANCEL: 76 case CANCEL:
77 return download_->IsPartialDownload(); 77 return download_->IsPartialDownload();
78 case TOGGLE_PAUSE: 78 case TOGGLE_PAUSE:
79 return download_->IsInProgress(); 79 return download_->IsInProgress();
80 default: 80 default:
81 return command_id > 0 && command_id < MENU_LAST; 81 return command_id > 0 && command_id < MENU_LAST;
82 } 82 }
83 } 83 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ALWAYS_OPEN_TYPE, IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE); 154 ALWAYS_OPEN_TYPE, IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
155 finished_download_menu_model_->AddSeparator(); 155 finished_download_menu_model_->AddSeparator();
156 finished_download_menu_model_->AddItemWithStringId( 156 finished_download_menu_model_->AddItemWithStringId(
157 SHOW_IN_FOLDER, IDS_DOWNLOAD_MENU_SHOW); 157 SHOW_IN_FOLDER, IDS_DOWNLOAD_MENU_SHOW);
158 finished_download_menu_model_->AddSeparator(); 158 finished_download_menu_model_->AddSeparator();
159 finished_download_menu_model_->AddItemWithStringId( 159 finished_download_menu_model_->AddItemWithStringId(
160 CANCEL, IDS_DOWNLOAD_MENU_CANCEL); 160 CANCEL, IDS_DOWNLOAD_MENU_CANCEL);
161 161
162 return finished_download_menu_model_.get(); 162 return finished_download_menu_model_.get();
163 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698