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_RENDERER_MEDIA_DTLS_IDENTITY_SERVICE_H_ | |
6 #define CONTENT_RENDERER_MEDIA_DTLS_IDENTITY_SERVICE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "content/public/renderer/render_process_observer.h" | |
13 #include "googleurl/src/gurl.h" | |
14 | |
15 namespace content { | |
16 | |
17 class DTLSIdentityObserver { | |
jam
2013/06/06 16:22:32
avoid single-method interfaces, and instead use a
jiayl
2013/06/06 17:07:37
This will be used in Libjingle which cannot use th
jam
2013/06/07 00:46:49
where exactly will the calling code be? because an
| |
18 public: | |
19 virtual ~DTLSIdentityObserver() {} | |
20 virtual void OnCompleted(const std::string& certificate, | |
21 const std::string& private_key) = 0; | |
22 }; | |
23 | |
24 // This class handles DTLS identity requests by sending IPC messages to the | |
25 // browser process. | |
26 // TODO: implement webrtc::DTLSIdentityServiceInterface from Libjingle. | |
27 class DTLSIdentityService : public RenderProcessObserver { | |
28 public: | |
29 // |observer| is owned by DTLSIdentityService. | |
30 DTLSIdentityService(const GURL& origin, | |
31 DTLSIdentityObserver* observer); | |
32 virtual ~DTLSIdentityService(); | |
33 | |
34 // RenderProcessObserver implementation. | |
35 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | |
jam
2013/06/06 16:22:33
nit: put this in the private section
jiayl
2013/06/06 17:07:37
Done.
| |
36 | |
37 // Called on the renderer main thread to get the DTLS identity or generate a | |
jam
2013/06/06 16:22:33
nit: by default, code in the renderer runs on the
jiayl
2013/06/06 17:07:37
Done.
| |
38 // new one if not existent. | |
39 // |identity_name| is used to identity an identity within an origin. | |
40 // |common_name| is the common name used to generated the certificate. | |
41 virtual void GetOrGenerateIdentity(const std::string& identity_name, | |
42 const std::string& common_name); | |
jam
2013/06/06 16:22:33
why is this virtual?
jiayl
2013/06/06 17:07:37
This class will implement a Libjingle interface wh
jam
2013/06/07 00:46:49
ok, when that happens make this class virtual, unt
| |
43 | |
44 private: | |
45 void OnIdentityReady(const std::string& certificate, | |
46 const std::string& private_key); | |
47 | |
48 // The origin of the PeerConnection which owns this DTLSIdentityService. | |
49 GURL origin_; | |
50 scoped_ptr<DTLSIdentityObserver> observer_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(DTLSIdentityService); | |
53 }; | |
54 | |
55 } // namespace content | |
56 | |
57 #endif // CONTENT_RENDERER_MEDIA_DTLS_IDENTITY_SERVICE_H_ | |
OLD | NEW |