Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1191)

Unified Diff: content/browser/media/dtls_identity_store.h

Issue 15969025: Generates the DTLS identity in browser process and returns it to render process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9e1483c010b947aeb31893923c02c3ae8e8eab1b
--- /dev/null
+++ b/content/browser/media/dtls_identity_store.h
@@ -0,0 +1,68 @@
+// 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"
+
+class GURL;
+
+namespace base {
+class TaskRunner;
+} // namespace base
+
+namespace content {
+
+class DTLSIdentityRequest;
+class DTLSIdentityRequestHandle;
+
+// A class for creating and fetching DTLS identities, i.e. the private key and
+// the self-signed certificate.
+class DTLSIdentityStore {
+ public:
+ typedef base::Callback<void(int error,
+ const std::string& certificate,
+ const std::string& private_key)>
+ CompletionCallback;
+
+ DTLSIdentityStore();
+ virtual ~DTLSIdentityStore();
+
+ // Retrieve the DTLS identity for the given origin, or generate a new one
+ // if not existent. Asynchronous.
+ // |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
+ // |identity_name| is used to identify an identity within an origin;
+ // |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
+ // |callback| is the callback to return the result.
+ // |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.
+ // request is accepted. The Closure can only be called before the request
+ // completes.
+ //
+ // Returns true if the request is accepted.
+ bool RequestIdentity(
+ const GURL& origin,
+ const std::string& identity_name,
+ const std::string& common_name,
+ const CompletionCallback& callback,
+ base::Closure* canceller);
+
+ protected:
+ explicit DTLSIdentityStore(
+ const scoped_refptr<base::TaskRunner>& task_runner);
+
+ private:
+ friend DTLSIdentityRequestHandle;
+
+ void CancelRequestInternal(DTLSIdentityRequest* request);
+
+ // The TaskRunner for doing work on a worker thread.
+ scoped_refptr<base::TaskRunner> task_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(DTLSIdentityStore);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_
« no previous file with comments | « no previous file | content/browser/media/dtls_identity_store.cc » ('j') | content/browser/media/dtls_identity_store.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698