Index: content/renderer/media/dtls_identity_service.cc |
diff --git a/content/renderer/media/dtls_identity_service.cc b/content/renderer/media/dtls_identity_service.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c8d65e8d2857702d024d1f9ed50d2fce4808ec2 |
--- /dev/null |
+++ b/content/renderer/media/dtls_identity_service.cc |
@@ -0,0 +1,56 @@ |
+// 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/renderer/media/dtls_identity_service.h" |
+ |
+#include "content/common/media/dtls_identity_messages.h" |
+#include "content/public/renderer/render_thread.h" |
+ |
+namespace content { |
+ |
+DTLSIdentityService::DTLSIdentityService( |
+ const GURL& origin, |
+ talk_base::scoped_ptr<DTLSIdentityObserver>& observer) |
+ : origin_(origin) { |
+ DCHECK(observer); |
+ observer_.reset(observer.release()); |
+} |
+ |
+DTLSIdentityService::~DTLSIdentityService() { |
+ GetRenderThread()->RemoveObserver(this); |
+} |
+ |
+void DTLSIdentityService::Initialize() { |
+ 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.
|
+} |
+ |
+void DTLSIdentityService::RequestIdentity( |
+ const std::string& identity_name, |
+ const std::string& common_name) { |
+ GetRenderThread()->Send( |
+ new DTLSIdentityMsg_RequestIdentity(origin_, identity_name, common_name)); |
+ DLOG(INFO) << "DTLSIdentityService::RequestIdentity"; |
+} |
+ |
+RenderThread* DTLSIdentityService::GetRenderThread() { |
+ return RenderThread::Get(); |
+} |
+ |
+bool DTLSIdentityService::OnControlMessageReceived( |
+ const IPC::Message& message) { |
+ bool handled = true; |
+ IPC_BEGIN_MESSAGE_MAP(DTLSIdentityService, message) |
+ IPC_MESSAGE_HANDLER(DTLSIdentityHostMsg_IdentityReady, OnIdentityReady) |
+ IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_END_MESSAGE_MAP() |
+ return handled; |
+} |
+ |
+void DTLSIdentityService::OnIdentityReady(const std::string& certificate, |
+ const std::string& private_key) { |
+ DLOG(INFO) << "DTLSIdentityService::OnIdentityReady"; |
+ observer_->OnCompleted(certificate, private_key); |
+} |
+ |
+} // namespace content |