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 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/singleton.h" | |
| 11 | |
| 12 class GURL; | |
| 13 | |
| 14 namespace base { | |
| 15 class TaskRunner; | |
| 16 } // namespace base | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 // This is a singleton class called in the browser IO thread. | |
| 21 // It dispatches DTLS identity requests to the background worker thread. | |
| 22 class DTLSIdentityStore { | |
| 23 public: | |
| 24 static DTLSIdentityStore* GetInstance(); | |
| 25 | |
| 26 typedef base::Callback< | |
| 27 void(const std::string& certificate, const std::string& private_key)> | |
| 28 OnCompleteCallback; | |
| 29 | |
| 30 // Retrieve the DTLS identity for the given origin, or generate a new one | |
| 31 // if not existent. Asynchronous. Called on the browser IO thread. | |
| 32 // |origin| is the origin of the PeerConnection requesting the identity; | |
| 33 // |identity_name| is used to identity an identity within an origin; | |
| 34 // |common_name| is the common name used to generate the certificate; | |
| 35 // |callback| is the callback to return the result. | |
| 36 void RequestIdentity(const GURL& origin, | |
| 37 const std::string& identity_name, | |
| 38 const std::string& common_name, | |
| 39 const OnCompleteCallback& callback); | |
| 40 | |
| 41 protected: | |
| 42 explicit DTLSIdentityStore( | |
| 43 const scoped_refptr<base::TaskRunner>& task_runner); | |
| 44 virtual ~DTLSIdentityStore(); | |
| 45 | |
| 46 private: | |
| 47 friend struct DefaultSingletonTraits<DTLSIdentityStore>; | |
| 48 | |
| 49 DTLSIdentityStore(); | |
| 50 | |
| 51 // The TaskRunner for doing work on a worker thread. | |
| 52 scoped_refptr<base::TaskRunner> task_runner_; | |
| 53 }; | |
|
Ryan Sleevi
2013/06/06 23:57:37
DISALLOW_COPY_AND_ASSIGN
jiayl
2013/06/13 21:50:45
Done.
| |
| 54 | |
| 55 } // namespace content | |
| 56 | |
| 57 #endif // CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ | |
| OLD | NEW |