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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(Loader); | 117 DISALLOW_COPY_AND_ASSIGN(Loader); |
118 }; | 118 }; |
119 | 119 |
120 TransportSecurityPersister::TransportSecurityPersister( | 120 TransportSecurityPersister::TransportSecurityPersister( |
121 TransportSecurityState* state, | 121 TransportSecurityState* state, |
122 const base::FilePath& profile_path, | 122 const base::FilePath& profile_path, |
123 bool readonly) | 123 bool readonly) |
124 : transport_security_state_(state), | 124 : transport_security_state_(state), |
125 writer_(profile_path.AppendASCII("TransportSecurity"), | 125 writer_(profile_path.AppendASCII("TransportSecurity"), |
126 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)), | 126 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) |
| 127 .get()), |
127 readonly_(readonly), | 128 readonly_(readonly), |
128 weak_ptr_factory_(this) { | 129 weak_ptr_factory_(this) { |
129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
130 | 131 |
131 transport_security_state_->SetDelegate(this); | 132 transport_security_state_->SetDelegate(this); |
132 | 133 |
133 Loader* loader = new Loader(weak_ptr_factory_.GetWeakPtr(), writer_.path()); | 134 Loader* loader = new Loader(weak_ptr_factory_.GetWeakPtr(), writer_.path()); |
134 BrowserThread::PostTaskAndReply( | 135 BrowserThread::PostTaskAndReply( |
135 BrowserThread::FILE, FROM_HERE, | 136 BrowserThread::FILE, FROM_HERE, |
136 base::Bind(&Loader::Load, base::Unretained(loader)), | 137 base::Bind(&Loader::Load, base::Unretained(loader)), |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 310 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
310 | 311 |
311 bool dirty = false; | 312 bool dirty = false; |
312 if (!LoadEntries(state, &dirty)) { | 313 if (!LoadEntries(state, &dirty)) { |
313 LOG(ERROR) << "Failed to deserialize state: " << state; | 314 LOG(ERROR) << "Failed to deserialize state: " << state; |
314 return; | 315 return; |
315 } | 316 } |
316 if (dirty) | 317 if (dirty) |
317 StateIsDirty(transport_security_state_); | 318 StateIsDirty(transport_security_state_); |
318 } | 319 } |
OLD | NEW |