| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHANNEL_ID_STORE_H_ | 5 #ifndef NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_ |
| 6 #define NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_ | 6 #define NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // class will take care of initializing it. The backing store is NOT owned by | 38 // class will take care of initializing it. The backing store is NOT owned by |
| 39 // this class, but it must remain valid for the duration of the | 39 // this class, but it must remain valid for the duration of the |
| 40 // DefaultChannelIDStore's existence. If |store| is NULL, then no | 40 // DefaultChannelIDStore's existence. If |store| is NULL, then no |
| 41 // backing store will be updated. | 41 // backing store will be updated. |
| 42 explicit DefaultChannelIDStore(PersistentStore* store); | 42 explicit DefaultChannelIDStore(PersistentStore* store); |
| 43 | 43 |
| 44 ~DefaultChannelIDStore() override; | 44 ~DefaultChannelIDStore() override; |
| 45 | 45 |
| 46 // ChannelIDStore implementation. | 46 // ChannelIDStore implementation. |
| 47 int GetChannelID(const std::string& server_identifier, | 47 int GetChannelID(const std::string& server_identifier, |
| 48 base::Time* expiration_time, | |
| 49 std::string* private_key_result, | 48 std::string* private_key_result, |
| 50 std::string* cert_result, | 49 std::string* public_key_result, |
| 51 const GetChannelIDCallback& callback) override; | 50 const GetChannelIDCallback& callback) override; |
| 52 void SetChannelID(const std::string& server_identifier, | 51 void SetChannelID(const std::string& server_identifier, |
| 53 base::Time creation_time, | 52 base::Time creation_time, |
| 54 base::Time expiration_time, | |
| 55 const std::string& private_key, | 53 const std::string& private_key, |
| 56 const std::string& cert) override; | 54 const std::string& public_key) override; |
| 57 void DeleteChannelID(const std::string& server_identifier, | 55 void DeleteChannelID(const std::string& server_identifier, |
| 58 const base::Closure& callback) override; | 56 const base::Closure& callback) override; |
| 59 void DeleteAllCreatedBetween(base::Time delete_begin, | 57 void DeleteAllCreatedBetween(base::Time delete_begin, |
| 60 base::Time delete_end, | 58 base::Time delete_end, |
| 61 const base::Closure& callback) override; | 59 const base::Closure& callback) override; |
| 62 void DeleteAll(const base::Closure& callback) override; | 60 void DeleteAll(const base::Closure& callback) override; |
| 63 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override; | 61 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override; |
| 64 int GetChannelIDCount() override; | 62 int GetChannelIDCount() override; |
| 65 void SetForceKeepSessionState() override; | 63 void SetForceKeepSessionState() override; |
| 66 | 64 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 93 | 91 |
| 94 // Initializes the backing store and reads existing certs from it. | 92 // Initializes the backing store and reads existing certs from it. |
| 95 // Should only be called by InitIfNecessary(). | 93 // Should only be called by InitIfNecessary(). |
| 96 void InitStore(); | 94 void InitStore(); |
| 97 | 95 |
| 98 // Callback for backing store loading completion. | 96 // Callback for backing store loading completion. |
| 99 void OnLoaded(scoped_ptr<ScopedVector<ChannelID> > certs); | 97 void OnLoaded(scoped_ptr<ScopedVector<ChannelID> > certs); |
| 100 | 98 |
| 101 // Syncronous methods which do the actual work. Can only be called after | 99 // Syncronous methods which do the actual work. Can only be called after |
| 102 // initialization is complete. | 100 // initialization is complete. |
| 103 void SyncSetChannelID( | 101 void SyncSetChannelID(const std::string& server_identifier, |
| 104 const std::string& server_identifier, | 102 base::Time creation_time, |
| 105 base::Time creation_time, | 103 const std::string& private_key, |
| 106 base::Time expiration_time, | 104 const std::string& public_key); |
| 107 const std::string& private_key, | |
| 108 const std::string& cert); | |
| 109 void SyncDeleteChannelID(const std::string& server_identifier); | 105 void SyncDeleteChannelID(const std::string& server_identifier); |
| 110 void SyncDeleteAllCreatedBetween(base::Time delete_begin, | 106 void SyncDeleteAllCreatedBetween(base::Time delete_begin, |
| 111 base::Time delete_end); | 107 base::Time delete_end); |
| 112 void SyncGetAllChannelIDs(ChannelIDList* channel_id_list); | 108 void SyncGetAllChannelIDs(ChannelIDList* channel_id_list); |
| 113 | 109 |
| 114 // Add |task| to |waiting_tasks_|. | 110 // Add |task| to |waiting_tasks_|. |
| 115 void EnqueueTask(scoped_ptr<Task> task); | 111 void EnqueueTask(scoped_ptr<Task> task); |
| 116 // If already initialized, run |task| immediately. Otherwise add it to | 112 // If already initialized, run |task| immediately. Otherwise add it to |
| 117 // |waiting_tasks_|. | 113 // |waiting_tasks_|. |
| 118 void RunOrEnqueueTask(scoped_ptr<Task> task); | 114 void RunOrEnqueueTask(scoped_ptr<Task> task); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 PersistentStore(); | 174 PersistentStore(); |
| 179 virtual ~PersistentStore(); | 175 virtual ~PersistentStore(); |
| 180 | 176 |
| 181 private: | 177 private: |
| 182 DISALLOW_COPY_AND_ASSIGN(PersistentStore); | 178 DISALLOW_COPY_AND_ASSIGN(PersistentStore); |
| 183 }; | 179 }; |
| 184 | 180 |
| 185 } // namespace net | 181 } // namespace net |
| 186 | 182 |
| 187 #endif // NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_ | 183 #endif // NET_SSL_DEFAULT_CHANNEL_ID_STORE_H_ |
| OLD | NEW |