Chromium Code Reviews| Index: content/browser/media/dtls_identity_store.h |
| diff --git a/content/browser/media/dtls_identity_store.h b/content/browser/media/dtls_identity_store.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..eb3355d987f77a914f2757115faef07b942de05f |
| --- /dev/null |
| +++ b/content/browser/media/dtls_identity_store.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ |
| +#define CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/singleton.h" |
| + |
| +class GURL; |
| + |
| +namespace base { |
| +class TaskRunner; |
| +} // namespace base |
| + |
| +namespace content { |
| + |
| +// This is a singleton class called in the browser IO thread. |
| +// It dispatches DTLS identity requests to the background worker thread. |
| +class DTLSIdentityStore { |
| + public: |
| + static DTLSIdentityStore* GetInstance(); |
| + |
| + typedef base::Callback< |
| + void(const std::string& certificate, const std::string& private_key)> |
| + OnCompleteCallback; |
| + |
| + // Retrieve the DTLS identity for the given origin, or generate a new one |
| + // if not existent. Asynchronous. Called on the browser IO thread. |
| + // |origin| is the origin of the PeerConnection requesting the identity; |
| + // |identity_name| is used to identity an identity within an origin; |
| + // |common_name| is the common name used to generate the certificate; |
| + // |callback| is the callback to return the result. |
| + void RequestIdentity(const GURL& origin, |
| + const std::string& identity_name, |
| + const std::string& common_name, |
| + const OnCompleteCallback& callback); |
| + |
| + protected: |
| + explicit DTLSIdentityStore( |
| + const scoped_refptr<base::TaskRunner>& task_runner); |
| + virtual ~DTLSIdentityStore(); |
| + |
| + private: |
| + friend struct DefaultSingletonTraits<DTLSIdentityStore>; |
| + |
| + DTLSIdentityStore(); |
| + |
| + // The TaskRunner for doing work on a worker thread. |
| + scoped_refptr<base::TaskRunner> task_runner_; |
| +}; |
|
Ryan Sleevi
2013/06/06 23:57:37
DISALLOW_COPY_AND_ASSIGN
jiayl
2013/06/13 21:50:45
Done.
|
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_ |