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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 public: | 87 public: |
88 Loader(const base::WeakPtr<TransportSecurityPersister>& persister, | 88 Loader(const base::WeakPtr<TransportSecurityPersister>& persister, |
89 const base::FilePath& path) | 89 const base::FilePath& path) |
90 : persister_(persister), | 90 : persister_(persister), |
91 path_(path), | 91 path_(path), |
92 state_valid_(false) { | 92 state_valid_(false) { |
93 } | 93 } |
94 | 94 |
95 void Load() { | 95 void Load() { |
96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
97 state_valid_ = file_util::ReadFileToString(path_, &state_); | 97 state_valid_ = base::ReadFileToString(path_, &state_); |
98 } | 98 } |
99 | 99 |
100 void CompleteLoad() { | 100 void CompleteLoad() { |
101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
102 | 102 |
103 // Make sure we're deleted. | 103 // Make sure we're deleted. |
104 scoped_ptr<Loader> deleter(this); | 104 scoped_ptr<Loader> deleter(this); |
105 | 105 |
106 if (!persister_.get() || !state_valid_) | 106 if (!persister_.get() || !state_valid_) |
107 return; | 107 return; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 330 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
331 | 331 |
332 bool dirty = false; | 332 bool dirty = false; |
333 if (!LoadEntries(state, &dirty)) { | 333 if (!LoadEntries(state, &dirty)) { |
334 LOG(ERROR) << "Failed to deserialize state: " << state; | 334 LOG(ERROR) << "Failed to deserialize state: " << state; |
335 return; | 335 return; |
336 } | 336 } |
337 if (dirty) | 337 if (dirty) |
338 StateIsDirty(transport_security_state_); | 338 StateIsDirty(transport_security_state_); |
339 } | 339 } |
OLD | NEW |