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 #include "base/memory/ref_counted.h" | |
10 #include "base/threading/non_thread_safe.h" | |
Ryan Sleevi
2013/06/17 18:13:23
Unused
jiayl
2013/06/17 18:58:00
Removed
| |
11 | |
12 class GURL; | |
13 | |
14 namespace base { | |
15 class TaskRunner; | |
16 } // namespace base | |
17 | |
18 namespace content { | |
19 | |
20 class DTLSIdentityRequest; | |
21 class DTLSIdentityRequestHandle; | |
22 | |
23 // A class for creating and fetching DTLS identities, i.e. the private key and | |
24 // the self-signed certificate. | |
25 class DTLSIdentityStore { | |
26 public: | |
27 typedef base::Callback<void(int error, | |
28 const std::string& certificate, | |
29 const std::string& private_key)> | |
30 CompletionCallback; | |
31 | |
32 DTLSIdentityStore(); | |
33 virtual ~DTLSIdentityStore(); | |
34 | |
35 // Retrieve the DTLS identity for the given origin, or generate a new one | |
36 // if not existent. Asynchronous. | |
37 // |origin| is the origin of the PeerConnection requesting the identity; | |
38 // |identity_name| is used to identify an identity within an origin; | |
39 // |common_name| is the common name used to generate the certificate; | |
40 // |callback| is the callback to return the result. | |
41 // | |
42 // Returns the Closure that can be used to cancel the request before the | |
43 // request is completed. | |
44 base::Closure RequestIdentity( | |
45 const GURL& origin, | |
46 const std::string& identity_name, | |
47 const std::string& common_name, | |
48 const CompletionCallback& callback); | |
49 | |
50 protected: | |
51 explicit DTLSIdentityStore( | |
Ryan Sleevi
2013/06/17 18:13:23
Why is this protected, when this class has no virt
jiayl
2013/06/17 18:58:00
It's used in the unit test to inject the TaskRunne
Ryan Sleevi
2013/06/17 23:08:34
It doesn't need to be protected though - it should
| |
52 const scoped_refptr<base::TaskRunner>& task_runner); | |
53 | |
54 private: | |
55 friend DTLSIdentityRequestHandle; | |
56 | |
57 void CancelRequestInternal(DTLSIdentityRequest* request); | |
58 | |
59 // The TaskRunner for doing work on a worker thread. | |
60 scoped_refptr<base::TaskRunner> task_runner_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(DTLSIdentityStore); | |
63 }; | |
64 | |
65 } // namespace content | |
66 | |
67 #endif // CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ | |
OLD | NEW |