| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net/crl_set_fetcher.h" | 5 #include "chrome/browser/net/crl_set_fetcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | |
| 9 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 10 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 11 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| 12 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 14 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 18 #include "components/component_updater/component_updater_service.h" | 17 #include "components/component_updater/component_updater_service.h" |
| 19 #include "components/update_client/update_client.h" | 18 #include "components/update_client/update_client.h" |
| 20 #include "components/update_client/utils.h" | |
| 21 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_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 using content::BrowserThread; | 25 using content::BrowserThread; |
| 28 | 26 |
| 29 CRLSetFetcher::CRLSetFetcher() : cus_(NULL) {} | 27 CRLSetFetcher::CRLSetFetcher() : cus_(NULL) {} |
| 30 | 28 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 160 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 163 | 161 |
| 164 DeleteFile(GetCRLSetFilePath(), false /* not recursive */); | 162 DeleteFile(GetCRLSetFilePath(), false /* not recursive */); |
| 165 } | 163 } |
| 166 | 164 |
| 167 void CRLSetFetcher::OnUpdateError(int error) { | 165 void CRLSetFetcher::OnUpdateError(int error) { |
| 168 LOG(WARNING) << "CRLSetFetcher got error " << error | 166 LOG(WARNING) << "CRLSetFetcher got error " << error |
| 169 << " from component installer"; | 167 << " from component installer"; |
| 170 } | 168 } |
| 171 | 169 |
| 172 update_client::CrxInstaller::Result CRLSetFetcher::Install( | 170 bool CRLSetFetcher::Install(const base::DictionaryValue& manifest, |
| 173 const base::DictionaryValue& manifest, | 171 const base::FilePath& unpack_path) { |
| 174 const base::FilePath& unpack_path) { | |
| 175 return update_client::InstallFunctionWrapper( | |
| 176 base::Bind(&CRLSetFetcher::DoInstall, base::Unretained(this), | |
| 177 base::ConstRef(manifest), base::ConstRef(unpack_path))); | |
| 178 } | |
| 179 | |
| 180 bool CRLSetFetcher::DoInstall(const base::DictionaryValue& manifest, | |
| 181 const base::FilePath& unpack_path) { | |
| 182 base::FilePath crl_set_file_path = | 172 base::FilePath crl_set_file_path = |
| 183 unpack_path.Append(FILE_PATH_LITERAL("crl-set")); | 173 unpack_path.Append(FILE_PATH_LITERAL("crl-set")); |
| 184 base::FilePath save_to = GetCRLSetFilePath(); | 174 base::FilePath save_to = GetCRLSetFilePath(); |
| 185 | 175 |
| 186 std::string crl_set_bytes; | 176 std::string crl_set_bytes; |
| 187 if (!base::ReadFileToString(crl_set_file_path, &crl_set_bytes)) { | 177 if (!base::ReadFileToString(crl_set_file_path, &crl_set_bytes)) { |
| 188 LOG(WARNING) << "Failed to find crl-set file inside CRX"; | 178 LOG(WARNING) << "Failed to find crl-set file inside CRX"; |
| 189 return false; | 179 return false; |
| 190 } | 180 } |
| 191 | 181 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 bool CRLSetFetcher::GetInstalledFile( | 238 bool CRLSetFetcher::GetInstalledFile( |
| 249 const std::string& file, base::FilePath* installed_file) { | 239 const std::string& file, base::FilePath* installed_file) { |
| 250 return false; | 240 return false; |
| 251 } | 241 } |
| 252 | 242 |
| 253 bool CRLSetFetcher::Uninstall() { | 243 bool CRLSetFetcher::Uninstall() { |
| 254 return false; | 244 return false; |
| 255 } | 245 } |
| 256 | 246 |
| 257 CRLSetFetcher::~CRLSetFetcher() {} | 247 CRLSetFetcher::~CRLSetFetcher() {} |
| OLD | NEW |