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

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: 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..7d07c5f796b1e06d905ae225decde3e8c6edc900
--- /dev/null
+++ b/content/renderer/media/dtls_identity_service.h
@@ -0,0 +1,64 @@
+// 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 "content/public/renderer/render_process_observer.h"
+#include "googleurl/src/gurl.h"
+#include "third_party/libjingle/source/talk/base/scoped_ptr.h"
Ami GONE FROM CHROMIUM 2013/06/06 21:33:04 unnecessary see below
jiayl 2013/06/06 22:53:39 Done.
+
+namespace content {
+
+class RenderThread;
+
+// TODO (jiayl): Move it to Libjingle and implement it there.
+class DTLSIdentityObserver {
+ 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 {
+ public:
+ DTLSIdentityService(const GURL& origin,
+ talk_base::scoped_ptr<DTLSIdentityObserver>& observer);
Ami GONE FROM CHROMIUM 2013/06/06 21:33:04 the ctor is not part of the interface, so can be p
jiayl 2013/06/06 22:53:39 Done.
+ virtual ~DTLSIdentityService();
+
+ void Initialize();
+
+ // Request a DTLS identity. A new one will be gernerated 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 RequestIdentity(const std::string& identity_name,
+ const std::string& common_name);
+
+ protected:
+ virtual RenderThread* GetRenderThread();
Ami GONE FROM CHROMIUM 2013/06/06 21:33:04 Comment this is protected for testing.
jiayl 2013/06/06 22:53:39 removed.
+
+ 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_;
+ talk_base::scoped_ptr<DTLSIdentityObserver> observer_;
Ami GONE FROM CHROMIUM 2013/06/06 21:33:04 ditto above
jiayl 2013/06/06 22:53:39 Done.
+ RenderThread* render_thread_;
Ami GONE FROM CHROMIUM 2013/06/06 21:33:04 unused
jiayl 2013/06/06 22:53:39 removed
+
+ DISALLOW_COPY_AND_ASSIGN(DTLSIdentityService);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_DTLS_IDENTITY_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698