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..7926f2b42261acca1cbf0b71369b73f12403f6d7 |
--- /dev/null |
+++ b/content/renderer/media/dtls_identity_service.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/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, |
+ scoped_ptr<DTLSIdentityObserver>& observer) |
+ : origin_(origin) { |
+ DCHECK(observer); |
+ observer_.reset(observer.release()); |
Ryan Sleevi
2013/06/06 23:57:37
BUG: As mentioned before, you should be using Pass
|
+ RenderThread::Get()->AddObserver(this); |
+} |
+ |
+DTLSIdentityService::~DTLSIdentityService() { |
+ RenderThread::Get()->RemoveObserver(this); |
+} |
+ |
+void DTLSIdentityService::RequestIdentity(const std::string& identity_name, |
+ const std::string& common_name) { |
+ RenderThread::Get()->Send( |
+ new DTLSIdentityMsg_RequestIdentity(origin_, identity_name, common_name)); |
+ DLOG(INFO) << "DTLSIdentityService::RequestIdentity"; |
Ryan Sleevi
2013/06/06 23:57:37
Unnecessary
jiayl
2013/06/13 21:50:45
Done.
|
+} |
+ |
+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) |
Ryan Sleevi
2013/06/06 23:57:37
STYLE: Indents
jiayl
2013/06/13 21:50:45
Done.
|
+ IPC_END_MESSAGE_MAP() |
+ return handled; |
+} |
+ |
+void DTLSIdentityService::OnIdentityReady(const std::string& certificate, |
+ const std::string& private_key) { |
+ DLOG(INFO) << "DTLSIdentityService::OnIdentityReady"; |
Ryan Sleevi
2013/06/06 23:57:37
Unnecessary
jiayl
2013/06/13 21:50:45
Done.
|
+ observer_->OnCompleted(certificate, private_key); |
+} |
+ |
+} // namespace content |