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 <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // mechanism. | 169 // mechanism. |
170 // For user Chrome, recovery component just installs silently. For machine | 170 // For user Chrome, recovery component just installs silently. For machine |
171 // Chrome, elevation may be needed. If that happens, the installer will set | 171 // Chrome, elevation may be needed. If that happens, the installer will set |
172 // preference flag prefs::kRecoveryComponentNeedsElevation to request that. | 172 // preference flag prefs::kRecoveryComponentNeedsElevation to request that. |
173 // There is a global error service monitors this flag and will pop up | 173 // There is a global error service monitors this flag and will pop up |
174 // bubble if the flag is set to true. | 174 // bubble if the flag is set to true. |
175 // See chrome/browser/recovery/recovery_install_global_error.cc for details. | 175 // See chrome/browser/recovery/recovery_install_global_error.cc for details. |
176 class RecoveryComponentInstaller : public update_client::ComponentInstaller { | 176 class RecoveryComponentInstaller : public update_client::ComponentInstaller { |
177 public: | 177 public: |
178 RecoveryComponentInstaller(const Version& version, PrefService* prefs); | 178 RecoveryComponentInstaller(const Version& version, PrefService* prefs); |
179 ~RecoveryComponentInstaller() override {} | |
180 | 179 |
| 180 // ComponentInstaller implementation: |
181 void OnUpdateError(int error) override; | 181 void OnUpdateError(int error) override; |
182 | 182 |
183 bool Install(const base::DictionaryValue& manifest, | 183 bool Install(const base::DictionaryValue& manifest, |
184 const base::FilePath& unpack_path) override; | 184 const base::FilePath& unpack_path) override; |
185 | 185 |
186 bool GetInstalledFile(const std::string& file, | 186 bool GetInstalledFile(const std::string& file, |
187 base::FilePath* installed_file) override; | 187 base::FilePath* installed_file) override; |
188 | 188 |
189 private: | 189 private: |
| 190 ~RecoveryComponentInstaller() override {} |
| 191 |
190 bool RunInstallCommand(const base::CommandLine& cmdline, | 192 bool RunInstallCommand(const base::CommandLine& cmdline, |
191 const base::FilePath& installer_folder) const; | 193 const base::FilePath& installer_folder) const; |
192 | 194 |
193 Version current_version_; | 195 Version current_version_; |
194 PrefService* prefs_; | 196 PrefService* prefs_; |
195 }; | 197 }; |
196 | 198 |
197 void SimulateElevatedRecoveryHelper(PrefService* prefs) { | 199 void SimulateElevatedRecoveryHelper(PrefService* prefs) { |
198 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, true); | 200 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, true); |
199 } | 201 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 #endif // OS_WIN | 396 #endif // OS_WIN |
395 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); | 397 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); |
396 } | 398 } |
397 | 399 |
398 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { | 400 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { |
399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 401 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
400 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); | 402 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); |
401 } | 403 } |
402 | 404 |
403 } // namespace component_updater | 405 } // namespace component_updater |
OLD | NEW |