| 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/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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
| 15 #include "base/sequenced_task_runner.h" | 15 #include "base/sequenced_task_runner.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 std::string LoadState(const base::FilePath& path) { | 83 std::string LoadState(const base::FilePath& path) { |
| 84 std::string result; | 84 std::string result; |
| 85 if (!base::ReadFileToString(path, &result)) { | 85 if (!base::ReadFileToString(path, &result)) { |
| 86 return ""; | 86 return ""; |
| 87 } | 87 } |
| 88 return result; | 88 return result; |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace | 91 } // namespace |
| 92 | 92 |
| 93 |
| 94 namespace net { |
| 95 |
| 93 TransportSecurityPersister::TransportSecurityPersister( | 96 TransportSecurityPersister::TransportSecurityPersister( |
| 94 TransportSecurityState* state, | 97 TransportSecurityState* state, |
| 95 const base::FilePath& profile_path, | 98 const base::FilePath& profile_path, |
| 96 base::SequencedTaskRunner* background_runner, | 99 base::SequencedTaskRunner* background_runner, |
| 97 bool readonly) | 100 bool readonly) |
| 98 : transport_security_state_(state), | 101 : transport_security_state_(state), |
| 99 writer_(profile_path.AppendASCII("TransportSecurity"), background_runner), | 102 writer_(profile_path.AppendASCII("TransportSecurity"), background_runner), |
| 100 foreground_runner_(base::MessageLoop::current()->message_loop_proxy()), | 103 foreground_runner_(base::MessageLoop::current()->message_loop_proxy()), |
| 101 background_runner_(background_runner), | 104 background_runner_(background_runner), |
| 102 readonly_(readonly), | 105 readonly_(readonly), |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 DCHECK(foreground_runner_->RunsTasksOnCurrentThread()); | 304 DCHECK(foreground_runner_->RunsTasksOnCurrentThread()); |
| 302 | 305 |
| 303 bool dirty = false; | 306 bool dirty = false; |
| 304 if (!LoadEntries(state, &dirty)) { | 307 if (!LoadEntries(state, &dirty)) { |
| 305 LOG(ERROR) << "Failed to deserialize state: " << state; | 308 LOG(ERROR) << "Failed to deserialize state: " << state; |
| 306 return; | 309 return; |
| 307 } | 310 } |
| 308 if (dirty) | 311 if (dirty) |
| 309 StateIsDirty(transport_security_state_); | 312 StateIsDirty(transport_security_state_); |
| 310 } | 313 } |
| 314 |
| 315 } // namespace net |
| OLD | NEW |