Chromium Code Reviews| 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..66fc1cac882dde016a354db492bcdb445930651d |
| --- /dev/null |
| +++ b/content/renderer/media/dtls_identity_service.h |
| @@ -0,0 +1,57 @@ |
| +// 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 { |
|
jam
2013/06/06 16:22:32
avoid single-method interfaces, and instead use a
jiayl
2013/06/06 17:07:37
This will be used in Libjingle which cannot use th
jam
2013/06/07 00:46:49
where exactly will the calling code be? because an
|
| + 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: |
| + // |observer| is owned by DTLSIdentityService. |
| + DTLSIdentityService(const GURL& origin, |
| + DTLSIdentityObserver* observer); |
| + virtual ~DTLSIdentityService(); |
| + |
| + // RenderProcessObserver implementation. |
| + virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
|
jam
2013/06/06 16:22:33
nit: put this in the private section
jiayl
2013/06/06 17:07:37
Done.
|
| + |
| + // Called on the renderer main thread to get the DTLS identity or generate a |
|
jam
2013/06/06 16:22:33
nit: by default, code in the renderer runs on the
jiayl
2013/06/06 17:07:37
Done.
|
| + // 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, |
| + const std::string& common_name); |
|
jam
2013/06/06 16:22:33
why is this virtual?
jiayl
2013/06/06 17:07:37
This class will implement a Libjingle interface wh
jam
2013/06/07 00:46:49
ok, when that happens make this class virtual, unt
|
| + |
| + private: |
| + 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_ |