| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cld_component_installer.h" | 5 #include "chrome/browser/component_updater/cld_component_installer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Tracks the last value seen in SetLatestCldDataFile. | 31 // Tracks the last value seen in SetLatestCldDataFile. |
| 32 base::LazyInstance<base::FilePath>::Leaky g_latest_cld_data_file = | 32 base::LazyInstance<base::FilePath>::Leaky g_latest_cld_data_file = |
| 33 LAZY_INSTANCE_INITIALIZER; | 33 LAZY_INSTANCE_INITIALIZER; |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 namespace component_updater { | 36 namespace component_updater { |
| 37 | 37 |
| 38 // The SHA256 of the SubjectPublicKeyInfo used to sign the extension. | 38 // The SHA256 of the SubjectPublicKeyInfo used to sign the extension. |
| 39 // The extension id is: dpedmmgabcgnikllifiidmijgoiihfgf | 39 // The extension id is: dpedmmgabcgnikllifiidmijgoiihfgf |
| 40 const uint8 kPublicKeySHA256[32] = { | 40 const uint8_t kPublicKeySHA256[32] = { |
| 41 0x3f, 0x43, 0xcc, 0x60, 0x12, 0x6d, 0x8a, 0xbb, | 41 0x3f, 0x43, 0xcc, 0x60, 0x12, 0x6d, 0x8a, 0xbb, |
| 42 0x85, 0x88, 0x3c, 0x89, 0x6e, 0x88, 0x75, 0x65, | 42 0x85, 0x88, 0x3c, 0x89, 0x6e, 0x88, 0x75, 0x65, |
| 43 0xb9, 0x46, 0x09, 0xe8, 0xca, 0x92, 0xdd, 0x82, | 43 0xb9, 0x46, 0x09, 0xe8, 0xca, 0x92, 0xdd, 0x82, |
| 44 0x4e, 0x6d, 0x0e, 0xe6, 0x79, 0x8a, 0x87, 0xf5 | 44 0x4e, 0x6d, 0x0e, 0xe6, 0x79, 0x8a, 0x87, 0xf5 |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 const char kCldManifestName[] = "CLD2 Data"; | 47 const char kCldManifestName[] = "CLD2 Data"; |
| 48 | 48 |
| 49 CldComponentInstallerTraits::CldComponentInstallerTraits() { | 49 CldComponentInstallerTraits::CldComponentInstallerTraits() { |
| 50 } | 50 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 VLOG(1) << "Verification result: " << (result ? "valid" : "invalid"); | 89 VLOG(1) << "Verification result: " << (result ? "valid" : "invalid"); |
| 90 return result; | 90 return result; |
| 91 } | 91 } |
| 92 | 92 |
| 93 base::FilePath CldComponentInstallerTraits::GetBaseDirectory() const { | 93 base::FilePath CldComponentInstallerTraits::GetBaseDirectory() const { |
| 94 base::FilePath result; | 94 base::FilePath result; |
| 95 PathService::Get(DIR_COMPONENT_CLD2, &result); | 95 PathService::Get(DIR_COMPONENT_CLD2, &result); |
| 96 return result; | 96 return result; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void CldComponentInstallerTraits::GetHash(std::vector<uint8>* hash) const { | 99 void CldComponentInstallerTraits::GetHash(std::vector<uint8_t>* hash) const { |
| 100 hash->assign(kPublicKeySHA256, | 100 hash->assign(kPublicKeySHA256, |
| 101 kPublicKeySHA256 + arraysize(kPublicKeySHA256)); | 101 kPublicKeySHA256 + arraysize(kPublicKeySHA256)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 std::string CldComponentInstallerTraits::GetName() const { | 104 std::string CldComponentInstallerTraits::GetName() const { |
| 105 return kCldManifestName; | 105 return kCldManifestName; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void RegisterCldComponent(ComponentUpdateService* cus) { | 108 void RegisterCldComponent(ComponentUpdateService* cus) { |
| 109 // Make sure we don't start up if the CLD data source isn't compatible. | 109 // Make sure we don't start up if the CLD data source isn't compatible. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 132 VLOG(1) << "Setting CLD data file location: " << path.value(); | 132 VLOG(1) << "Setting CLD data file location: " << path.value(); |
| 133 g_latest_cld_data_file.Get() = path; | 133 g_latest_cld_data_file.Get() = path; |
| 134 translate::SetCldDataFilePath(path); | 134 translate::SetCldDataFilePath(path); |
| 135 } | 135 } |
| 136 | 136 |
| 137 base::FilePath CldComponentInstallerTraits::GetLatestCldDataFile() { | 137 base::FilePath CldComponentInstallerTraits::GetLatestCldDataFile() { |
| 138 return g_latest_cld_data_file.Get(); | 138 return g_latest_cld_data_file.Get(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace component_updater | 141 } // namespace component_updater |
| OLD | NEW |