| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 class RecoveryComponentInstaller : public ComponentInstaller { | 52 class RecoveryComponentInstaller : public ComponentInstaller { |
| 53 public: | 53 public: |
| 54 explicit RecoveryComponentInstaller(const Version& version, | 54 explicit RecoveryComponentInstaller(const Version& version, |
| 55 PrefService* prefs); | 55 PrefService* prefs); |
| 56 | 56 |
| 57 virtual ~RecoveryComponentInstaller() {} | 57 virtual ~RecoveryComponentInstaller() {} |
| 58 | 58 |
| 59 virtual void OnUpdateError(int error) OVERRIDE; | 59 virtual void OnUpdateError(int error) override; |
| 60 | 60 |
| 61 virtual bool Install(const base::DictionaryValue& manifest, | 61 virtual bool Install(const base::DictionaryValue& manifest, |
| 62 const base::FilePath& unpack_path) OVERRIDE; | 62 const base::FilePath& unpack_path) override; |
| 63 | 63 |
| 64 virtual bool GetInstalledFile(const std::string& file, | 64 virtual bool GetInstalledFile(const std::string& file, |
| 65 base::FilePath* installed_file) OVERRIDE; | 65 base::FilePath* installed_file) override; |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 Version current_version_; | 68 Version current_version_; |
| 69 PrefService* prefs_; | 69 PrefService* prefs_; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) { | 72 void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) { |
| 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 74 Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); | 74 Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); |
| 75 if (!version.IsValid()) { | 75 if (!version.IsValid()) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 base::Bind(&RecoveryRegisterHelper, cus, prefs), | 168 base::Bind(&RecoveryRegisterHelper, cus, prefs), |
| 169 base::TimeDelta::FromSeconds(6)); | 169 base::TimeDelta::FromSeconds(6)); |
| 170 #endif | 170 #endif |
| 171 } | 171 } |
| 172 | 172 |
| 173 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { | 173 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { |
| 174 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); | 174 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace component_updater | 177 } // namespace component_updater |
| OLD | NEW |