OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/transport_security_persister.h" | 5 #include "chrome/browser/transport_security_persister.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 44 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
45 NewRunnableMethod(this, | 45 NewRunnableMethod(this, |
46 &TransportSecurityPersister::CompleteLoad, | 46 &TransportSecurityPersister::CompleteLoad, |
47 state)); | 47 state)); |
48 } | 48 } |
49 | 49 |
50 void TransportSecurityPersister::CompleteLoad(const std::string& state) { | 50 void TransportSecurityPersister::CompleteLoad(const std::string& state) { |
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
52 | 52 |
53 bool dirty = false; | 53 bool dirty = false; |
54 if (!transport_security_state_->Deserialise(state, &dirty)) { | 54 if (!transport_security_state_->LoadEntries(state, &dirty)) { |
55 LOG(ERROR) << "Failed to deserialize state: " << state; | 55 LOG(ERROR) << "Failed to deserialize state: " << state; |
56 return; | 56 return; |
57 } | 57 } |
58 if (dirty) | 58 if (dirty) |
59 StateIsDirty(transport_security_state_); | 59 StateIsDirty(transport_security_state_); |
60 } | 60 } |
61 | 61 |
62 void TransportSecurityPersister::StateIsDirty( | 62 void TransportSecurityPersister::StateIsDirty( |
63 net::TransportSecurityState* state) { | 63 net::TransportSecurityState* state) { |
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
(...skipping 22 matching lines...) Expand all Loading... |
87 &TransportSecurityPersister::CompleteSave, | 87 &TransportSecurityPersister::CompleteSave, |
88 state)); | 88 state)); |
89 } | 89 } |
90 | 90 |
91 void TransportSecurityPersister::CompleteSave(const std::string& state) { | 91 void TransportSecurityPersister::CompleteSave(const std::string& state) { |
92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
93 DCHECK(!readonly_); | 93 DCHECK(!readonly_); |
94 | 94 |
95 file_util::WriteFile(state_file_, state.data(), state.size()); | 95 file_util::WriteFile(state_file_, state.data(), state.size()); |
96 } | 96 } |
OLD | NEW |