| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/net/crl_set_fetcher.h" | 5 #include "ios/chrome/browser/net/crl_set_fetcher.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" |
| 10 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 11 #include "base/numerics/safe_conversions.h" | 12 #include "base/numerics/safe_conversions.h" |
| 12 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 15 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 16 #include "components/component_updater/component_updater_service.h" | 17 #include "components/component_updater/component_updater_service.h" |
| 17 #include "components/update_client/update_client.h" | 18 #include "components/update_client/update_client.h" |
| 19 #include "components/update_client/utils.h" |
| 18 #include "ios/chrome/browser/chrome_constants.h" | 20 #include "ios/chrome/browser/chrome_constants.h" |
| 19 #include "ios/web/public/web_thread.h" | 21 #include "ios/web/public/web_thread.h" |
| 20 #include "net/cert/crl_set.h" | 22 #include "net/cert/crl_set.h" |
| 21 #include "net/cert/crl_set_storage.h" | 23 #include "net/cert/crl_set_storage.h" |
| 22 #include "net/ssl/ssl_config_service.h" | 24 #include "net/ssl/ssl_config_service.h" |
| 23 | 25 |
| 24 using component_updater::ComponentUpdateService; | 26 using component_updater::ComponentUpdateService; |
| 25 | 27 |
| 26 CRLSetFetcher::CRLSetFetcher() : cus_(nullptr) {} | 28 CRLSetFetcher::CRLSetFetcher() : cus_(nullptr) {} |
| 27 | 29 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 DCHECK_CURRENTLY_ON(web::WebThread::FILE); | 153 DCHECK_CURRENTLY_ON(web::WebThread::FILE); |
| 152 | 154 |
| 153 DeleteFile(GetCRLSetFilePath(), false /* not recursive */); | 155 DeleteFile(GetCRLSetFilePath(), false /* not recursive */); |
| 154 } | 156 } |
| 155 | 157 |
| 156 void CRLSetFetcher::OnUpdateError(int error) { | 158 void CRLSetFetcher::OnUpdateError(int error) { |
| 157 LOG(WARNING) << "CRLSetFetcher got error " << error | 159 LOG(WARNING) << "CRLSetFetcher got error " << error |
| 158 << " from component installer"; | 160 << " from component installer"; |
| 159 } | 161 } |
| 160 | 162 |
| 161 bool CRLSetFetcher::Install(const base::DictionaryValue& manifest, | 163 update_client::CrxInstaller::Result CRLSetFetcher::Install( |
| 162 const base::FilePath& unpack_path) { | 164 const base::DictionaryValue& manifest, |
| 165 const base::FilePath& unpack_path) { |
| 166 return update_client::InstallFunctionWrapper( |
| 167 base::Bind(&CRLSetFetcher::DoInstall, base::Unretained(this), |
| 168 base::ConstRef(manifest), base::ConstRef(unpack_path))); |
| 169 } |
| 170 |
| 171 bool CRLSetFetcher::DoInstall(const base::DictionaryValue& manifest, |
| 172 const base::FilePath& unpack_path) { |
| 163 base::FilePath crl_set_file_path = | 173 base::FilePath crl_set_file_path = |
| 164 unpack_path.Append(FILE_PATH_LITERAL("crl-set")); | 174 unpack_path.Append(FILE_PATH_LITERAL("crl-set")); |
| 165 base::FilePath save_to = GetCRLSetFilePath(); | 175 base::FilePath save_to = GetCRLSetFilePath(); |
| 166 | 176 |
| 167 std::string crl_set_bytes; | 177 std::string crl_set_bytes; |
| 168 if (!base::ReadFileToString(crl_set_file_path, &crl_set_bytes)) { | 178 if (!base::ReadFileToString(crl_set_file_path, &crl_set_bytes)) { |
| 169 LOG(WARNING) << "Failed to find crl-set file inside CRX"; | 179 LOG(WARNING) << "Failed to find crl-set file inside CRX"; |
| 170 return false; | 180 return false; |
| 171 } | 181 } |
| 172 | 182 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 bool CRLSetFetcher::GetInstalledFile(const std::string& file, | 238 bool CRLSetFetcher::GetInstalledFile(const std::string& file, |
| 229 base::FilePath* installed_file) { | 239 base::FilePath* installed_file) { |
| 230 return false; | 240 return false; |
| 231 } | 241 } |
| 232 | 242 |
| 233 bool CRLSetFetcher::Uninstall() { | 243 bool CRLSetFetcher::Uninstall() { |
| 234 return false; | 244 return false; |
| 235 } | 245 } |
| 236 | 246 |
| 237 CRLSetFetcher::~CRLSetFetcher() {} | 247 CRLSetFetcher::~CRLSetFetcher() {} |
| OLD | NEW |