Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: chrome/browser/net/sqlite_origin_bound_cert_store.cc

Issue 9617039: Change Origin bound certs -> Domain bound certs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: explanitory comment Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_origin_bound_cert_store.h" 5 #include "chrome/browser/net/sqlite_origin_bound_cert_store.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 if (!transaction.Begin()) 396 if (!transaction.Begin())
397 return; 397 return;
398 398
399 for (PendingOperationsList::iterator it = ops.begin(); 399 for (PendingOperationsList::iterator it = ops.begin();
400 it != ops.end(); ++it) { 400 it != ops.end(); ++it) {
401 // Free the certs as we commit them to the database. 401 // Free the certs as we commit them to the database.
402 scoped_ptr<PendingOperation> po(*it); 402 scoped_ptr<PendingOperation> po(*it);
403 switch (po->op()) { 403 switch (po->op()) {
404 case PendingOperation::CERT_ADD: { 404 case PendingOperation::CERT_ADD: {
405 add_smt.Reset(); 405 add_smt.Reset();
406 add_smt.BindString(0, po->cert().origin()); 406 add_smt.BindString(0, po->cert().domain());
407 const std::string& private_key = po->cert().private_key(); 407 const std::string& private_key = po->cert().private_key();
408 add_smt.BindBlob(1, private_key.data(), private_key.size()); 408 add_smt.BindBlob(1, private_key.data(), private_key.size());
409 const std::string& cert = po->cert().cert(); 409 const std::string& cert = po->cert().cert();
410 add_smt.BindBlob(2, cert.data(), cert.size()); 410 add_smt.BindBlob(2, cert.data(), cert.size());
411 add_smt.BindInt(3, po->cert().type()); 411 add_smt.BindInt(3, po->cert().type());
412 add_smt.BindInt64(4, po->cert().expiration_time().ToInternalValue()); 412 add_smt.BindInt64(4, po->cert().expiration_time().ToInternalValue());
413 add_smt.BindInt64(5, po->cert().creation_time().ToInternalValue()); 413 add_smt.BindInt64(5, po->cert().creation_time().ToInternalValue());
414 if (!add_smt.Run()) 414 if (!add_smt.Run())
415 NOTREACHED() << "Could not add an origin bound cert to the DB."; 415 NOTREACHED() << "Could not add an origin bound cert to the DB.";
416 break; 416 break;
417 } 417 }
418 case PendingOperation::CERT_DELETE: 418 case PendingOperation::CERT_DELETE:
419 del_smt.Reset(); 419 del_smt.Reset();
420 del_smt.BindString(0, po->cert().origin()); 420 del_smt.BindString(0, po->cert().domain());
421 if (!del_smt.Run()) 421 if (!del_smt.Run())
422 NOTREACHED() << "Could not delete an origin bound cert from the DB."; 422 NOTREACHED() << "Could not delete an origin bound cert from the DB.";
Mike West 2012/03/07 10:31:47 "domain-bound cert"? Honestly, this is confusing.
423 break; 423 break;
424 424
425 default: 425 default:
426 NOTREACHED(); 426 NOTREACHED();
427 break; 427 break;
428 } 428 }
429 } 429 }
430 transaction.Commit(); 430 transaction.Commit();
431 } 431 }
432 432
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if (backend_.get()) 506 if (backend_.get())
507 backend_->SetClearLocalStateOnExit(clear_local_state); 507 backend_->SetClearLocalStateOnExit(clear_local_state);
508 } 508 }
509 509
510 void SQLiteOriginBoundCertStore::Flush(const base::Closure& completion_task) { 510 void SQLiteOriginBoundCertStore::Flush(const base::Closure& completion_task) {
511 if (backend_.get()) 511 if (backend_.get())
512 backend_->Flush(completion_task); 512 backend_->Flush(completion_task);
513 else if (!completion_task.is_null()) 513 else if (!completion_task.is_null())
514 MessageLoop::current()->PostTask(FROM_HERE, completion_task); 514 MessageLoop::current()->PostTask(FROM_HERE, completion_task);
515 } 515 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698