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 <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // We can't really do much to verify the CLD2 data file. In theory we could | 91 // We can't really do much to verify the CLD2 data file. In theory we could |
92 // read the headers, but that won't do much other than tell us whether or | 92 // read the headers, but that won't do much other than tell us whether or |
93 // not the headers are valid. So just check if the file exists. | 93 // not the headers are valid. So just check if the file exists. |
94 const base::FilePath expected_file = GetInstalledPath(install_dir); | 94 const base::FilePath expected_file = GetInstalledPath(install_dir); |
95 VLOG(1) << "Verifying install: " << expected_file.value(); | 95 VLOG(1) << "Verifying install: " << expected_file.value(); |
96 const bool result = base::PathExists(expected_file); | 96 const bool result = base::PathExists(expected_file); |
97 VLOG(1) << "Verification result: " << (result ? "valid" : "invalid"); | 97 VLOG(1) << "Verification result: " << (result ? "valid" : "invalid"); |
98 return result; | 98 return result; |
99 } | 99 } |
100 | 100 |
101 base::FilePath CldComponentInstallerTraits::GetBaseDirectory() const { | 101 base::FilePath CldComponentInstallerTraits::GetRelativeInstallDir() const { |
102 base::FilePath result; | 102 return base::FilePath(FILE_PATH_LITERAL("CLD")); |
103 PathService::Get(DIR_COMPONENT_CLD2, &result); | |
104 return result; | |
105 } | 103 } |
106 | 104 |
107 void CldComponentInstallerTraits::GetHash(std::vector<uint8_t>* hash) const { | 105 void CldComponentInstallerTraits::GetHash(std::vector<uint8_t>* hash) const { |
108 hash->assign(kPublicKeySHA256, | 106 hash->assign(kPublicKeySHA256, |
109 kPublicKeySHA256 + arraysize(kPublicKeySHA256)); | 107 kPublicKeySHA256 + arraysize(kPublicKeySHA256)); |
110 } | 108 } |
111 | 109 |
112 std::string CldComponentInstallerTraits::GetName() const { | 110 std::string CldComponentInstallerTraits::GetName() const { |
113 return kCldManifestName; | 111 return kCldManifestName; |
114 } | 112 } |
(...skipping 27 matching lines...) Expand all Loading... |
142 VLOG(1) << "Setting CLD data file location: " << path.value(); | 140 VLOG(1) << "Setting CLD data file location: " << path.value(); |
143 g_latest_cld_data_file.Get() = path; | 141 g_latest_cld_data_file.Get() = path; |
144 translate::CldDataSource::Get()->SetCldDataFilePath(path); | 142 translate::CldDataSource::Get()->SetCldDataFilePath(path); |
145 } | 143 } |
146 | 144 |
147 base::FilePath CldComponentInstallerTraits::GetLatestCldDataFile() { | 145 base::FilePath CldComponentInstallerTraits::GetLatestCldDataFile() { |
148 return g_latest_cld_data_file.Get(); | 146 return g_latest_cld_data_file.Get(); |
149 } | 147 } |
150 | 148 |
151 } // namespace component_updater | 149 } // namespace component_updater |
OLD | NEW |