| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_H_ | 6 #define CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class FilePath; | 18 class FilePath; |
| 19 class TaskRunner; | 19 class TaskRunner; |
| 20 } // namespace base | 20 } // namespace base |
| 21 | 21 |
| 22 namespace quota { | 22 namespace storage { |
| 23 class SpecialStoragePolicy; | 23 class SpecialStoragePolicy; |
| 24 } // namespace quota | 24 } // namespace storage |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 class WebRTCIdentityRequest; | 27 class WebRTCIdentityRequest; |
| 28 struct WebRTCIdentityRequestResult; | 28 struct WebRTCIdentityRequestResult; |
| 29 class WebRTCIdentityStoreBackend; | 29 class WebRTCIdentityStoreBackend; |
| 30 class WebRTCIdentityStoreTest; | 30 class WebRTCIdentityStoreTest; |
| 31 | 31 |
| 32 // A class for creating and fetching DTLS identities, i.e. the private key and | 32 // A class for creating and fetching DTLS identities, i.e. the private key and |
| 33 // the self-signed certificate. | 33 // the self-signed certificate. |
| 34 // It can be created/destroyed on any thread, but the public methods must be | 34 // It can be created/destroyed on any thread, but the public methods must be |
| 35 // called on the IO thread. | 35 // called on the IO thread. |
| 36 class CONTENT_EXPORT WebRTCIdentityStore | 36 class CONTENT_EXPORT WebRTCIdentityStore |
| 37 : public base::RefCountedThreadSafe<WebRTCIdentityStore> { | 37 : public base::RefCountedThreadSafe<WebRTCIdentityStore> { |
| 38 public: | 38 public: |
| 39 typedef base::Callback<void(int error, | 39 typedef base::Callback<void(int error, |
| 40 const std::string& certificate, | 40 const std::string& certificate, |
| 41 const std::string& private_key)> | 41 const std::string& private_key)> |
| 42 CompletionCallback; | 42 CompletionCallback; |
| 43 | 43 |
| 44 // If |path| is empty, nothing will be saved to disk. | 44 // If |path| is empty, nothing will be saved to disk. |
| 45 WebRTCIdentityStore(const base::FilePath& path, | 45 WebRTCIdentityStore(const base::FilePath& path, |
| 46 quota::SpecialStoragePolicy* policy); | 46 storage::SpecialStoragePolicy* policy); |
| 47 | 47 |
| 48 // Retrieve the cached DTLS private key and certificate, i.e. identity, for | 48 // Retrieve the cached DTLS private key and certificate, i.e. identity, for |
| 49 // the |origin| and |identity_name| pair, or generate a new identity using | 49 // the |origin| and |identity_name| pair, or generate a new identity using |
| 50 // |common_name| if such an identity does not exist. | 50 // |common_name| if such an identity does not exist. |
| 51 // If the given |common_name| is different from the common name in the cached | 51 // If the given |common_name| is different from the common name in the cached |
| 52 // identity that has the same origin and identity_name, a new private key and | 52 // identity that has the same origin and identity_name, a new private key and |
| 53 // a new certificate will be generated, overwriting the old one. | 53 // a new certificate will be generated, overwriting the old one. |
| 54 // | 54 // |
| 55 // |origin| is the origin of the DTLS connection; | 55 // |origin| is the origin of the DTLS connection; |
| 56 // |identity_name| is used to identify an identity within an origin; it is | 56 // |identity_name| is used to identify an identity within an origin; it is |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 std::vector<WebRTCIdentityRequest*> in_flight_requests_; | 110 std::vector<WebRTCIdentityRequest*> in_flight_requests_; |
| 111 | 111 |
| 112 scoped_refptr<WebRTCIdentityStoreBackend> backend_; | 112 scoped_refptr<WebRTCIdentityStoreBackend> backend_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(WebRTCIdentityStore); | 114 DISALLOW_COPY_AND_ASSIGN(WebRTCIdentityStore); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 } // namespace content | 117 } // namespace content |
| 118 | 118 |
| 119 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_H_ | 119 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_IDENTITY_STORE_H_ |
| OLD | NEW |