| Index: talk/app/webrtc/webrtcsessiondescriptionfactory.h
|
| diff --git a/talk/app/webrtc/webrtcsessiondescriptionfactory.h b/talk/app/webrtc/webrtcsessiondescriptionfactory.h
|
| index 860532dec93e56253f09b95bab031ab2df477e44..33b43ca424ff378ff750cecb9fafbef2d1c84448 100644
|
| --- a/talk/app/webrtc/webrtcsessiondescriptionfactory.h
|
| +++ b/talk/app/webrtc/webrtcsessiondescriptionfactory.h
|
| @@ -28,6 +28,8 @@
|
| #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 "webrtc/p2p/base/transportdescriptionfactory.h"
|
| #include "talk/session/media/mediasession.h"
|
| @@ -57,7 +59,7 @@ class WebRtcIdentityRequestObserver : public DTLSIdentityRequestObserver,
|
| rtc::scoped_ptr<rtc::SSLIdentity> identity) override;
|
|
|
| sigslot::signal1<int> SignalRequestFailed;
|
| - sigslot::signal1<rtc::SSLIdentity*> SignalIdentityReady;
|
| + sigslot::signal1<rtc::scoped_refptr<DtlsCertificate>> SignalCertificateReady;
|
| };
|
|
|
| struct CreateSessionDescriptionRequest {
|
| @@ -87,16 +89,37 @@ 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,
|
| DTLSIdentityServiceInterface* dtls_identity_service,
|
| - // TODO(jiayl): remove the dependency on session once b/10226852 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,
|
| + rtc::scoped_refptr<DtlsCertificate> certificate,
|
| + WebRtcSession* session,
|
| + const std::string& session_id,
|
| + cricket::DataChannelType dct);
|
| virtual ~WebRtcSessionDescriptionFactory();
|
|
|
| static void CopyCandidatesFromSessionDescription(
|
| @@ -113,21 +136,31 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler,
|
| void SetSdesPolicy(cricket::SecurePolicy secure_policy);
|
| cricket::SecurePolicy SdesPolicy() const;
|
|
|
| - sigslot::signal1<rtc::SSLIdentity*> SignalIdentityReady;
|
| + sigslot::signal1<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 +176,24 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler,
|
| SessionDescriptionInterface* description);
|
|
|
| void OnIdentityRequestFailed(int error);
|
| - void SetIdentity(rtc::SSLIdentity* identity);
|
| + void SetCertificate(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<DtlsIdentityStore> identity_store_;
|
| rtc::scoped_ptr<DTLSIdentityServiceInterface> identity_service_;
|
| 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);
|
| };
|
|
|