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

Side by Side 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 unified diff | Download patch
OLDNEW
(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"
11
12 class GURL;
13
14 namespace base {
15 class TaskRunner;
16 } // namespace base
17
18 namespace content {
19
20 namespace {
21 class DTLSIdentityRequest;
22 } // namespace
Ryan Sleevi 2013/06/13 22:36:47 C++ LANGUAGE: You cannot forward declare a type in
jiayl 2013/06/14 00:37:01 Done.
23
24 class DTLSIdentityStore : public base::RefCounted<DTLSIdentityStore> {
Ryan Sleevi 2013/06/13 22:36:47 DESIGN: Please do not use RefCounting for this cla
jiayl 2013/06/14 00:37:01 Done. StoragePartitionImpl owns it.
25 public:
26 DTLSIdentityStore();
Ryan Sleevi 2013/06/13 22:36:47 STYLE: Per http://google-styleguide.googlecode.com
jiayl 2013/06/14 00:37:01 Done.
27
28 typedef base::Callback<void(int error,
29 const std::string& certificate,
30 const std::string& private_key)>
31 CompletionCallback;
32
33 class RequestHandle {
Ryan Sleevi 2013/06/13 22:36:47 DESIGN: This would be better served as an opaque h
jiayl 2013/06/14 00:37:01 Do you mean make RequestHandler::Cancel private an
jam 2013/06/14 23:33:13 yeah, that is much better. this whole class (Reque
jiayl 2013/06/17 17:54:49 Done.
34 public:
35 RequestHandle();
36 ~RequestHandle();
37
38 // Cancel the request. Does nothing if the request finished or was already
39 // cancelled.
40 void Cancel();
41
42 private:
43 friend class DTLSIdentityStore;
44
45 void RequestStarted(DTLSIdentityStore* store,
46 DTLSIdentityRequest* request,
47 const CompletionCallback& callback);
48
49 void OnRequestComplete(int error,
50 const std::string& certificate,
51 const std::string& private_key);
52
53 DTLSIdentityStore* store_;
54 DTLSIdentityRequest* request_;
55 CompletionCallback callback_;
56 };
Ryan Sleevi 2013/06/13 22:36:47 DISALLOW_COPY_AND_ASSIGN
jiayl 2013/06/14 00:37:01 Done.
57
58 // Retrieve the DTLS identity for the given origin, or generate a new one
59 // if not existent. Asynchronous.
60 // |origin| is the origin of the PeerConnection requesting the identity;
61 // |identity_name| is used to identity an identity within an origin;
Ryan Sleevi 2013/06/13 22:36:47 s/identity an/identify an/
jiayl 2013/06/14 00:37:01 Done.
62 // |common_name| is the common name used to generate the certificate;
63 // |callback| is the callback to return the result.
64 void RequestIdentity(const GURL& origin,
65 const std::string& identity_name,
66 const std::string& common_name,
67 const CompletionCallback& callback,
68 RequestHandle* out_request);
69
70 protected:
71 explicit DTLSIdentityStore(
72 const scoped_refptr<base::TaskRunner>& task_runner);
73 virtual ~DTLSIdentityStore();
74
75 private:
76 friend class base::RefCounted<DTLSIdentityStore>;
77
78 void CancelRequest(DTLSIdentityRequest* request);
79
80 // The TaskRunner for doing work on a worker thread.
81 scoped_refptr<base::TaskRunner> task_runner_;
82
83 DISALLOW_COPY_AND_ASSIGN(DTLSIdentityStore);
84 };
85
86 } // namespace content
87
88 #endif // CONTENT_BROWSER_MEDIA_DTLS_IDENTITY_STORE_H_
OLDNEW
« 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