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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/feature_list.h" | 12 #include "base/feature_list.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/json/json_reader.h" | 15 #include "base/json/json_reader.h" |
16 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
17 #include "base/location.h" | 17 #include "base/location.h" |
| 18 #include "base/memory/ptr_util.h" |
18 #include "base/sequenced_task_runner.h" | 19 #include "base/sequenced_task_runner.h" |
19 #include "base/task_runner_util.h" | 20 #include "base/task_runner_util.h" |
20 #include "base/threading/thread_task_runner_handle.h" | 21 #include "base/threading/thread_task_runner_handle.h" |
21 #include "base/values.h" | 22 #include "base/values.h" |
22 #include "crypto/sha2.h" | 23 #include "crypto/sha2.h" |
23 #include "net/cert/x509_certificate.h" | 24 #include "net/cert/x509_certificate.h" |
24 #include "net/http/transport_security_state.h" | 25 #include "net/http/transport_security_state.h" |
25 | 26 |
26 namespace net { | 27 namespace net { |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 base::ListValue* SPKIHashesToListValue(const HashValueVector& hashes) { | 31 std::unique_ptr<base::ListValue> SPKIHashesToListValue( |
31 base::ListValue* pins = new base::ListValue; | 32 const HashValueVector& hashes) { |
| 33 auto pins = base::MakeUnique<base::ListValue>(); |
32 for (size_t i = 0; i != hashes.size(); i++) | 34 for (size_t i = 0; i != hashes.size(); i++) |
33 pins->AppendString(hashes[i].ToString()); | 35 pins->AppendString(hashes[i].ToString()); |
34 return pins; | 36 return pins; |
35 } | 37 } |
36 | 38 |
37 void SPKIHashesFromListValue(const base::ListValue& pins, | 39 void SPKIHashesFromListValue(const base::ListValue& pins, |
38 HashValueVector* hashes) { | 40 HashValueVector* hashes) { |
39 size_t num_pins = pins.GetSize(); | 41 size_t num_pins = pins.GetSize(); |
40 for (size_t i = 0; i < num_pins; ++i) { | 42 for (size_t i = 0; i < num_pins; ++i) { |
41 std::string type_and_base64; | 43 std::string type_and_base64; |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 bool dirty = false; | 501 bool dirty = false; |
500 if (!LoadEntries(state, &dirty)) { | 502 if (!LoadEntries(state, &dirty)) { |
501 LOG(ERROR) << "Failed to deserialize state: " << state; | 503 LOG(ERROR) << "Failed to deserialize state: " << state; |
502 return; | 504 return; |
503 } | 505 } |
504 if (dirty) | 506 if (dirty) |
505 StateIsDirty(transport_security_state_); | 507 StateIsDirty(transport_security_state_); |
506 } | 508 } |
507 | 509 |
508 } // namespace net | 510 } // namespace net |
OLD | NEW |