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/browsing_data/browsing_data_server_bound_cert_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return server_bound_cert_map_.size(); | 191 return server_bound_cert_map_.size(); |
192 } | 192 } |
193 | 193 |
194 void CannedBrowsingDataServerBoundCertHelper::StartFetching( | 194 void CannedBrowsingDataServerBoundCertHelper::StartFetching( |
195 const FetchResultCallback& callback) { | 195 const FetchResultCallback& callback) { |
196 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 196 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
197 if (callback.is_null()) | 197 if (callback.is_null()) |
198 return; | 198 return; |
199 // We post a task to emulate async fetching behavior. | 199 // We post a task to emulate async fetching behavior. |
200 completion_callback_ = callback; | 200 completion_callback_ = callback; |
201 MessageLoop::current()->PostTask( | 201 base::MessageLoop::current()->PostTask( |
202 FROM_HERE, | 202 FROM_HERE, |
203 base::Bind(&CannedBrowsingDataServerBoundCertHelper::FinishFetching, | 203 base::Bind(&CannedBrowsingDataServerBoundCertHelper::FinishFetching, |
204 this)); | 204 this)); |
205 } | 205 } |
206 | 206 |
207 void CannedBrowsingDataServerBoundCertHelper::FinishFetching() { | 207 void CannedBrowsingDataServerBoundCertHelper::FinishFetching() { |
208 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 208 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
209 net::ServerBoundCertStore::ServerBoundCertList cert_list; | 209 net::ServerBoundCertStore::ServerBoundCertList cert_list; |
210 for (ServerBoundCertMap::iterator i = server_bound_cert_map_.begin(); | 210 for (ServerBoundCertMap::iterator i = server_bound_cert_map_.begin(); |
211 i != server_bound_cert_map_.end(); ++i) | 211 i != server_bound_cert_map_.end(); ++i) |
212 cert_list.push_back(i->second); | 212 cert_list.push_back(i->second); |
213 completion_callback_.Run(cert_list); | 213 completion_callback_.Run(cert_list); |
214 } | 214 } |
215 | 215 |
216 void CannedBrowsingDataServerBoundCertHelper::DeleteServerBoundCert( | 216 void CannedBrowsingDataServerBoundCertHelper::DeleteServerBoundCert( |
217 const std::string& server_id) { | 217 const std::string& server_id) { |
218 NOTREACHED(); | 218 NOTREACHED(); |
219 } | 219 } |
OLD | NEW |