| 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 #ifndef CHROME_BROWSER_NET_SQLITE_SERVER_BOUND_CERT_STORE_H_ | 5 #ifndef CHROME_BROWSER_NET_SQLITE_SERVER_BOUND_CERT_STORE_H_ |
| 6 #define CHROME_BROWSER_NET_SQLITE_SERVER_BOUND_CERT_STORE_H_ | 6 #define CHROME_BROWSER_NET_SQLITE_SERVER_BOUND_CERT_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "net/base/default_server_bound_cert_store.h" | 12 #include "net/base/default_server_bound_cert_store.h" |
| 13 | 13 |
| 14 class ClearOnExitPolicy; |
| 14 class FilePath; | 15 class FilePath; |
| 15 | 16 |
| 16 // Implements the net::DefaultServerBoundCertStore::PersistentStore interface | 17 // Implements the net::DefaultServerBoundCertStore::PersistentStore interface |
| 17 // in terms of a SQLite database. For documentation about the actual member | 18 // in terms of a SQLite database. For documentation about the actual member |
| 18 // functions consult the documentation of the parent class | 19 // functions consult the documentation of the parent class |
| 19 // |net::DefaultServerBoundCertStore::PersistentCertStore|. | 20 // |net::DefaultServerBoundCertStore::PersistentCertStore|. |
| 21 // If provided, a |ClearOnExitPolicy| is consulted when the SQLite database is |
| 22 // closed to decide which certificates to keep. |
| 20 class SQLiteServerBoundCertStore | 23 class SQLiteServerBoundCertStore |
| 21 : public net::DefaultServerBoundCertStore::PersistentStore { | 24 : public net::DefaultServerBoundCertStore::PersistentStore { |
| 22 public: | 25 public: |
| 23 explicit SQLiteServerBoundCertStore(const FilePath& path); | 26 // If non-NULL, SQLiteServerBoundCertStore will keep a scoped_refptr to the |
| 27 // |clear_on_exit_policy| throughout its lifetime. |
| 28 SQLiteServerBoundCertStore(const FilePath& path, |
| 29 ClearOnExitPolicy* clear_on_exit_policy); |
| 24 | 30 |
| 25 // net::DefaultServerBoundCertStore::PersistentStore: | 31 // net::DefaultServerBoundCertStore::PersistentStore: |
| 26 virtual bool Load( | 32 virtual bool Load( |
| 27 std::vector<net::DefaultServerBoundCertStore::ServerBoundCert*>* certs) | 33 std::vector<net::DefaultServerBoundCertStore::ServerBoundCert*>* certs) |
| 28 OVERRIDE; | 34 OVERRIDE; |
| 29 virtual void AddServerBoundCert( | 35 virtual void AddServerBoundCert( |
| 30 const net::DefaultServerBoundCertStore::ServerBoundCert& cert) OVERRIDE; | 36 const net::DefaultServerBoundCertStore::ServerBoundCert& cert) OVERRIDE; |
| 31 virtual void DeleteServerBoundCert( | 37 virtual void DeleteServerBoundCert( |
| 32 const net::DefaultServerBoundCertStore::ServerBoundCert& cert) OVERRIDE; | 38 const net::DefaultServerBoundCertStore::ServerBoundCert& cert) OVERRIDE; |
| 33 virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE; | 39 virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE; |
| 34 virtual void Flush(const base::Closure& completion_task) OVERRIDE; | 40 virtual void Flush(const base::Closure& completion_task) OVERRIDE; |
| 35 | 41 |
| 36 protected: | 42 protected: |
| 37 virtual ~SQLiteServerBoundCertStore(); | 43 virtual ~SQLiteServerBoundCertStore(); |
| 38 | 44 |
| 39 private: | 45 private: |
| 40 class Backend; | 46 class Backend; |
| 41 | 47 |
| 42 scoped_refptr<Backend> backend_; | 48 scoped_refptr<Backend> backend_; |
| 43 | 49 |
| 44 DISALLOW_COPY_AND_ASSIGN(SQLiteServerBoundCertStore); | 50 DISALLOW_COPY_AND_ASSIGN(SQLiteServerBoundCertStore); |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 #endif // CHROME_BROWSER_NET_SQLITE_SERVER_BOUND_CERT_STORE_H_ | 53 #endif // CHROME_BROWSER_NET_SQLITE_SERVER_BOUND_CERT_STORE_H_ |
| OLD | NEW |