Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2455)

Unified Diff: content/renderer/media/dtls_identity_service.cc

Issue 15969025: Generates the DTLS identity in browser process and returns it to render process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..246604a38303a8bab4cb11c4c6b98cda7a9a47a2
--- /dev/null
+++ b/content/renderer/media/dtls_identity_service.cc
@@ -0,0 +1,44 @@
+// 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/renderer/render_thread_impl.h"
+
+namespace content {
+
+DTLSIdentityService::DTLSIdentityService(
+ const GURL& origin,
+ DTLSIdentityObserver* observer)
+ : origin_(origin) {
+ DCHECK(observer);
+ observer_.reset(observer);
+}
+
+DTLSIdentityService::~DTLSIdentityService() {}
+
+void DTLSIdentityService::GetOrGenerateIdentity(
+ const std::string& identity_name,
+ const std::string& common_name) {
+ RenderThreadImpl::current()->Send(
+ new DTLSIdentityMsg_GetOrGenerate(origin_, identity_name, common_name));
+}
+
+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,
Ami GONE FROM CHROMIUM 2013/06/06 18:28:51 Is it ok that libjingle will ask for the identity
jiayl 2013/06/06 21:00:08 The callback is always called on the render thread
+ const std::string& private_key) {
+ observer_->OnCompleted(certificate, private_key);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698