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