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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } | 386 } |
387 | 387 |
388 while (smt.Step()) { | 388 while (smt.Step()) { |
389 std::string origin = smt.ColumnString(0); | 389 std::string origin = smt.ColumnString(0); |
390 std::string cert_from_db; | 390 std::string cert_from_db; |
391 smt.ColumnBlobAsString(1, &cert_from_db); | 391 smt.ColumnBlobAsString(1, &cert_from_db); |
392 // Parse the cert and extract the real value and then update the DB. | 392 // Parse the cert and extract the real value and then update the DB. |
393 scoped_refptr<net::X509Certificate> cert( | 393 scoped_refptr<net::X509Certificate> cert( |
394 net::X509Certificate::CreateFromBytes( | 394 net::X509Certificate::CreateFromBytes( |
395 cert_from_db.data(), cert_from_db.size())); | 395 cert_from_db.data(), cert_from_db.size())); |
396 if (cert) { | 396 if (cert.get()) { |
397 if (cur_version == 2) { | 397 if (cur_version == 2) { |
398 update_expires_smt.Reset(true); | 398 update_expires_smt.Reset(true); |
399 update_expires_smt.BindInt64(0, | 399 update_expires_smt.BindInt64(0, |
400 cert->valid_expiry().ToInternalValue()); | 400 cert->valid_expiry().ToInternalValue()); |
401 update_expires_smt.BindString(1, origin); | 401 update_expires_smt.BindString(1, origin); |
402 if (!update_expires_smt.Run()) { | 402 if (!update_expires_smt.Run()) { |
403 LOG(WARNING) << "Unable to update server bound cert database to " | 403 LOG(WARNING) << "Unable to update server bound cert database to " |
404 << "version 4."; | 404 << "version 4."; |
405 return false; | 405 return false; |
406 } | 406 } |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 663 |
664 void SQLiteServerBoundCertStore::SetForceKeepSessionState() { | 664 void SQLiteServerBoundCertStore::SetForceKeepSessionState() { |
665 backend_->SetForceKeepSessionState(); | 665 backend_->SetForceKeepSessionState(); |
666 } | 666 } |
667 | 667 |
668 SQLiteServerBoundCertStore::~SQLiteServerBoundCertStore() { | 668 SQLiteServerBoundCertStore::~SQLiteServerBoundCertStore() { |
669 backend_->Close(); | 669 backend_->Close(); |
670 // We release our reference to the Backend, though it will probably still have | 670 // We release our reference to the Backend, though it will probably still have |
671 // a reference if the background thread has not run Close() yet. | 671 // a reference if the background thread has not run Close() yet. |
672 } | 672 } |
OLD | NEW |