| 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 NET_SSL_DEFAULT_SERVER_BOUND_CERT_STORE_H_ | 5 #ifndef NET_SSL_DEFAULT_SERVER_BOUND_CERT_STORE_H_ |
| 6 #define NET_SSL_DEFAULT_SERVER_BOUND_CERT_STORE_H_ | 6 #define NET_SSL_DEFAULT_SERVER_BOUND_CERT_STORE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // The store passed in should not have had Init() called on it yet. This | 36 // The store passed in should not have had Init() called on it yet. This |
| 37 // class will take care of initializing it. The backing store is NOT owned by | 37 // class will take care of initializing it. The backing store is NOT owned by |
| 38 // this class, but it must remain valid for the duration of the | 38 // this class, but it must remain valid for the duration of the |
| 39 // DefaultServerBoundCertStore's existence. If |store| is NULL, then no | 39 // DefaultServerBoundCertStore's existence. If |store| is NULL, then no |
| 40 // backing store will be updated. | 40 // backing store will be updated. |
| 41 explicit DefaultServerBoundCertStore(PersistentStore* store); | 41 explicit DefaultServerBoundCertStore(PersistentStore* store); |
| 42 | 42 |
| 43 virtual ~DefaultServerBoundCertStore(); | 43 virtual ~DefaultServerBoundCertStore(); |
| 44 | 44 |
| 45 // ServerBoundCertStore implementation. | 45 // ServerBoundCertStore implementation. |
| 46 virtual int GetServerBoundCert( | 46 virtual int GetServerBoundCert(const std::string& server_identifier, |
| 47 const std::string& server_identifier, | 47 base::Time* expiration_time, |
| 48 base::Time* expiration_time, | 48 std::string* private_key_result, |
| 49 std::string* private_key_result, | 49 std::string* cert_result, |
| 50 std::string* cert_result, | 50 const GetCertCallback& callback) OVERRIDE; |
| 51 const GetCertCallback& callback) OVERRIDE; | 51 virtual void SetServerBoundCert(const std::string& server_identifier, |
| 52 virtual void SetServerBoundCert( | 52 base::Time creation_time, |
| 53 const std::string& server_identifier, | 53 base::Time expiration_time, |
| 54 base::Time creation_time, | 54 const std::string& private_key, |
| 55 base::Time expiration_time, | 55 const std::string& cert) OVERRIDE; |
| 56 const std::string& private_key, | 56 virtual void DeleteServerBoundCert(const std::string& server_identifier, |
| 57 const std::string& cert) OVERRIDE; | 57 const base::Closure& callback) OVERRIDE; |
| 58 virtual void DeleteServerBoundCert( | 58 virtual void DeleteAllCreatedBetween(base::Time delete_begin, |
| 59 const std::string& server_identifier, | 59 base::Time delete_end, |
| 60 const base::Closure& callback) OVERRIDE; | 60 const base::Closure& callback) OVERRIDE; |
| 61 virtual void DeleteAllCreatedBetween( | |
| 62 base::Time delete_begin, | |
| 63 base::Time delete_end, | |
| 64 const base::Closure& callback) OVERRIDE; | |
| 65 virtual void DeleteAll(const base::Closure& callback) OVERRIDE; | 61 virtual void DeleteAll(const base::Closure& callback) OVERRIDE; |
| 66 virtual void GetAllServerBoundCerts( | 62 virtual void GetAllServerBoundCerts( |
| 67 const GetCertListCallback& callback) OVERRIDE; | 63 const GetCertListCallback& callback) OVERRIDE; |
| 68 virtual int GetCertCount() OVERRIDE; | 64 virtual int GetCertCount() OVERRIDE; |
| 69 virtual void SetForceKeepSessionState() OVERRIDE; | 65 virtual void SetForceKeepSessionState() OVERRIDE; |
| 70 | 66 |
| 71 private: | 67 private: |
| 72 class Task; | 68 class Task; |
| 73 class GetServerBoundCertTask; | 69 class GetServerBoundCertTask; |
| 74 class SetServerBoundCertTask; | 70 class SetServerBoundCertTask; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 99 | 95 |
| 100 // Initializes the backing store and reads existing certs from it. | 96 // Initializes the backing store and reads existing certs from it. |
| 101 // Should only be called by InitIfNecessary(). | 97 // Should only be called by InitIfNecessary(). |
| 102 void InitStore(); | 98 void InitStore(); |
| 103 | 99 |
| 104 // Callback for backing store loading completion. | 100 // Callback for backing store loading completion. |
| 105 void OnLoaded(scoped_ptr<ScopedVector<ServerBoundCert> > certs); | 101 void OnLoaded(scoped_ptr<ScopedVector<ServerBoundCert> > certs); |
| 106 | 102 |
| 107 // Syncronous methods which do the actual work. Can only be called after | 103 // Syncronous methods which do the actual work. Can only be called after |
| 108 // initialization is complete. | 104 // initialization is complete. |
| 109 void SyncSetServerBoundCert( | 105 void SyncSetServerBoundCert(const std::string& server_identifier, |
| 110 const std::string& server_identifier, | 106 base::Time creation_time, |
| 111 base::Time creation_time, | 107 base::Time expiration_time, |
| 112 base::Time expiration_time, | 108 const std::string& private_key, |
| 113 const std::string& private_key, | 109 const std::string& cert); |
| 114 const std::string& cert); | |
| 115 void SyncDeleteServerBoundCert(const std::string& server_identifier); | 110 void SyncDeleteServerBoundCert(const std::string& server_identifier); |
| 116 void SyncDeleteAllCreatedBetween(base::Time delete_begin, | 111 void SyncDeleteAllCreatedBetween(base::Time delete_begin, |
| 117 base::Time delete_end); | 112 base::Time delete_end); |
| 118 void SyncGetAllServerBoundCerts(ServerBoundCertList* cert_list); | 113 void SyncGetAllServerBoundCerts(ServerBoundCertList* cert_list); |
| 119 | 114 |
| 120 // Add |task| to |waiting_tasks_|. | 115 // Add |task| to |waiting_tasks_|. |
| 121 void EnqueueTask(scoped_ptr<Task> task); | 116 void EnqueueTask(scoped_ptr<Task> task); |
| 122 // If already initialized, run |task| immediately. Otherwise add it to | 117 // If already initialized, run |task| immediately. Otherwise add it to |
| 123 // |waiting_tasks_|. | 118 // |waiting_tasks_|. |
| 124 void RunOrEnqueueTask(scoped_ptr<Task> task); | 119 void RunOrEnqueueTask(scoped_ptr<Task> task); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 PersistentStore(); | 178 PersistentStore(); |
| 184 virtual ~PersistentStore(); | 179 virtual ~PersistentStore(); |
| 185 | 180 |
| 186 private: | 181 private: |
| 187 DISALLOW_COPY_AND_ASSIGN(PersistentStore); | 182 DISALLOW_COPY_AND_ASSIGN(PersistentStore); |
| 188 }; | 183 }; |
| 189 | 184 |
| 190 } // namespace net | 185 } // namespace net |
| 191 | 186 |
| 192 #endif // NET_SSL_DEFAULT_SERVER_BOUND_CERT_STORE_H_ | 187 #endif // NET_SSL_DEFAULT_SERVER_BOUND_CERT_STORE_H_ |
| OLD | NEW |