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 |
| 6 #include "content/browser/renderer_host/media/dtls_identity_service_host.h" |
| 7 |
| 8 #include "base/bind.h" |
| 9 #include "content/common/media/dtls_identity_messages.h" |
| 10 |
| 11 |
| 12 namespace content { |
| 13 |
| 14 DTLSIdentityServiceHost::DTLSIdentityServiceHost() {} |
| 15 |
| 16 DTLSIdentityServiceHost::~DTLSIdentityServiceHost() {} |
| 17 |
| 18 bool DTLSIdentityServiceHost::OnMessageReceived(const IPC::Message& message, |
| 19 bool* message_was_ok) { |
| 20 bool handled = true; |
| 21 |
| 22 IPC_BEGIN_MESSAGE_MAP_EX(DTLSIdentityServiceHost, message, *message_was_ok) |
| 23 IPC_MESSAGE_HANDLER_DELAY_REPLY(DtlsIdentityMsg_GetOrGenerate, |
| 24 OnGetOrGenerateIdentity) |
| 25 IPC_MESSAGE_UNHANDLED(handled = false) |
| 26 IPC_END_MESSAGE_MAP_EX() |
| 27 return handled; |
| 28 } |
| 29 |
| 30 void DTLSIdentityServiceHost::OnGetOrGenerateIdentity( |
| 31 const GURL& url, |
| 32 const std::string& identity_name, |
| 33 const std::string& common_name, |
| 34 IPC::Message* message) { |
| 35 DTLSIdentityStore::GetInstance()->GetOrGenerateIdentity( |
| 36 url, identity_name, common_name, |
| 37 base::Bind(&DTLSIdentityServiceHost::OnComplete, this, message)); |
| 38 } |
| 39 |
| 40 void DTLSIdentityServiceHost::OnComplete( |
| 41 IPC::Message* message, |
| 42 const std::string& certificate, |
| 43 const std::string& private_key) const { |
| 44 DtlsIdentityMsg_GetOrGenerate::WriteReplyParams( |
| 45 message, certificate, private_key); |
| 46 } |
| 47 |
| 48 } // namespace content |
OLD | NEW |