| 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/component_updater/recovery_component_installer.h" | 5 #include "chrome/browser/component_updater/recovery_component_installer.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 explicit RecoveryComponentInstaller(const Version& version, | 49 explicit RecoveryComponentInstaller(const Version& version, |
| 50 PrefService* prefs); | 50 PrefService* prefs); |
| 51 | 51 |
| 52 virtual ~RecoveryComponentInstaller() {} | 52 virtual ~RecoveryComponentInstaller() {} |
| 53 | 53 |
| 54 virtual void OnUpdateError(int error) OVERRIDE; | 54 virtual void OnUpdateError(int error) OVERRIDE; |
| 55 | 55 |
| 56 virtual bool Install(const base::DictionaryValue& manifest, | 56 virtual bool Install(const base::DictionaryValue& manifest, |
| 57 const base::FilePath& unpack_path) OVERRIDE; | 57 const base::FilePath& unpack_path) OVERRIDE; |
| 58 | 58 |
| 59 virtual bool GetInstalledFile(const std::string& file, | |
| 60 base::FilePath* installed_file) OVERRIDE; | |
| 61 | |
| 62 private: | 59 private: |
| 63 Version current_version_; | 60 Version current_version_; |
| 64 PrefService* prefs_; | 61 PrefService* prefs_; |
| 65 }; | 62 }; |
| 66 | 63 |
| 67 void RecoveryRegisterHelper(ComponentUpdateService* cus, | 64 void RecoveryRegisterHelper(ComponentUpdateService* cus, |
| 68 PrefService* prefs) { | 65 PrefService* prefs) { |
| 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 70 Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); | 67 Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); |
| 71 if (!version.IsValid()) { | 68 if (!version.IsValid()) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 cmdline.AppendSwitchASCII("version", current_version_.GetString()); | 123 cmdline.AppendSwitchASCII("version", current_version_.GetString()); |
| 127 } | 124 } |
| 128 current_version_ = version; | 125 current_version_ = version; |
| 129 if (prefs_) { | 126 if (prefs_) { |
| 130 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 127 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 131 base::Bind(&RecoveryUpdateVersionHelper, version, prefs_)); | 128 base::Bind(&RecoveryUpdateVersionHelper, version, prefs_)); |
| 132 } | 129 } |
| 133 return base::LaunchProcess(cmdline, base::LaunchOptions(), NULL); | 130 return base::LaunchProcess(cmdline, base::LaunchOptions(), NULL); |
| 134 } | 131 } |
| 135 | 132 |
| 136 bool RecoveryComponentInstaller::GetInstalledFile( | |
| 137 const std::string& file, base::FilePath* installed_file) { | |
| 138 return false; | |
| 139 } | |
| 140 | |
| 141 void RegisterRecoveryComponent(ComponentUpdateService* cus, | 133 void RegisterRecoveryComponent(ComponentUpdateService* cus, |
| 142 PrefService* prefs) { | 134 PrefService* prefs) { |
| 143 #if !defined(OS_CHROMEOS) | 135 #if !defined(OS_CHROMEOS) |
| 144 // We delay execute the registration because we are not required in | 136 // We delay execute the registration because we are not required in |
| 145 // the critical path during browser startup. | 137 // the critical path during browser startup. |
| 146 BrowserThread::PostDelayedTask( | 138 BrowserThread::PostDelayedTask( |
| 147 BrowserThread::UI, | 139 BrowserThread::UI, |
| 148 FROM_HERE, | 140 FROM_HERE, |
| 149 base::Bind(&RecoveryRegisterHelper, cus, prefs), | 141 base::Bind(&RecoveryRegisterHelper, cus, prefs), |
| 150 base::TimeDelta::FromSeconds(6)); | 142 base::TimeDelta::FromSeconds(6)); |
| 151 #endif | 143 #endif |
| 152 } | 144 } |
| 153 | 145 |
| 154 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { | 146 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { |
| 155 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); | 147 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); |
| 156 } | 148 } |
| OLD | NEW |