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

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

Issue 2769813004: Revert of Simplify ExtensionInstallChecker into a single-use class (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
Index: chrome/browser/extensions/unpacked_installer.cc
diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc
index 148113f36b5a782b3695c9501369db66452e438c..02e59d907a93627825b838b1adc69d73b4863b6f 100644
--- a/chrome/browser/extensions/unpacked_installer.cc
+++ b/chrome/browser/extensions/unpacked_installer.cc
@@ -7,11 +7,9 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_util.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/string_util.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"
@@ -112,10 +110,10 @@
UnpackedInstaller::UnpackedInstaller(ExtensionService* extension_service)
: service_weak_(extension_service->AsWeakPtr()),
- profile_(extension_service->profile()),
prompt_for_plugins_(true),
require_modern_manifest_version_(true),
- be_noisy_on_failure_(true) {
+ be_noisy_on_failure_(true),
+ install_checker_(extension_service->profile()) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
@@ -151,8 +149,9 @@
}
std::string error;
- extension_ = file_util::LoadExtension(extension_path_, Manifest::COMMAND_LINE,
- GetFlags(), &error);
+ install_checker_.set_extension(
+ file_util::LoadExtension(
+ extension_path_, Manifest::COMMAND_LINE, GetFlags(), &error).get());
if (!extension() ||
!extension_l10n_util::ValidateExtensionLocales(
@@ -196,7 +195,8 @@
PluginInfo::HasPlugins(extension()) &&
!disabled_extensions.Contains(extension()->id())) {
SimpleExtensionLoadPrompt* prompt = new SimpleExtensionLoadPrompt(
- extension(), profile_,
+ extension(),
+ install_checker_.profile(),
base::Bind(&UnpackedInstaller::StartInstallChecks, this));
prompt->ShowPrompt();
return;
@@ -241,26 +241,24 @@
}
}
- install_checker_ = base::MakeUnique<ExtensionInstallChecker>(
- profile_, extension_,
+ install_checker_.Start(
ExtensionInstallChecker::CHECK_REQUIREMENTS |
ExtensionInstallChecker::CHECK_MANAGEMENT_POLICY,
- true /* fail fast */);
- install_checker_->Start(
+ true /* fail fast */,
base::Bind(&UnpackedInstaller::OnInstallChecksComplete, this));
}
void UnpackedInstaller::OnInstallChecksComplete(int failed_checks) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (!install_checker_->policy_error().empty()) {
- ReportExtensionLoadError(install_checker_->policy_error());
- return;
- }
-
- if (!install_checker_->requirement_errors().empty()) {
+ if (!install_checker_.policy_error().empty()) {
+ ReportExtensionLoadError(install_checker_.policy_error());
+ return;
+ }
+
+ if (!install_checker_.requirement_errors().empty()) {
ReportExtensionLoadError(
- base::JoinString(install_checker_->requirement_errors(), " "));
+ base::JoinString(install_checker_.requirement_errors(), " "));
return;
}
@@ -331,8 +329,9 @@
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
std::string error;
- extension_ = file_util::LoadExtension(extension_path_, Manifest::UNPACKED,
- flags, &error);
+ install_checker_.set_extension(
+ file_util::LoadExtension(
+ extension_path_, Manifest::UNPACKED, flags, &error).get());
if (!extension() ||
!extension_l10n_util::ValidateExtensionLocales(
« no previous file with comments | « chrome/browser/extensions/unpacked_installer.h ('k') | extensions/test/extension_test_notification_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698