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

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

Issue 10387167: Revert 137540 - Disable off-store extension installs by default. Also get rid of ExtensionService::… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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) 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"
11 #include "chrome/browser/safe_browsing/download_protection_service.h" 11 #include "chrome/browser/safe_browsing/download_protection_service.h"
12 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 12 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 #include "chrome/common/extensions/extension_switch_utils.h"
15 #include "content/public/browser/download_item.h" 14 #include "content/public/browser/download_item.h"
16 #include "content/public/browser/download_manager.h" 15 #include "content/public/browser/download_manager.h"
17 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
18 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
19 18
20 using content::DownloadItem; 19 using content::DownloadItem;
21 20
22 DownloadShelfContextMenu::~DownloadShelfContextMenu() {} 21 DownloadShelfContextMenu::~DownloadShelfContextMenu() {}
23 22
24 DownloadShelfContextMenu::DownloadShelfContextMenu( 23 DownloadShelfContextMenu::DownloadShelfContextMenu(
(...skipping 19 matching lines...) Expand all
44 43
45 bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const { 44 bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const {
46 switch (command_id) { 45 switch (command_id) {
47 case SHOW_IN_FOLDER: 46 case SHOW_IN_FOLDER:
48 return download_item_->CanShowInFolder() && 47 return download_item_->CanShowInFolder() &&
49 !download_item_->IsTemporary(); 48 !download_item_->IsTemporary();
50 case OPEN_WHEN_COMPLETE: 49 case OPEN_WHEN_COMPLETE:
51 return download_item_->CanShowInFolder() && 50 return download_item_->CanShowInFolder() &&
52 !download_item_->IsTemporary() && 51 !download_item_->IsTemporary() &&
53 (!Extension::IsExtension(download_item_->GetTargetName()) || 52 (!Extension::IsExtension(download_item_->GetTargetName()) ||
54 extensions::switch_utils::IsOffStoreInstallEnabled()); 53 download_crx_util::ShouldOpenExtensionDownload(*download_item_));
55 case ALWAYS_OPEN_TYPE: 54 case ALWAYS_OPEN_TYPE:
56 // For temporary downloads, the target filename might be a temporary 55 // For temporary downloads, the target filename might be a temporary
57 // filename. Don't base an "Always open" decision based on it. Also 56 // filename. Don't base an "Always open" decision based on it. Also
58 // exclude extensions. 57 // exclude extensions.
59 return download_item_->CanOpenDownload() && 58 return download_item_->CanOpenDownload() &&
60 !Extension::IsExtension(download_item_->GetTargetName()) && 59 !Extension::IsExtension(download_item_->GetTargetName()) &&
61 !download_item_->IsTemporary(); 60 !download_item_->IsTemporary();
62 case CANCEL: 61 case CANCEL:
63 return download_item_->IsPartialDownload(); 62 return download_item_->IsPartialDownload();
64 case TOGGLE_PAUSE: 63 case TOGGLE_PAUSE:
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 malicious_download_menu_model_->AddItemWithStringId( 226 malicious_download_menu_model_->AddItemWithStringId(
228 DISCARD, IDS_DOWNLOAD_MENU_DISCARD); 227 DISCARD, IDS_DOWNLOAD_MENU_DISCARD);
229 malicious_download_menu_model_->AddItemWithStringId( 228 malicious_download_menu_model_->AddItemWithStringId(
230 KEEP, IDS_DOWNLOAD_MENU_KEEP); 229 KEEP, IDS_DOWNLOAD_MENU_KEEP);
231 malicious_download_menu_model_->AddSeparator(); 230 malicious_download_menu_model_->AddSeparator();
232 malicious_download_menu_model_->AddItemWithStringId( 231 malicious_download_menu_model_->AddItemWithStringId(
233 LEARN_MORE, IDS_DOWNLOAD_MENU_LEARN_MORE); 232 LEARN_MORE, IDS_DOWNLOAD_MENU_LEARN_MORE);
234 233
235 return malicious_download_menu_model_.get(); 234 return malicious_download_menu_model_.get();
236 } 235 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_crx_util.cc ('k') | chrome/browser/extensions/bundle_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698