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 class DTLSIdentityStoreTest; | |
21 | |
22 // A class for creating and fetching DTLS identities, i.e. the private key and | |
23 // the self-signed certificate. | |
24 class DTLSIdentityStore { | |
Ryan Sleevi
2013/06/24 19:29:16
I'm still concerned about the naming here, in that
jiayl
2013/06/25 20:36:32
Renamed to WebRTCIdentity*
On 2013/06/24 19:29:16,
| |
25 public: | |
26 typedef base::Callback<void(int error, | |
27 const std::string& certificate, | |
28 const std::string& private_key)> | |
29 CompletionCallback; | |
30 | |
31 DTLSIdentityStore(); | |
32 virtual ~DTLSIdentityStore(); | |
Ryan Sleevi
2013/06/24 19:29:16
unnecessary virtual dtor.
jiayl
2013/06/25 20:36:32
Done.
| |
33 | |
34 // Retrieve the DTLS identity for the |origin| and |identity_name| pair, or | |
35 // generate a new one using |common_name| if such identity does not exist, or | |
36 // if the given |common_name| does not match the common name in the existing | |
37 // identity's certificate. | |
Ryan Sleevi
2013/06/24 19:29:16
From reading this comment, I'm still not sure I un
jiayl
2013/06/25 20:36:32
Done.
| |
38 // | |
39 // Asynchronous. | |
Ryan Sleevi
2013/06/24 19:29:16
"// Asynchronous" is unnecessary, and it's also no
jiayl
2013/06/25 20:36:32
Done.
| |
40 // |origin| is the origin of the DTLS connection; | |
41 // |identity_name| is used to identify an identity within an origin; it is | |
42 // opaque to DTLSIdentityStore and remains private to the caller, i.e. not | |
43 // presetnt in the certificate; | |
44 // |common_name| is the common name used to generate the certificate and will | |
45 // be shared with the peer of the DTLS connection. Identities created for | |
46 // different origins or different identity names may have the same common | |
47 // name. | |
48 // |callback| is the callback to return the result. | |
49 // |cancel_callback| will be set to the Closure used to cancel the request | |
50 // if the request is accepted. The Closure can only be called before the | |
51 // request completes. | |
52 // | |
53 // Returns true if the request is accepted. | |
54 bool RequestIdentity(const GURL& origin, | |
55 const std::string& identity_name, | |
56 const std::string& common_name, | |
57 const CompletionCallback& callback, | |
58 base::Closure* cancel_callback); | |
59 | |
60 private: | |
61 friend class DTLSIdentityRequestHandle; | |
62 friend class DTLSIdentityStoreTest; | |
63 | |
64 explicit DTLSIdentityStore( | |
65 const scoped_refptr<base::TaskRunner>& task_runner); | |
66 | |
67 void CancelRequestInternal(DTLSIdentityRequest* request); | |
68 | |
69 // The TaskRunner for doing work on a worker thread. | |
70 scoped_refptr<base::TaskRunner> task_runner_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(DTLSIdentityStore); | |
73 }; | |
74 | |
75 } // namespace content | |
76 | |
77 #endif // CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ | |
OLD | NEW |