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/browser/renderer_host/media/dtls_identity_service_host.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "content/browser/media/dtls_identity_store.h" |
| 9 #include "content/common/media/dtls_identity_messages.h" |
| 10 #include "content/public/browser/render_process_host.h" |
| 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 IPC_BEGIN_MESSAGE_MAP_EX(DTLSIdentityServiceHost, message, *message_was_ok) |
| 22 IPC_MESSAGE_HANDLER(DTLSIdentityMsg_RequestIdentity, OnRequestIdentity) |
| 23 IPC_MESSAGE_UNHANDLED(handled = false) |
| 24 IPC_END_MESSAGE_MAP_EX() |
| 25 return handled; |
| 26 } |
| 27 |
| 28 void DTLSIdentityServiceHost::OnRequestIdentity( |
| 29 const GURL& origin, |
| 30 const std::string& identity_name, |
| 31 const std::string& common_name) { |
| 32 DLOG(INFO) << "Sent identity request to DTLSIdentityStore with " |
| 33 << "origin = " << origin.spec() << ", " |
| 34 << "identity_name = " << identity_name << ", " |
| 35 << "common_name = " << common_name << "."; |
| 36 |
| 37 DTLSIdentityStore::GetInstance()->RequestIdentity( |
| 38 origin, |
| 39 identity_name, |
| 40 common_name, |
| 41 base::Bind(&DTLSIdentityServiceHost::OnComplete, this)); |
| 42 } |
| 43 |
| 44 void DTLSIdentityServiceHost::OnComplete( |
| 45 const std::string& certificate, |
| 46 const std::string& private_key) { |
| 47 DLOG(INFO) << "DTLSIdentityServiceHost::OnComplete"; |
| 48 Send(new DTLSIdentityHostMsg_IdentityReady(certificate, private_key)); |
| 49 } |
| 50 |
| 51 } // namespace content |
OLD | NEW |