| Index: chrome/browser/component_updater/recovery_component_installer.cc
|
| diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc
|
| index 4baa3666db5b1d6e3a8e2e4ab269c5ae4fb8d7f7..6437cb89d2c7969e8b66389709dd6d1cc9355d67 100644
|
| --- a/chrome/browser/component_updater/recovery_component_installer.cc
|
| +++ b/chrome/browser/component_updater/recovery_component_installer.cc
|
| @@ -20,9 +20,7 @@
|
| #include "base/strings/string_util.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/component_updater/component_updater_service.h"
|
| -#include "chrome/common/chrome_paths.h"
|
| -#include "chrome/common/chrome_version_info.h"
|
| -#include "chrome/common/pref_names.h"
|
| +#include "components/component_updater/common/pref_names.h"
|
| #include "content/public/browser/browser_thread.h"
|
|
|
| using content::BrowserThread;
|
| @@ -52,7 +50,8 @@ const char kRecoveryManifestName[] = "ChromeRecovery";
|
| class RecoveryComponentInstaller : public ComponentInstaller {
|
| public:
|
| explicit RecoveryComponentInstaller(const Version& version,
|
| - PrefService* prefs);
|
| + PrefService* prefs,
|
| + const base::FilePath& base_dir);
|
|
|
| virtual ~RecoveryComponentInstaller() {}
|
|
|
| @@ -67,9 +66,12 @@ class RecoveryComponentInstaller : public ComponentInstaller {
|
| private:
|
| Version current_version_;
|
| PrefService* prefs_;
|
| + base::FilePath base_dir_;
|
| };
|
|
|
| -void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) {
|
| +void RecoveryRegisterHelper(ComponentUpdateService* cus,
|
| + PrefService* prefs,
|
| + const base::FilePath& base_dir) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| Version version(prefs->GetString(prefs::kRecoveryComponentVersion));
|
| if (!version.IsValid()) {
|
| @@ -79,7 +81,7 @@ void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) {
|
|
|
| CrxComponent recovery;
|
| recovery.name = "recovery";
|
| - recovery.installer = new RecoveryComponentInstaller(version, prefs);
|
| + recovery.installer = new RecoveryComponentInstaller(version, prefs, base_dir);
|
| recovery.version = version;
|
| recovery.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]);
|
| if (cus->RegisterComponent(recovery) != ComponentUpdateService::kOk) {
|
| @@ -92,9 +94,11 @@ void RecoveryUpdateVersionHelper(const Version& version, PrefService* prefs) {
|
| prefs->SetString(prefs::kRecoveryComponentVersion, version.GetString());
|
| }
|
|
|
| -RecoveryComponentInstaller::RecoveryComponentInstaller(const Version& version,
|
| - PrefService* prefs)
|
| - : current_version_(version), prefs_(prefs) {
|
| +RecoveryComponentInstaller::RecoveryComponentInstaller(
|
| + const Version& version,
|
| + PrefService* prefs,
|
| + const base::FilePath& base_dir)
|
| + : current_version_(version), prefs_(prefs), base_dir_(base_dir) {
|
| DCHECK(version.IsValid());
|
| }
|
|
|
| @@ -117,10 +121,7 @@ bool RecoveryComponentInstaller::Install(const base::DictionaryValue& manifest,
|
| return false;
|
|
|
| // Passed the basic tests. Copy the installation to a permanent directory.
|
| - base::FilePath path;
|
| - if (!PathService::Get(chrome::DIR_RECOVERY_BASE, &path))
|
| - return false;
|
| - path = path.AppendASCII(version.GetString());
|
| + base::FilePath path = base_dir_.AppendASCII(version.GetString());
|
| if (base::PathExists(path) && !base::DeleteFile(path, true))
|
| return false;
|
| if (!base::Move(unpack_path, path)) {
|
| @@ -158,14 +159,15 @@ bool RecoveryComponentInstaller::GetInstalledFile(
|
| }
|
|
|
| void RegisterRecoveryComponent(ComponentUpdateService* cus,
|
| - PrefService* prefs) {
|
| + PrefService* prefs,
|
| + const base::FilePath& base_dir) {
|
| #if !defined(OS_CHROMEOS)
|
| // We delay execute the registration because we are not required in
|
| // the critical path during browser startup.
|
| BrowserThread::PostDelayedTask(
|
| BrowserThread::UI,
|
| FROM_HERE,
|
| - base::Bind(&RecoveryRegisterHelper, cus, prefs),
|
| + base::Bind(&RecoveryRegisterHelper, cus, prefs, base_dir),
|
| base::TimeDelta::FromSeconds(6));
|
| #endif
|
| }
|
|
|