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

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

Issue 2783143005: Replace ExtensionInstallChecker with generic PreloadCheckGroup (Closed)
Patch Set: fix debug build Created 3 years, 8 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/unpacked_installer.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/unpacked_installer.cc
diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc
index 0d93fcc26aac63d036ee7d61efc674f41ebf79be..6d7bda46c0975c58707a5c2168b573d321077208 100644
--- a/chrome/browser/extensions/unpacked_installer.cc
+++ b/chrome/browser/extensions/unpacked_installer.cc
@@ -13,7 +13,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
-#include "chrome/browser/extensions/extension_install_checker.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_management.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -27,6 +26,9 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/install/extension_install_ui.h"
#include "extensions/browser/install_flag.h"
+#include "extensions/browser/policy_check.h"
+#include "extensions/browser/preload_check_group.h"
+#include "extensions/browser/requirements_checker.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_l10n_util.h"
#include "extensions/common/file_util.h"
@@ -243,28 +245,34 @@ void UnpackedInstaller::StartInstallChecks() {
}
}
- install_checker_ = base::MakeUnique<ExtensionInstallChecker>(
- profile_, extension_,
- ExtensionInstallChecker::CHECK_REQUIREMENTS |
- ExtensionInstallChecker::CHECK_MANAGEMENT_POLICY,
- true /* fail fast */);
- install_checker_->Start(
- base::Bind(&UnpackedInstaller::OnInstallChecksComplete, this));
+ policy_check_ = base::MakeUnique<PolicyCheck>(profile_, extension_);
+ requirements_check_ = base::MakeUnique<RequirementsChecker>(extension_);
+
+ check_group_ = base::MakeUnique<PreloadCheckGroup>();
+ check_group_->set_stop_on_first_error(true);
+
+ check_group_->AddCheck(policy_check_.get());
+ check_group_->AddCheck(requirements_check_.get());
+ check_group_->Start(
+ base::BindOnce(&UnpackedInstaller::OnInstallChecksComplete, this));
}
-void UnpackedInstaller::OnInstallChecksComplete(int failed_checks) {
+void UnpackedInstaller::OnInstallChecksComplete(PreloadCheck::Errors errors) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- base::string16 error_message = install_checker_->policy_error();
- if (error_message.empty())
- error_message = install_checker_->requirements_error_message();
-
- if (!error_message.empty()) {
- ReportExtensionLoadError(base::UTF16ToUTF8(error_message));
+ if (errors.empty()) {
+ InstallExtension();
return;
}
- InstallExtension();
+ base::string16 error_message;
+ if (errors.count(PreloadCheck::DISALLOWED_BY_POLICY))
+ error_message = policy_check_->GetErrorMessage();
+ else
+ error_message = requirements_check_->GetErrorMessage();
+
+ DCHECK(!error_message.empty());
+ ReportExtensionLoadError(base::UTF16ToUTF8(error_message));
}
int UnpackedInstaller::GetFlags() {
« no previous file with comments | « chrome/browser/extensions/unpacked_installer.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698