Index: content/browser/renderer_host/media/dtls_identity_service_host.cc |
diff --git a/content/browser/renderer_host/media/dtls_identity_service_host.cc b/content/browser/renderer_host/media/dtls_identity_service_host.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ea958c9547c389823f3baa418c9187f688ba26fb |
--- /dev/null |
+++ b/content/browser/renderer_host/media/dtls_identity_service_host.cc |
@@ -0,0 +1,48 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+ |
+#include "content/browser/renderer_host/media/dtls_identity_service_host.h" |
+ |
+#include "base/bind.h" |
+#include "content/common/media/dtls_identity_messages.h" |
+ |
+ |
+namespace content { |
+ |
+DTLSIdentityServiceHost::DTLSIdentityServiceHost() {} |
+ |
+DTLSIdentityServiceHost::~DTLSIdentityServiceHost() {} |
+ |
+bool DTLSIdentityServiceHost::OnMessageReceived(const IPC::Message& message, |
+ bool* message_was_ok) { |
+ bool handled = true; |
+ |
+ IPC_BEGIN_MESSAGE_MAP_EX(DTLSIdentityServiceHost, message, *message_was_ok) |
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(DtlsIdentityMsg_GetOrGenerate, |
+ OnGetOrGenerateIdentity) |
+ IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_END_MESSAGE_MAP_EX() |
+ return handled; |
+} |
+ |
+void DTLSIdentityServiceHost::OnGetOrGenerateIdentity( |
+ const GURL& url, |
+ const std::string& identity_name, |
+ const std::string& common_name, |
+ IPC::Message* message) { |
+ DTLSIdentityStore::GetInstance()->GetOrGenerateIdentity( |
+ url, identity_name, common_name, |
+ base::Bind(&DTLSIdentityServiceHost::OnComplete, this, message)); |
+} |
+ |
+void DTLSIdentityServiceHost::OnComplete( |
+ IPC::Message* message, |
+ const std::string& certificate, |
+ const std::string& private_key) const { |
+ DtlsIdentityMsg_GetOrGenerate::WriteReplyParams( |
+ message, certificate, private_key); |
+} |
+ |
+} // namespace content |