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/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 sequence_of_loaded_crl))) { | 67 sequence_of_loaded_crl))) { |
68 NOTREACHED(); | 68 NOTREACHED(); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 void CRLSetFetcher::LoadFromDisk(base::FilePath path, | 72 void CRLSetFetcher::LoadFromDisk(base::FilePath path, |
73 scoped_refptr<net::CRLSet>* out_crl_set) { | 73 scoped_refptr<net::CRLSet>* out_crl_set) { |
74 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 74 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
75 | 75 |
76 std::string crl_set_bytes; | 76 std::string crl_set_bytes; |
77 if (!file_util::ReadFileToString(path, &crl_set_bytes)) | 77 if (!base::ReadFileToString(path, &crl_set_bytes)) |
78 return; | 78 return; |
79 | 79 |
80 if (!net::CRLSet::Parse(crl_set_bytes, out_crl_set)) { | 80 if (!net::CRLSet::Parse(crl_set_bytes, out_crl_set)) { |
81 LOG(WARNING) << "Failed to parse CRL set from " << path.MaybeAsASCII(); | 81 LOG(WARNING) << "Failed to parse CRL set from " << path.MaybeAsASCII(); |
82 return; | 82 return; |
83 } | 83 } |
84 | 84 |
85 VLOG(1) << "Loaded " << crl_set_bytes.size() << " bytes of CRL set from disk"; | 85 VLOG(1) << "Loaded " << crl_set_bytes.size() << " bytes of CRL set from disk"; |
86 | 86 |
87 if (!BrowserThread::PostTask( | 87 if (!BrowserThread::PostTask( |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 const base::FilePath& unpack_path) { | 146 const base::FilePath& unpack_path) { |
147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
148 | 148 |
149 base::FilePath crl_set_file_path = | 149 base::FilePath crl_set_file_path = |
150 unpack_path.Append(FILE_PATH_LITERAL("crl-set")); | 150 unpack_path.Append(FILE_PATH_LITERAL("crl-set")); |
151 base::FilePath save_to; | 151 base::FilePath save_to; |
152 if (!GetCRLSetFilePath(&save_to)) | 152 if (!GetCRLSetFilePath(&save_to)) |
153 return true; | 153 return true; |
154 | 154 |
155 std::string crl_set_bytes; | 155 std::string crl_set_bytes; |
156 if (!file_util::ReadFileToString(crl_set_file_path, &crl_set_bytes)) { | 156 if (!base::ReadFileToString(crl_set_file_path, &crl_set_bytes)) { |
157 LOG(WARNING) << "Failed to find crl-set file inside CRX"; | 157 LOG(WARNING) << "Failed to find crl-set file inside CRX"; |
158 return false; | 158 return false; |
159 } | 159 } |
160 | 160 |
161 bool is_delta; | 161 bool is_delta; |
162 if (!net::CRLSet::GetIsDeltaUpdate(crl_set_bytes, &is_delta)) { | 162 if (!net::CRLSet::GetIsDeltaUpdate(crl_set_bytes, &is_delta)) { |
163 LOG(WARNING) << "GetIsDeltaUpdate failed on CRL set from update CRX"; | 163 LOG(WARNING) << "GetIsDeltaUpdate failed on CRL set from update CRX"; |
164 return false; | 164 return false; |
165 } | 165 } |
166 | 166 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 return true; | 205 return true; |
206 } | 206 } |
207 | 207 |
208 bool CRLSetFetcher::GetInstalledFile( | 208 bool CRLSetFetcher::GetInstalledFile( |
209 const std::string& file, base::FilePath* installed_file) { | 209 const std::string& file, base::FilePath* installed_file) { |
210 return false; | 210 return false; |
211 } | 211 } |
212 | 212 |
213 CRLSetFetcher::~CRLSetFetcher() {} | 213 CRLSetFetcher::~CRLSetFetcher() {} |
OLD | NEW |