Chromium Code Reviews| Index: chrome/browser/io_thread.cc |
| diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc |
| index 314f9657909acd4e2339faa1387b7a7aab7f92ce..94f0a92e150a61171850bd8cb88566c7306d99df 100644 |
| --- a/chrome/browser/io_thread.cc |
| +++ b/chrome/browser/io_thread.cc |
| @@ -562,19 +562,31 @@ void IOThread::InitAsync() { |
| if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { |
| std::string switch_value = command_line.GetSwitchValueASCII( |
| switches::kCertificateTransparencyLog); |
| - size_t delim_pos = switch_value.find(":"); |
| - CHECK(delim_pos != std::string::npos) |
| + size_t log_delim_pos = switch_value.find(";"); |
|
Lei Zhang
2014/01/27 19:46:06
Would it be slightly easier / readable to do this
Eran M. (Google)
2014/01/28 09:13:02
Done.
|
| + while (!switch_value.empty()) { |
| + std::string curr_log = switch_value.substr(0, log_delim_pos); |
| + size_t delim_pos = curr_log.find(":"); |
| + CHECK(delim_pos != std::string::npos) |
| << "CT log description not provided (switch format" |
| - " is 'description:base64_key')"; |
| - std::string log_description(switch_value.substr(0, delim_pos)); |
| - std::string ct_public_key_data; |
| - CHECK(base::Base64Decode( |
| - switch_value.substr(delim_pos + 1), |
| - &ct_public_key_data)) << "Unable to decode CT public key."; |
| - scoped_ptr<net::CTLogVerifier> external_log_verifier( |
| - net::CTLogVerifier::Create(ct_public_key_data, log_description)); |
| - CHECK(external_log_verifier) << "Unable to parse CT public key."; |
| - ct_verifier->AddLog(external_log_verifier.Pass()); |
| + " is 'description:base64_key')"; |
| + std::string log_description(curr_log.substr(0, delim_pos)); |
| + std::string ct_public_key_data; |
| + CHECK(base::Base64Decode( |
| + curr_log.substr(delim_pos + 1), |
| + &ct_public_key_data)) << "Unable to decode CT public key."; |
| + scoped_ptr<net::CTLogVerifier> external_log_verifier( |
| + net::CTLogVerifier::Create(ct_public_key_data, log_description)); |
| + CHECK(external_log_verifier) << "Unable to parse CT public key."; |
| + VLOG(1) << "Adding log with description " << log_description; |
| + ct_verifier->AddLog(external_log_verifier.Pass()); |
| + |
| + if (log_delim_pos == std::string::npos) { |
| + switch_value = ""; |
| + } else { |
| + switch_value = switch_value.substr(log_delim_pos + 1); |
| + } |
| + log_delim_pos = switch_value.find(";"); |
| + } |
| } |
| #else |
| if (command_line.HasSwitch(switches::kCertificateTransparencyLog)) { |