OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/download/download_crx_util.h" | 8 #include "chrome/browser/download/download_crx_util.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_prefs.h" | 10 #include "chrome/browser/download/download_prefs.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 return model; | 46 return model; |
47 } | 47 } |
48 | 48 |
49 bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const { | 49 bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const { |
50 switch (command_id) { | 50 switch (command_id) { |
51 case SHOW_IN_FOLDER: | 51 case SHOW_IN_FOLDER: |
52 return download_item_->CanShowInFolder() && | 52 return download_item_->CanShowInFolder() && |
53 !download_item_->IsTemporary(); | 53 !download_item_->IsTemporary(); |
54 case OPEN_WHEN_COMPLETE: | 54 case OPEN_WHEN_COMPLETE: |
55 return download_item_->CanShowInFolder() && | 55 return download_item_->CanShowInFolder() && |
56 !download_item_->IsTemporary() && | 56 !download_item_->IsTemporary(); |
57 (!Extension::IsExtension(download_item_->GetTargetName()) || | |
Aaron Boodman
2012/05/24 09:08:53
It's no longer important to prevent extensions fro
| |
58 extensions::switch_utils::IsOffStoreInstallEnabled()); | |
59 case ALWAYS_OPEN_TYPE: | 57 case ALWAYS_OPEN_TYPE: |
60 // For temporary downloads, the target filename might be a temporary | 58 // For temporary downloads, the target filename might be a temporary |
61 // filename. Don't base an "Always open" decision based on it. Also | 59 // filename. Don't base an "Always open" decision based on it. Also |
62 // exclude extensions. | 60 // exclude extensions. |
63 return download_item_->CanOpenDownload() && | 61 return download_item_->CanOpenDownload() && |
64 !Extension::IsExtension(download_item_->GetTargetName()) && | 62 !Extension::IsExtension(download_item_->GetTargetName()) && |
65 !download_item_->IsTemporary(); | 63 !download_item_->IsTemporary(); |
66 case CANCEL: | 64 case CANCEL: |
67 return download_item_->IsPartialDownload(); | 65 return download_item_->IsPartialDownload(); |
68 case TOGGLE_PAUSE: | 66 case TOGGLE_PAUSE: |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 malicious_download_menu_model_->AddItemWithStringId( | 230 malicious_download_menu_model_->AddItemWithStringId( |
233 DISCARD, IDS_DOWNLOAD_MENU_DISCARD); | 231 DISCARD, IDS_DOWNLOAD_MENU_DISCARD); |
234 malicious_download_menu_model_->AddItemWithStringId( | 232 malicious_download_menu_model_->AddItemWithStringId( |
235 KEEP, IDS_DOWNLOAD_MENU_KEEP); | 233 KEEP, IDS_DOWNLOAD_MENU_KEEP); |
236 malicious_download_menu_model_->AddSeparator(); | 234 malicious_download_menu_model_->AddSeparator(); |
237 malicious_download_menu_model_->AddItemWithStringId( | 235 malicious_download_menu_model_->AddItemWithStringId( |
238 LEARN_MORE, IDS_DOWNLOAD_MENU_LEARN_MORE); | 236 LEARN_MORE, IDS_DOWNLOAD_MENU_LEARN_MORE); |
239 | 237 |
240 return malicious_download_menu_model_.get(); | 238 return malicious_download_menu_model_.get(); |
241 } | 239 } |
OLD | NEW |