| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_IDENTITY_SERVICE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_IDENTITY_SERVICE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_IDENTITY_SERVICE_H_ | 6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_IDENTITY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "content/public/renderer/render_process_observer.h" | 11 #include "content/public/renderer/render_process_observer.h" |
| 12 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" | 12 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 // This class is associated with a peer connection and handles WebRTC DTLS | 17 // This class is associated with a peer connection and handles WebRTC DTLS |
| 18 // identity requests by delegating to the per-renderer WebRTCIdentityProxy. | 18 // identity requests by delegating to the per-renderer WebRTCIdentityProxy. |
| 19 class PeerConnectionIdentityService | 19 class PeerConnectionIdentityService |
| 20 : public webrtc::DTLSIdentityServiceInterface { | 20 : public webrtc::DTLSIdentityServiceInterface { |
| 21 public: | 21 public: |
| 22 explicit PeerConnectionIdentityService(const GURL& origin); | 22 static PeerConnectionIdentityService* Create(const GURL& origin); |
| 23 |
| 23 virtual ~PeerConnectionIdentityService(); | 24 virtual ~PeerConnectionIdentityService(); |
| 24 | 25 |
| 25 // webrtc::DTLSIdentityServiceInterface implementation. | 26 // webrtc::DTLSIdentityServiceInterface implementation. |
| 26 virtual bool RequestIdentity( | 27 virtual bool RequestIdentity( |
| 27 const std::string& identity_name, | 28 const std::string& identity_name, |
| 28 const std::string& common_name, | 29 const std::string& common_name, |
| 29 webrtc::DTLSIdentityRequestObserver* observer) OVERRIDE; | 30 webrtc::DTLSIdentityRequestObserver* observer) OVERRIDE; |
| 30 | 31 |
| 31 private: | 32 private: |
| 33 explicit PeerConnectionIdentityService(const GURL& origin); |
| 34 |
| 32 void OnIdentityReady(const std::string& certificate, | 35 void OnIdentityReady(const std::string& certificate, |
| 33 const std::string& private_key); | 36 const std::string& private_key); |
| 34 void OnRequestFailed(int error); | 37 void OnRequestFailed(int error); |
| 35 | 38 |
| 36 void ResetPendingRequest(); | 39 void ResetPendingRequest(); |
| 37 | 40 |
| 38 // The origin of the DTLS connection. | 41 // The origin of the DTLS connection. |
| 39 GURL origin_; | 42 GURL origin_; |
| 40 talk_base::scoped_refptr<webrtc::DTLSIdentityRequestObserver> | 43 talk_base::scoped_refptr<webrtc::DTLSIdentityRequestObserver> |
| 41 pending_observer_; | 44 pending_observer_; |
| 42 int pending_request_id_; | 45 int pending_request_id_; |
| 43 | 46 |
| 44 DISALLOW_COPY_AND_ASSIGN(PeerConnectionIdentityService); | 47 DISALLOW_COPY_AND_ASSIGN(PeerConnectionIdentityService); |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 } // namespace content | 50 } // namespace content |
| 48 | 51 |
| 49 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_IDENTITY_SERVICE_H_ | 52 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_IDENTITY_SERVICE_H_ |
| OLD | NEW |