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 #include "content/renderer/media/dtls_identity_service.h" | |
6 | |
7 #include "content/common/media/dtls_identity_messages.h" | |
8 #include "content/public/renderer/render_thread.h" | |
9 | |
10 namespace content { | |
11 | |
12 DTLSIdentityService::DTLSIdentityService( | |
13 const GURL& origin, | |
14 scoped_ptr<DTLSIdentityObserver>& observer) | |
15 : origin_(origin) { | |
16 DCHECK(observer); | |
17 observer_.reset(observer.release()); | |
Ryan Sleevi
2013/06/06 23:57:37
BUG: As mentioned before, you should be using Pass
| |
18 RenderThread::Get()->AddObserver(this); | |
19 } | |
20 | |
21 DTLSIdentityService::~DTLSIdentityService() { | |
22 RenderThread::Get()->RemoveObserver(this); | |
23 } | |
24 | |
25 void DTLSIdentityService::RequestIdentity(const std::string& identity_name, | |
26 const std::string& common_name) { | |
27 RenderThread::Get()->Send( | |
28 new DTLSIdentityMsg_RequestIdentity(origin_, identity_name, common_name)); | |
29 DLOG(INFO) << "DTLSIdentityService::RequestIdentity"; | |
Ryan Sleevi
2013/06/06 23:57:37
Unnecessary
jiayl
2013/06/13 21:50:45
Done.
| |
30 } | |
31 | |
32 bool DTLSIdentityService::OnControlMessageReceived( | |
33 const IPC::Message& message) { | |
34 bool handled = true; | |
35 IPC_BEGIN_MESSAGE_MAP(DTLSIdentityService, message) | |
36 IPC_MESSAGE_HANDLER(DTLSIdentityHostMsg_IdentityReady, OnIdentityReady) | |
37 IPC_MESSAGE_UNHANDLED(handled = false) | |
Ryan Sleevi
2013/06/06 23:57:37
STYLE: Indents
jiayl
2013/06/13 21:50:45
Done.
| |
38 IPC_END_MESSAGE_MAP() | |
39 return handled; | |
40 } | |
41 | |
42 void DTLSIdentityService::OnIdentityReady(const std::string& certificate, | |
43 const std::string& private_key) { | |
44 DLOG(INFO) << "DTLSIdentityService::OnIdentityReady"; | |
Ryan Sleevi
2013/06/06 23:57:37
Unnecessary
jiayl
2013/06/13 21:50:45
Done.
| |
45 observer_->OnCompleted(certificate, private_key); | |
46 } | |
47 | |
48 } // namespace content | |
OLD | NEW |