| 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/extensions/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
| 43 #include "content/public/browser/resource_dispatcher_host.h" | 43 #include "content/public/browser/resource_dispatcher_host.h" |
| 44 #include "content/public/browser/user_metrics.h" | 44 #include "content/public/browser/user_metrics.h" |
| 45 #include "extensions/browser/extension_prefs.h" | 45 #include "extensions/browser/extension_prefs.h" |
| 46 #include "extensions/browser/extension_registry.h" | 46 #include "extensions/browser/extension_registry.h" |
| 47 #include "extensions/browser/extension_system.h" | 47 #include "extensions/browser/extension_system.h" |
| 48 #include "extensions/browser/install/crx_install_error.h" | 48 #include "extensions/browser/install/crx_install_error.h" |
| 49 #include "extensions/browser/install/extension_install_ui.h" | 49 #include "extensions/browser/install/extension_install_ui.h" |
| 50 #include "extensions/browser/install_flag.h" | 50 #include "extensions/browser/install_flag.h" |
| 51 #include "extensions/browser/notification_types.h" | 51 #include "extensions/browser/notification_types.h" |
| 52 #include "extensions/browser/preload_check.h" |
| 52 #include "extensions/common/extension_icon_set.h" | 53 #include "extensions/common/extension_icon_set.h" |
| 53 #include "extensions/common/file_util.h" | 54 #include "extensions/common/file_util.h" |
| 54 #include "extensions/common/manifest.h" | 55 #include "extensions/common/manifest.h" |
| 55 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 56 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
| 56 #include "extensions/common/manifest_handlers/shared_module_info.h" | 57 #include "extensions/common/manifest_handlers/shared_module_info.h" |
| 57 #include "extensions/common/manifest_url_handlers.h" | 58 #include "extensions/common/manifest_url_handlers.h" |
| 58 #include "extensions/common/permissions/permission_message_provider.h" | 59 #include "extensions/common/permissions/permission_message_provider.h" |
| 59 #include "extensions/common/permissions/permission_set.h" | 60 #include "extensions/common/permissions/permission_set.h" |
| 60 #include "extensions/common/permissions/permissions_data.h" | 61 #include "extensions/common/permissions/permissions_data.h" |
| 61 #include "extensions/common/user_script.h" | 62 #include "extensions/common/user_script.h" |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 ReportFailureFromUIThread( | 533 ReportFailureFromUIThread( |
| 533 CrxInstallError(CrxInstallError::ERROR_DECLINED, | 534 CrxInstallError(CrxInstallError::ERROR_DECLINED, |
| 534 base::UTF8ToUTF16(base::JoinString( | 535 base::UTF8ToUTF16(base::JoinString( |
| 535 install_checker_->requirement_errors(), " ")))); | 536 install_checker_->requirement_errors(), " ")))); |
| 536 return; | 537 return; |
| 537 } | 538 } |
| 538 install_flags_ |= kInstallFlagHasRequirementErrors; | 539 install_flags_ |= kInstallFlagHasRequirementErrors; |
| 539 } | 540 } |
| 540 | 541 |
| 541 // Check the blacklist state. | 542 // Check the blacklist state. |
| 542 if (install_checker_->blacklist_state() == BLACKLISTED_MALWARE) { | 543 if (install_checker_->blacklist_error() == PreloadCheck::BLACKLISTED_ID) { |
| 543 install_flags_ |= kInstallFlagIsBlacklistedForMalware; | 544 install_flags_ |= kInstallFlagIsBlacklistedForMalware; |
| 544 } | 545 } |
| 545 | 546 |
| 546 if ((install_checker_->blacklist_state() == BLACKLISTED_MALWARE || | 547 if ((install_checker_->blacklist_error() == PreloadCheck::BLACKLISTED_ID || |
| 547 install_checker_->blacklist_state() == BLACKLISTED_UNKNOWN) && | 548 install_checker_->blacklist_error() == |
| 549 PreloadCheck::BLACKLISTED_UNKNOWN) && |
| 548 !allow_silent_install_) { | 550 !allow_silent_install_) { |
| 549 // User tried to install a blacklisted extension. Show an error and | 551 // User tried to install a blacklisted extension. Show an error and |
| 550 // refuse to install it. | 552 // refuse to install it. |
| 551 ReportFailureFromUIThread(CrxInstallError( | 553 ReportFailureFromUIThread(CrxInstallError( |
| 552 CrxInstallError::ERROR_DECLINED, | 554 CrxInstallError::ERROR_DECLINED, |
| 553 l10n_util::GetStringFUTF16(IDS_EXTENSION_IS_BLACKLISTED, | 555 l10n_util::GetStringFUTF16(IDS_EXTENSION_IS_BLACKLISTED, |
| 554 base::UTF8ToUTF16(extension()->name())))); | 556 base::UTF8ToUTF16(extension()->name())))); |
| 555 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlockCRX", | 557 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlockCRX", |
| 556 extension()->location(), | 558 extension()->location(), |
| 557 Manifest::NUM_LOCATIONS); | 559 Manifest::NUM_LOCATIONS); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( | 909 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension( |
| 908 service->profile(), extension()); | 910 service->profile(), extension()); |
| 909 client_->ShowDialog(base::Bind(&CrxInstaller::OnInstallPromptDone, this), | 911 client_->ShowDialog(base::Bind(&CrxInstaller::OnInstallPromptDone, this), |
| 910 extension(), nullptr, | 912 extension(), nullptr, |
| 911 base::MakeUnique<ExtensionInstallPrompt::Prompt>(type), | 913 base::MakeUnique<ExtensionInstallPrompt::Prompt>(type), |
| 912 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); | 914 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); |
| 913 } | 915 } |
| 914 } | 916 } |
| 915 | 917 |
| 916 } // namespace extensions | 918 } // namespace extensions |
| OLD | NEW |