| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/component_updater/recovery_improved_component_installer
.h" |
| 6 |
| 7 #include <iterator> |
| 8 #include <utility> |
| 9 |
| 10 #include "base/callback.h" |
| 11 |
| 12 namespace component_updater { |
| 13 |
| 14 // The SHA256 of the SubjectPublicKeyInfo used to sign the component CRX. |
| 15 // The extension id is: iddcipcljjhfegcfaaaapdilddpplalp |
| 16 constexpr uint8_t kPublicKeySHA256[32] = { |
| 17 0x97, 0xf0, 0xbe, 0xe4, 0x3f, 0x2b, 0x9e, 0xcf, 0x2c, 0x50, 0x61, |
| 18 0xdf, 0xc2, 0x6e, 0x0b, 0x4a, 0x4f, 0x1e, 0xda, 0x71, 0x29, 0x64, |
| 19 0x74, 0x70, 0x15, 0x07, 0x18, 0xb7, 0x92, 0x04, 0xcd, 0x70}; |
| 20 |
| 21 constexpr char kRecoveryImprovedManifestName[] = "Chrome Improved Recovery"; |
| 22 |
| 23 RecoveryImprovedInstallerTraits::RecoveryImprovedInstallerTraits( |
| 24 PrefService* prefs) |
| 25 : prefs_(prefs) {} |
| 26 |
| 27 RecoveryImprovedInstallerTraits::~RecoveryImprovedInstallerTraits() {} |
| 28 |
| 29 bool RecoveryImprovedInstallerTraits:: |
| 30 SupportsGroupPolicyEnabledComponentUpdates() const { |
| 31 return true; |
| 32 } |
| 33 |
| 34 bool RecoveryImprovedInstallerTraits::RequiresNetworkEncryption() const { |
| 35 return false; |
| 36 } |
| 37 |
| 38 update_client::CrxInstaller::Result |
| 39 RecoveryImprovedInstallerTraits::OnCustomInstall( |
| 40 const base::DictionaryValue& manifest, |
| 41 const base::FilePath& install_dir) { |
| 42 return update_client::CrxInstaller::Result(0); |
| 43 } |
| 44 |
| 45 void RecoveryImprovedInstallerTraits::ComponentReady( |
| 46 const base::Version& version, |
| 47 const base::FilePath& install_dir, |
| 48 std::unique_ptr<base::DictionaryValue> manifest) {} |
| 49 |
| 50 // Called during startup and installation before ComponentReady(). |
| 51 bool RecoveryImprovedInstallerTraits::VerifyInstallation( |
| 52 const base::DictionaryValue& manifest, |
| 53 const base::FilePath& install_dir) const { |
| 54 return true; |
| 55 } |
| 56 |
| 57 base::FilePath RecoveryImprovedInstallerTraits::GetRelativeInstallDir() const { |
| 58 return base::FilePath(FILE_PATH_LITERAL("RecoveryImproved")); |
| 59 } |
| 60 |
| 61 void RecoveryImprovedInstallerTraits::GetHash( |
| 62 std::vector<uint8_t>* hash) const { |
| 63 hash->assign(std::begin(kPublicKeySHA256), std::end(kPublicKeySHA256)); |
| 64 } |
| 65 |
| 66 std::string RecoveryImprovedInstallerTraits::GetName() const { |
| 67 return kRecoveryImprovedManifestName; |
| 68 } |
| 69 |
| 70 update_client::InstallerAttributes |
| 71 RecoveryImprovedInstallerTraits::GetInstallerAttributes() const { |
| 72 return update_client::InstallerAttributes(); |
| 73 } |
| 74 |
| 75 std::vector<std::string> RecoveryImprovedInstallerTraits::GetMimeTypes() const { |
| 76 return std::vector<std::string>(); |
| 77 } |
| 78 |
| 79 void RegisterRecoveryImprovedComponent(ComponentUpdateService* cus, |
| 80 PrefService* prefs) { |
| 81 DVLOG(1) << "Registering RecoveryImproved component."; |
| 82 |
| 83 std::unique_ptr<ComponentInstallerTraits> traits( |
| 84 new RecoveryImprovedInstallerTraits(prefs)); |
| 85 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 86 DefaultComponentInstaller* installer = |
| 87 new DefaultComponentInstaller(std::move(traits)); |
| 88 installer->Register(cus, base::Closure()); |
| 89 } |
| 90 |
| 91 void RegisterPrefsForRecoveryImprovedComponent(PrefRegistrySimple* registry) {} |
| 92 |
| 93 } // namespace component_updater |
| OLD | NEW |