Chromium Code Reviews| 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: | |
| 16 // TODO(sorin): needs a CRX id. | |
| 17 const uint8_t kPublicKeySHA256[32] = {0}; | |
| 18 | |
| 19 const char kRecoveryImprovedManifestName[] = "ChromeRecovery"; | |
|
waffles
2017/01/31 21:34:40
A glance at chrome://components indicates most com
| |
| 20 | |
| 21 RecoveryImprovedInstallerTraits::RecoveryImprovedInstallerTraits( | |
| 22 PrefService* prefs) | |
| 23 : prefs_(prefs) {} | |
| 24 | |
| 25 RecoveryImprovedInstallerTraits::~RecoveryImprovedInstallerTraits() {} | |
| 26 | |
| 27 bool RecoveryImprovedInstallerTraits:: | |
| 28 SupportsGroupPolicyEnabledComponentUpdates() const { | |
| 29 return true; | |
| 30 } | |
| 31 | |
| 32 bool RecoveryImprovedInstallerTraits::RequiresNetworkEncryption() const { | |
| 33 return false; | |
| 34 } | |
| 35 | |
| 36 update_client::CrxInstaller::Result | |
| 37 RecoveryImprovedInstallerTraits::OnCustomInstall( | |
| 38 const base::DictionaryValue& manifest, | |
| 39 const base::FilePath& install_dir) { | |
| 40 return update_client::CrxInstaller::Result(0); | |
| 41 } | |
| 42 | |
| 43 void RecoveryImprovedInstallerTraits::ComponentReady( | |
| 44 const base::Version& version, | |
| 45 const base::FilePath& install_dir, | |
| 46 std::unique_ptr<base::DictionaryValue> manifest) {} | |
| 47 | |
| 48 // Called during startup and installation before ComponentReady(). | |
| 49 bool RecoveryImprovedInstallerTraits::VerifyInstallation( | |
| 50 const base::DictionaryValue& manifest, | |
| 51 const base::FilePath& install_dir) const { | |
| 52 return true; | |
| 53 } | |
| 54 | |
| 55 base::FilePath RecoveryImprovedInstallerTraits::GetRelativeInstallDir() const { | |
| 56 return base::FilePath(FILE_PATH_LITERAL("RecoveryImproved")); | |
| 57 } | |
| 58 | |
| 59 void RecoveryImprovedInstallerTraits::GetHash( | |
| 60 std::vector<uint8_t>* hash) const { | |
| 61 hash->assign(std::begin(kPublicKeySHA256), std::end(kPublicKeySHA256)); | |
| 62 } | |
| 63 | |
| 64 std::string RecoveryImprovedInstallerTraits::GetName() const { | |
| 65 return kRecoveryImprovedManifestName; | |
| 66 } | |
| 67 | |
| 68 update_client::InstallerAttributes | |
| 69 RecoveryImprovedInstallerTraits::GetInstallerAttributes() const { | |
| 70 return update_client::InstallerAttributes(); | |
| 71 } | |
| 72 | |
| 73 std::vector<std::string> RecoveryImprovedInstallerTraits::GetMimeTypes() const { | |
| 74 return std::vector<std::string>(); | |
| 75 } | |
| 76 | |
| 77 void RegisterRecoveryImprovedComponent(ComponentUpdateService* cus, | |
| 78 PrefService* prefs) { | |
| 79 DVLOG(1) << "Registering RecoveryImproved component."; | |
| 80 | |
| 81 std::unique_ptr<ComponentInstallerTraits> traits( | |
| 82 new RecoveryImprovedInstallerTraits(prefs)); | |
| 83 // |cus| will take ownership of |installer| during installer->Register(cus). | |
| 84 DefaultComponentInstaller* installer = | |
| 85 new DefaultComponentInstaller(std::move(traits)); | |
| 86 installer->Register(cus, base::Closure()); | |
| 87 } | |
| 88 | |
| 89 void RegisterPrefsForRecoveryImprovedComponent(PrefRegistrySimple* registry) {} | |
| 90 | |
| 91 } // namespace component_updater | |
| OLD | NEW |