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/sqlite_server_bound_cert_store.h" | 5 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } | 285 } |
286 | 286 |
287 while (smt.Step()) { | 287 while (smt.Step()) { |
288 std::string origin = smt.ColumnString(0); | 288 std::string origin = smt.ColumnString(0); |
289 std::string cert_from_db; | 289 std::string cert_from_db; |
290 smt.ColumnBlobAsString(1, &cert_from_db); | 290 smt.ColumnBlobAsString(1, &cert_from_db); |
291 // Parse the cert and extract the real value and then update the DB. | 291 // Parse the cert and extract the real value and then update the DB. |
292 scoped_refptr<net::X509Certificate> cert( | 292 scoped_refptr<net::X509Certificate> cert( |
293 net::X509Certificate::CreateFromBytes( | 293 net::X509Certificate::CreateFromBytes( |
294 cert_from_db.data(), cert_from_db.size())); | 294 cert_from_db.data(), cert_from_db.size())); |
295 if (cert) { | 295 if (cert.get()) { |
296 if (cur_version == 2) { | 296 if (cur_version == 2) { |
297 update_expires_smt.Reset(true); | 297 update_expires_smt.Reset(true); |
298 update_expires_smt.BindInt64(0, | 298 update_expires_smt.BindInt64(0, |
299 cert->valid_expiry().ToInternalValue()); | 299 cert->valid_expiry().ToInternalValue()); |
300 update_expires_smt.BindString(1, origin); | 300 update_expires_smt.BindString(1, origin); |
301 if (!update_expires_smt.Run()) { | 301 if (!update_expires_smt.Run()) { |
302 LOG(WARNING) << "Unable to update server bound cert database to " | 302 LOG(WARNING) << "Unable to update server bound cert database to " |
303 << "version 4."; | 303 << "version 4."; |
304 return false; | 304 return false; |
305 } | 305 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 } | 561 } |
562 | 562 |
563 SQLiteServerBoundCertStore::~SQLiteServerBoundCertStore() { | 563 SQLiteServerBoundCertStore::~SQLiteServerBoundCertStore() { |
564 if (backend_.get()) { | 564 if (backend_.get()) { |
565 backend_->Close(); | 565 backend_->Close(); |
566 // Release our reference, it will probably still have a reference if the | 566 // Release our reference, it will probably still have a reference if the |
567 // background thread has not run Close() yet. | 567 // background thread has not run Close() yet. |
568 backend_ = NULL; | 568 backend_ = NULL; |
569 } | 569 } |
570 } | 570 } |
OLD | NEW |