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

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

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.h
diff --git a/content/renderer/media/dtls_identity_service.h b/content/renderer/media/dtls_identity_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..ee72d36831f527bf292a7e06f2e324769194d1f0
--- /dev/null
+++ b/content/renderer/media/dtls_identity_service.h
@@ -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.
+
+#ifndef CONTENT_RENDERER_MEDIA_DTLS_IDENTITY_SERVICE_H_
+#define CONTENT_RENDERER_MEDIA_DTLS_IDENTITY_SERVICE_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/renderer/render_process_observer.h"
+#include "googleurl/src/gurl.h"
+
+namespace content {
+
+class DTLSIdentityObserver {
Ami GONE FROM CHROMIUM 2013/06/06 18:28:51 Comment this is here only temporarily until it mov
jiayl 2013/06/06 21:00:08 Done.
jiayl 2013/06/06 21:00:08 Done.
+ public:
+ virtual ~DTLSIdentityObserver() {}
+ virtual void OnCompleted(const std::string& certificate,
+ const std::string& private_key) = 0;
+};
+
+// This class handles DTLS identity requests by sending IPC messages to the
+// browser process.
+// TODO: implement webrtc::DTLSIdentityServiceInterface from Libjingle.
+class DTLSIdentityService : public RenderProcessObserver {
Ami GONE FROM CHROMIUM 2013/06/06 18:28:51 How is this working without calling RenderThread()
jiayl 2013/06/06 21:00:08 Oops, added these calls. I'm not sure how to test
+ public:
+ // |observer| is owned by DTLSIdentityService.
Ami GONE FROM CHROMIUM 2013/06/06 18:28:51 Passing by scoped_ptr would allow the compiler to
jiayl 2013/06/06 21:00:08 Done.
jiayl 2013/06/06 21:00:08 Done.
+ DTLSIdentityService(const GURL& origin,
+ DTLSIdentityObserver* observer);
+ virtual ~DTLSIdentityService();
+
+ // Get the DTLS identity or generate a new one if not existent.
+ // |identity_name| is used to identity an identity within an origin.
+ // |common_name| is the common name used to generated the certificate.
+ virtual void GetOrGenerateIdentity(const std::string& identity_name,
Ami GONE FROM CHROMIUM 2013/06/06 18:28:51 nit: name & comment still sound synchronous. s/Get
jiayl 2013/06/06 21:00:08 Done.
jiayl 2013/06/06 21:00:08 Done.
+ const std::string& common_name);
+
+ private:
+ // RenderProcessObserver implementation.
+ virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ void OnIdentityReady(const std::string& certificate,
+ const std::string& private_key);
+
+ // The origin of the PeerConnection which owns this DTLSIdentityService.
+ GURL origin_;
+ scoped_ptr<DTLSIdentityObserver> observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(DTLSIdentityService);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_DTLS_IDENTITY_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698