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