| 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 "chrome/browser/net/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" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 95 state_valid_ = file_util::ReadFileToString(path_, &state_); | 95 state_valid_ = file_util::ReadFileToString(path_, &state_); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void CompleteLoad() { | 98 void CompleteLoad() { |
| 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 100 | 100 |
| 101 // Make sure we're deleted. | 101 // Make sure we're deleted. |
| 102 scoped_ptr<Loader> deleter(this); | 102 scoped_ptr<Loader> deleter(this); |
| 103 | 103 |
| 104 if (!persister_ || !state_valid_) | 104 if (!persister_.get() || !state_valid_) |
| 105 return; | 105 return; |
| 106 persister_->CompleteLoad(state_); | 106 persister_->CompleteLoad(state_); |
| 107 } | 107 } |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 base::WeakPtr<TransportSecurityPersister> persister_; | 110 base::WeakPtr<TransportSecurityPersister> persister_; |
| 111 | 111 |
| 112 base::FilePath path_; | 112 base::FilePath path_; |
| 113 | 113 |
| 114 std::string state_; | 114 std::string state_; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 310 | 310 |
| 311 bool dirty = false; | 311 bool dirty = false; |
| 312 if (!LoadEntries(state, &dirty)) { | 312 if (!LoadEntries(state, &dirty)) { |
| 313 LOG(ERROR) << "Failed to deserialize state: " << state; | 313 LOG(ERROR) << "Failed to deserialize state: " << state; |
| 314 return; | 314 return; |
| 315 } | 315 } |
| 316 if (dirty) | 316 if (dirty) |
| 317 StateIsDirty(transport_security_state_); | 317 StateIsDirty(transport_security_state_); |
| 318 } | 318 } |
| OLD | NEW |