| 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 "net/http/transport_security_persister.h" | 5 #include "net/http/transport_security_persister.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 | 165 |
| 166 if (now < domain_state.pkp.expiry) { | 166 if (now < domain_state.pkp.expiry) { |
| 167 serialized->Set(kDynamicSPKIHashes, | 167 serialized->Set(kDynamicSPKIHashes, |
| 168 SPKIHashesToListValue(domain_state.pkp.spki_hashes)); | 168 SPKIHashesToListValue(domain_state.pkp.spki_hashes)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 toplevel.Set(HashedDomainToExternalString(hostname), serialized); | 171 toplevel.Set(HashedDomainToExternalString(hostname), serialized); |
| 172 } | 172 } |
| 173 | 173 |
| 174 base::JSONWriter::WriteWithOptions(&toplevel, | 174 base::JSONWriter::WriteWithOptions( |
| 175 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 175 toplevel, base::JSONWriter::OPTIONS_PRETTY_PRINT, output); |
| 176 output); | |
| 177 return true; | 176 return true; |
| 178 } | 177 } |
| 179 | 178 |
| 180 bool TransportSecurityPersister::LoadEntries(const std::string& serialized, | 179 bool TransportSecurityPersister::LoadEntries(const std::string& serialized, |
| 181 bool* dirty) { | 180 bool* dirty) { |
| 182 DCHECK(foreground_runner_->RunsTasksOnCurrentThread()); | 181 DCHECK(foreground_runner_->RunsTasksOnCurrentThread()); |
| 183 | 182 |
| 184 transport_security_state_->ClearDynamicData(); | 183 transport_security_state_->ClearDynamicData(); |
| 185 return Deserialize(serialized, dirty, transport_security_state_); | 184 return Deserialize(serialized, dirty, transport_security_state_); |
| 186 } | 185 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 bool dirty = false; | 311 bool dirty = false; |
| 313 if (!LoadEntries(state, &dirty)) { | 312 if (!LoadEntries(state, &dirty)) { |
| 314 LOG(ERROR) << "Failed to deserialize state: " << state; | 313 LOG(ERROR) << "Failed to deserialize state: " << state; |
| 315 return; | 314 return; |
| 316 } | 315 } |
| 317 if (dirty) | 316 if (dirty) |
| 318 StateIsDirty(transport_security_state_); | 317 StateIsDirty(transport_security_state_); |
| 319 } | 318 } |
| 320 | 319 |
| 321 } // namespace net | 320 } // namespace net |
| OLD | NEW |