Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ | |
| 6 #define CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 | |
| 10 class GURL; | |
| 11 | |
| 12 namespace base { | |
| 13 class TaskRunner; | |
| 14 } // namespace base | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 class DTLSIdentityRequest; | |
| 19 class DTLSIdentityRequestHandle; | |
| 20 | |
| 21 // A class for creating and fetching DTLS identities, i.e. the private key and | |
| 22 // the self-signed certificate. | |
| 23 class DTLSIdentityStore { | |
| 24 public: | |
| 25 typedef base::Callback<void(int error, | |
| 26 const std::string& certificate, | |
| 27 const std::string& private_key)> | |
| 28 CompletionCallback; | |
| 29 | |
| 30 DTLSIdentityStore(); | |
| 31 virtual ~DTLSIdentityStore(); | |
| 32 | |
| 33 // Retrieve the DTLS identity for the given origin, or generate a new one | |
| 34 // if not existent. Asynchronous. | |
| 35 // |origin| is the origin of the PeerConnection requesting the identity; | |
|
Ryan Sleevi
2013/06/17 23:08:34
comment: Your design indicates you're coupling thi
jiayl
2013/06/18 01:07:55
This class does not really rely on any WebRTC feat
| |
| 36 // |identity_name| is used to identify an identity within an origin; | |
| 37 // |common_name| is the common name used to generate the certificate; | |
|
Ryan Sleevi
2013/06/17 23:08:34
comment nit: Please provide clearer indication abo
jiayl
2013/06/18 01:07:55
I improved the comments.
On 2013/06/17 23:08:34, R
| |
| 38 // |callback| is the callback to return the result. | |
| 39 // |canceller| will be set to the Closure used to cancel the request if the | |
|
Ryan Sleevi
2013/06/17 23:08:34
naming nit: canceller -> cancel_callback
cancelle
jiayl
2013/06/18 01:07:55
Done.
| |
| 40 // request is accepted. The Closure can only be called before the request | |
| 41 // completes. | |
| 42 // | |
| 43 // Returns true if the request is accepted. | |
| 44 bool RequestIdentity( | |
| 45 const GURL& origin, | |
| 46 const std::string& identity_name, | |
| 47 const std::string& common_name, | |
| 48 const CompletionCallback& callback, | |
| 49 base::Closure* canceller); | |
| 50 | |
| 51 protected: | |
| 52 explicit DTLSIdentityStore( | |
| 53 const scoped_refptr<base::TaskRunner>& task_runner); | |
| 54 | |
| 55 private: | |
| 56 friend DTLSIdentityRequestHandle; | |
| 57 | |
| 58 void CancelRequestInternal(DTLSIdentityRequest* request); | |
| 59 | |
| 60 // The TaskRunner for doing work on a worker thread. | |
| 61 scoped_refptr<base::TaskRunner> task_runner_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(DTLSIdentityStore); | |
| 64 }; | |
| 65 | |
| 66 } // namespace content | |
| 67 | |
| 68 #endif // CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ | |
| OLD | NEW |