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

Unified Diff: chrome/browser/extensions/crx_installer.cc

Issue 2740853002: Use PreloadCheckGroup in ExtensionInstallChecker. Make RequirementsChecker a PreloadCheck. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/crx_installer.h ('k') | chrome/browser/extensions/crx_installer_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/crx_installer.cc
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 80a2467d5322d874cebc714a722a72102ba9cb19..d581c05ceeba4406c51fc01cab0b5b0d5e4c1ccd 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -356,7 +356,7 @@ CrxInstallError CrxInstaller::AllowInstall(const Extension* extension) {
}
}
- if (install_checker_.extension()->is_app()) {
+ if (extension->is_app()) {
// If the app was downloaded, apps_require_extension_mime_type_
// will be set. In this case, check that it was served with the
// right mime type. Make an exception for file URLs, which come
@@ -389,7 +389,7 @@ CrxInstallError CrxInstaller::AllowInstall(const Extension* extension) {
pattern.SetHost(download_url_.host());
pattern.SetMatchSubdomains(true);
- URLPatternSet patterns = install_checker_.extension()->web_extent();
+ URLPatternSet patterns = extension->web_extent();
for (URLPatternSet::const_iterator i = patterns.begin();
i != patterns.end(); ++i) {
if (!pattern.MatchesHost(i->host())) {
@@ -432,7 +432,7 @@ void CrxInstaller::OnUnpackSuccess(
install_cause(),
extension_misc::NUM_INSTALL_CAUSES);
- install_checker_.set_extension(extension);
+ extension_ = extension;
temp_dir_ = temp_dir;
if (!install_icon.empty())
install_icon_.reset(new SkBitmap(install_icon));
@@ -514,6 +514,7 @@ void CrxInstaller::CheckInstall() {
CrxInstaller::OnInstallChecksComplete(0);
} else {
install_checker_.Start(
+ extension_,
ExtensionInstallChecker::CHECK_ALL,
false /* fail fast */,
base::Bind(&CrxInstaller::OnInstallChecksComplete, this));
@@ -526,12 +527,11 @@ void CrxInstaller::OnInstallChecksComplete(int failed_checks) {
return;
// Check for requirement errors.
- if (!install_checker_.requirement_errors().empty()) {
+ if (!install_checker_.requirement_error_message().empty()) {
if (error_on_unsupported_requirements_) {
ReportFailureFromUIThread(
CrxInstallError(CrxInstallError::ERROR_DECLINED,
- base::UTF8ToUTF16(base::JoinString(
- install_checker_.requirement_errors(), " "))));
+ install_checker_.requirement_error_message()));
return;
}
install_flags_ |= kInstallFlagHasRequirementErrors;
@@ -542,9 +542,7 @@ void CrxInstaller::OnInstallChecksComplete(int failed_checks) {
install_flags_ |= kInstallFlagIsBlacklistedForMalware;
}
- if ((install_checker_.blacklist_error() == PreloadCheck::BLACKLISTED_ID ||
- install_checker_.blacklist_error() ==
- PreloadCheck::BLACKLISTED_UNKNOWN) &&
+ if (install_checker_.blacklist_error() != PreloadCheck::NONE &&
!allow_silent_install_) {
// User tried to install a blacklisted extension. Show an error and
// refuse to install it.
@@ -571,7 +569,7 @@ void CrxInstaller::OnInstallChecksComplete(int failed_checks) {
client_->install_ui()->SetSkipPostInstallUI(true);
ReportFailureFromUIThread(
CrxInstallError(CrxInstallError::ERROR_DECLINED,
- base::UTF8ToUTF16(install_checker_.policy_error())));
+ install_checker_.policy_error()));
return;
}
@@ -584,7 +582,7 @@ void CrxInstaller::ConfirmInstall() {
if (!service || service->browser_terminating())
return;
- if (KioskModeInfo::IsKioskOnly(install_checker_.extension().get())) {
+ if (KioskModeInfo::IsKioskOnly(extension())) {
bool in_kiosk_mode = false;
#if defined(OS_CHROMEOS)
user_manager::UserManager* user_manager = user_manager::UserManager::Get();
@@ -723,13 +721,13 @@ void CrxInstaller::ReloadExtensionAfterInstall(
// with base::string16
std::string extension_id = extension()->id();
std::string error;
- install_checker_.set_extension(
+ extension_ =
file_util::LoadExtension(
version_dir,
install_source_,
// Note: modified by UpdateCreationFlagsAndCompleteInstall.
creation_flags_,
- &error).get());
+ &error).get();
if (extension()) {
ReportSuccessFromFileThread();
« no previous file with comments | « chrome/browser/extensions/crx_installer.h ('k') | chrome/browser/extensions/crx_installer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698