| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BASE_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_ | 5 #ifndef NET_BASE_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_ |
| 6 #define NET_BASE_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_ | 6 #define NET_BASE_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 virtual ~DefaultOriginBoundCertStore(); | 47 virtual ~DefaultOriginBoundCertStore(); |
| 48 | 48 |
| 49 // Flush the backing store (if any) to disk and post the given task when done. | 49 // Flush the backing store (if any) to disk and post the given task when done. |
| 50 // WARNING: THE CALLBACK WILL RUN ON A RANDOM THREAD. IT MUST BE THREAD SAFE. | 50 // WARNING: THE CALLBACK WILL RUN ON A RANDOM THREAD. IT MUST BE THREAD SAFE. |
| 51 // It may be posted to the current thread, or it may run on the thread that | 51 // It may be posted to the current thread, or it may run on the thread that |
| 52 // actually does the flushing. Your Task should generally post a notification | 52 // actually does the flushing. Your Task should generally post a notification |
| 53 // to the thread you actually want to be notified on. | 53 // to the thread you actually want to be notified on. |
| 54 void FlushStore(Task* completion_task); | 54 void FlushStore(Task* completion_task); |
| 55 | 55 |
| 56 // OriginBoundCertStore implementation. | 56 // OriginBoundCertStore implementation. |
| 57 virtual bool GetOriginBoundCert(const std::string& origin, | 57 virtual bool GetOriginBoundCert( |
| 58 std::string* private_key_result, | 58 const std::string& origin, |
| 59 std::string* cert_result) OVERRIDE; | 59 OriginBoundCertType* type, |
| 60 virtual void SetOriginBoundCert(const std::string& origin, | 60 std::string* private_key_result, |
| 61 const std::string& private_key, | 61 std::string* cert_result) OVERRIDE; |
| 62 const std::string& cert) OVERRIDE; | 62 virtual void SetOriginBoundCert( |
| 63 const std::string& origin, |
| 64 OriginBoundCertType type, |
| 65 const std::string& private_key, |
| 66 const std::string& cert) OVERRIDE; |
| 63 virtual void DeleteOriginBoundCert(const std::string& origin) OVERRIDE; | 67 virtual void DeleteOriginBoundCert(const std::string& origin) OVERRIDE; |
| 64 virtual void DeleteAll() OVERRIDE; | 68 virtual void DeleteAll() OVERRIDE; |
| 65 virtual void GetAllOriginBoundCerts( | 69 virtual void GetAllOriginBoundCerts( |
| 66 std::vector<OriginBoundCertInfo>* origin_bound_certs) OVERRIDE; | 70 std::vector<OriginBoundCertInfo>* origin_bound_certs) OVERRIDE; |
| 67 virtual int GetCertCount() OVERRIDE; | 71 virtual int GetCertCount() OVERRIDE; |
| 68 | 72 |
| 69 private: | 73 private: |
| 70 static const size_t kMaxCerts; | 74 static const size_t kMaxCerts; |
| 71 | 75 |
| 72 // Deletes all of the certs. Does not delete them from |store_|. | 76 // Deletes all of the certs. Does not delete them from |store_|. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 115 |
| 112 DISALLOW_COPY_AND_ASSIGN(DefaultOriginBoundCertStore); | 116 DISALLOW_COPY_AND_ASSIGN(DefaultOriginBoundCertStore); |
| 113 }; | 117 }; |
| 114 | 118 |
| 115 // The OriginBoundCert class contains a private key in addition to the origin | 119 // The OriginBoundCert class contains a private key in addition to the origin |
| 116 // and the cert. | 120 // and the cert. |
| 117 class NET_EXPORT DefaultOriginBoundCertStore::OriginBoundCert { | 121 class NET_EXPORT DefaultOriginBoundCertStore::OriginBoundCert { |
| 118 public: | 122 public: |
| 119 OriginBoundCert(); | 123 OriginBoundCert(); |
| 120 OriginBoundCert(const std::string& origin, | 124 OriginBoundCert(const std::string& origin, |
| 125 OriginBoundCertType type, |
| 121 const std::string& privatekey, | 126 const std::string& privatekey, |
| 122 const std::string& cert); | 127 const std::string& cert); |
| 123 | 128 |
| 124 const std::string& origin() const { return origin_; } | 129 const std::string& origin() const { return origin_; } |
| 130 OriginBoundCertType type() const { return type_; } |
| 125 const std::string& private_key() const { return private_key_; } | 131 const std::string& private_key() const { return private_key_; } |
| 126 const std::string& cert() const { return cert_; } | 132 const std::string& cert() const { return cert_; } |
| 127 | 133 |
| 128 private: | 134 private: |
| 129 std::string origin_; | 135 std::string origin_; |
| 136 OriginBoundCertType type_; |
| 130 std::string private_key_; | 137 std::string private_key_; |
| 131 std::string cert_; | 138 std::string cert_; |
| 132 }; | 139 }; |
| 133 | 140 |
| 134 typedef base::RefCountedThreadSafe<DefaultOriginBoundCertStore::PersistentStore> | 141 typedef base::RefCountedThreadSafe<DefaultOriginBoundCertStore::PersistentStore> |
| 135 RefcountedPersistentStore; | 142 RefcountedPersistentStore; |
| 136 | 143 |
| 137 class NET_EXPORT DefaultOriginBoundCertStore::PersistentStore | 144 class NET_EXPORT DefaultOriginBoundCertStore::PersistentStore |
| 138 : public RefcountedPersistentStore { | 145 : public RefcountedPersistentStore { |
| 139 public: | 146 public: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 159 protected: | 166 protected: |
| 160 PersistentStore(); | 167 PersistentStore(); |
| 161 | 168 |
| 162 private: | 169 private: |
| 163 DISALLOW_COPY_AND_ASSIGN(PersistentStore); | 170 DISALLOW_COPY_AND_ASSIGN(PersistentStore); |
| 164 }; | 171 }; |
| 165 | 172 |
| 166 } // namespace net | 173 } // namespace net |
| 167 | 174 |
| 168 #endif // NET_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_ | 175 #endif // NET_DEFAULT_ORIGIN_BOUND_CERT_STORE_H_ |
| OLD | NEW |