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 talk_base::scoped_ptr<DTLSIdentityObserver>& observer) | |
15 : origin_(origin) { | |
16 DCHECK(observer); | |
17 observer_.reset(observer.release()); | |
18 } | |
19 | |
20 DTLSIdentityService::~DTLSIdentityService() { | |
21 GetRenderThread()->RemoveObserver(this); | |
22 } | |
23 | |
24 void DTLSIdentityService::Initialize() { | |
25 GetRenderThread()->AddObserver(this); | |
Ami GONE FROM CHROMIUM
2013/06/06 21:33:04
Why not in ctor?
jiayl
2013/06/06 22:53:39
because GetRenderThread was virtual. now removed.
| |
26 } | |
27 | |
28 void DTLSIdentityService::RequestIdentity( | |
29 const std::string& identity_name, | |
30 const std::string& common_name) { | |
31 GetRenderThread()->Send( | |
32 new DTLSIdentityMsg_RequestIdentity(origin_, identity_name, common_name)); | |
33 DLOG(INFO) << "DTLSIdentityService::RequestIdentity"; | |
34 } | |
35 | |
36 RenderThread* DTLSIdentityService::GetRenderThread() { | |
37 return RenderThread::Get(); | |
38 } | |
39 | |
40 bool DTLSIdentityService::OnControlMessageReceived( | |
41 const IPC::Message& message) { | |
42 bool handled = true; | |
43 IPC_BEGIN_MESSAGE_MAP(DTLSIdentityService, message) | |
44 IPC_MESSAGE_HANDLER(DTLSIdentityHostMsg_IdentityReady, OnIdentityReady) | |
45 IPC_MESSAGE_UNHANDLED(handled = false) | |
46 IPC_END_MESSAGE_MAP() | |
47 return handled; | |
48 } | |
49 | |
50 void DTLSIdentityService::OnIdentityReady(const std::string& certificate, | |
51 const std::string& private_key) { | |
52 DLOG(INFO) << "DTLSIdentityService::OnIdentityReady"; | |
53 observer_->OnCompleted(certificate, private_key); | |
54 } | |
55 | |
56 } // namespace content | |
OLD | NEW |