| Index: talk/app/webrtc/webrtcsessiondescriptionfactory.h
|
| diff --git a/talk/app/webrtc/webrtcsessiondescriptionfactory.h b/talk/app/webrtc/webrtcsessiondescriptionfactory.h
|
| index 5d91a61dbbe1d699becdd964d1f990034bf6c737..bb4d78cfc8fcbfc97a330ee91ca94b232af4afc1 100644
|
| --- a/talk/app/webrtc/webrtcsessiondescriptionfactory.h
|
| +++ b/talk/app/webrtc/webrtcsessiondescriptionfactory.h
|
| @@ -28,6 +28,7 @@
|
| #ifndef TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
|
| #define TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
|
|
|
| +#include "talk/app/webrtc/dtlscertificate.h"
|
| #include "talk/app/webrtc/dtlsidentitystore.h"
|
| #include "talk/app/webrtc/peerconnectioninterface.h"
|
| #include "talk/session/media/mediasession.h"
|
| @@ -57,7 +58,8 @@ class WebRtcIdentityRequestObserver : public DtlsIdentityRequestObserver,
|
| void OnSuccess(rtc::scoped_ptr<rtc::SSLIdentity> identity) override;
|
|
|
| sigslot::signal1<int> SignalRequestFailed;
|
| - sigslot::signal1<rtc::SSLIdentity*> SignalIdentityReady;
|
| + sigslot::signal1<const rtc::scoped_refptr<DtlsCertificate>&>
|
| + SignalCertificateReady;
|
| };
|
|
|
| struct CreateSessionDescriptionRequest {
|
| @@ -87,16 +89,38 @@ struct CreateSessionDescriptionRequest {
|
| class WebRtcSessionDescriptionFactory : public rtc::MessageHandler,
|
| public sigslot::has_slots<> {
|
| public:
|
| + // Construct with DTLS disabled.
|
| + WebRtcSessionDescriptionFactory(
|
| + rtc::Thread* signaling_thread,
|
| + rtc::Thread* worker_thread,
|
| + cricket::ChannelManager* channel_manager,
|
| + MediaStreamSignaling* mediastream_signaling,
|
| + WebRtcSession* session,
|
| + const std::string& session_id,
|
| + cricket::DataChannelType dct);
|
| + // Construct with DTLS enabled. If a |dtls_identity_service| is provided, it
|
| + // is used to generate a certificate, otherwise a default service is used.
|
| WebRtcSessionDescriptionFactory(
|
| rtc::Thread* signaling_thread,
|
| + rtc::Thread* worker_thread,
|
| cricket::ChannelManager* channel_manager,
|
| MediaStreamSignaling* mediastream_signaling,
|
| rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
|
| // TODO(jiayl): remove the dependency on session once bug 2264 is fixed.
|
| WebRtcSession* session,
|
| const std::string& session_id,
|
| - cricket::DataChannelType dct,
|
| - bool dtls_enabled);
|
| + cricket::DataChannelType dct);
|
| + // Construct with DTLS enabled using the specified (already generated)
|
| + // certificate.
|
| + WebRtcSessionDescriptionFactory(
|
| + rtc::Thread* signaling_thread,
|
| + rtc::Thread* worker_thread,
|
| + cricket::ChannelManager* channel_manager,
|
| + MediaStreamSignaling* mediastream_signaling,
|
| + const rtc::scoped_refptr<DtlsCertificate>& certificate,
|
| + WebRtcSession* session,
|
| + const std::string& session_id,
|
| + cricket::DataChannelType dct);
|
| virtual ~WebRtcSessionDescriptionFactory();
|
|
|
| static void CopyCandidatesFromSessionDescription(
|
| @@ -113,21 +137,32 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler,
|
| void SetSdesPolicy(cricket::SecurePolicy secure_policy);
|
| cricket::SecurePolicy SdesPolicy() const;
|
|
|
| - sigslot::signal1<rtc::SSLIdentity*> SignalIdentityReady;
|
| + sigslot::signal1<const rtc::scoped_refptr<DtlsCertificate>&>
|
| + SignalCertificateReady;
|
|
|
| // For testing.
|
| - bool waiting_for_identity() const {
|
| - return identity_request_state_ == IDENTITY_WAITING;
|
| + bool waiting_for_certificate() const {
|
| + return certificate_request_state_ == CERTIFICATE_WAITING;
|
| }
|
|
|
| private:
|
| - enum IdentityRequestState {
|
| - IDENTITY_NOT_NEEDED,
|
| - IDENTITY_WAITING,
|
| - IDENTITY_SUCCEEDED,
|
| - IDENTITY_FAILED,
|
| + enum CertificateRequestState {
|
| + CERTIFICATE_NOT_NEEDED,
|
| + CERTIFICATE_WAITING,
|
| + CERTIFICATE_SUCCEEDED,
|
| + CERTIFICATE_FAILED,
|
| };
|
|
|
| + WebRtcSessionDescriptionFactory(
|
| + rtc::Thread* signaling_thread,
|
| + rtc::Thread* worker_thread,
|
| + cricket::ChannelManager* channel_manager,
|
| + MediaStreamSignaling* mediastream_signaling,
|
| + WebRtcSession* session,
|
| + const std::string& session_id,
|
| + cricket::DataChannelType dct,
|
| + bool dtls_enabled);
|
| +
|
| // MessageHandler implementation.
|
| virtual void OnMessage(rtc::Message* msg);
|
|
|
| @@ -143,21 +178,23 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler,
|
| SessionDescriptionInterface* description);
|
|
|
| void OnIdentityRequestFailed(int error);
|
| - void SetIdentity(rtc::SSLIdentity* identity);
|
| + void SetCertificate(const rtc::scoped_refptr<DtlsCertificate>& certificate);
|
|
|
| std::queue<CreateSessionDescriptionRequest>
|
| create_session_description_requests_;
|
| rtc::Thread* const signaling_thread_;
|
| + rtc::Thread* const worker_thread_;
|
| MediaStreamSignaling* const mediastream_signaling_;
|
| cricket::TransportDescriptionFactory transport_desc_factory_;
|
| cricket::MediaSessionDescriptionFactory session_desc_factory_;
|
| uint64 session_version_;
|
| rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store_;
|
| rtc::scoped_refptr<WebRtcIdentityRequestObserver> identity_request_observer_;
|
| + // TODO(jiayl): remove the dependency on session once b/10226852 is fixed.
|
| WebRtcSession* const session_;
|
| const std::string session_id_;
|
| const cricket::DataChannelType data_channel_type_;
|
| - IdentityRequestState identity_request_state_;
|
| + CertificateRequestState certificate_request_state_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(WebRtcSessionDescriptionFactory);
|
| };
|
|
|