Chromium Code Reviews| 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..1b26c804bf3ab3d7467b28233218ef18c09e3ee9 |
| --- /dev/null |
| +++ b/content/browser/renderer_host/media/dtls_identity_service_host.cc |
| @@ -0,0 +1,50 @@ |
| +// 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/browser/media/dtls_identity_store.h" |
| +#include "content/common/media/dtls_identity_messages.h" |
| +#include "content/public/browser/render_process_host.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(DTLSIdentityMsg_RequestIdentity, OnRequestIdentity) |
| + IPC_MESSAGE_UNHANDLED(handled = false) |
| + IPC_END_MESSAGE_MAP_EX() |
|
Ryan Sleevi
2013/06/06 23:57:37
STYLE: Indent the IPC_MESSAGE_[UN]HAN* two spaces,
jiayl
2013/06/13 21:50:45
Done.
|
| + return handled; |
| +} |
| + |
| +void DTLSIdentityServiceHost::OnRequestIdentity( |
| + const GURL& origin, |
| + const std::string& identity_name, |
| + const std::string& common_name) { |
| + DLOG(INFO) << "Sent identity request to DTLSIdentityStore with " |
| + << "origin = " << origin.spec() << ", " |
| + << "identity_name = " << identity_name << ", " |
| + << "common_name = " << common_name << "."; |
|
Ryan Sleevi
2013/06/06 23:57:37
STYLE: Don't log all this.
jiayl
2013/06/13 21:50:45
Done.
|
| + |
| + DTLSIdentityStore::GetInstance()->RequestIdentity( |
| + origin, |
| + identity_name, |
| + common_name, |
| + base::Bind(&DTLSIdentityServiceHost::OnComplete, this)); |
| +} |
| + |
| +void DTLSIdentityServiceHost::OnComplete(const std::string& certificate, |
| + const std::string& private_key) { |
| + DLOG(INFO) << "DTLSIdentityServiceHost::OnComplete"; |
| + Send(new DTLSIdentityHostMsg_IdentityReady(certificate, private_key)); |
| +} |
| + |
| +} // namespace content |