OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_JSEP_H_ | |
6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_JSEP_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "base/gtest_prod_util.h" | |
13 #include "content/common/content_export.h" | |
14 #include "content/renderer/media/peer_connection_handler_base.h" | |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne
ction00Handler.h" | |
16 | |
17 // PeerConnectionHandlerJsep is a delegate for the JSEP PeerConnection API | |
18 // messages going between WebKit and native PeerConnection in libjingle. It's | |
19 // owned by WebKit. | |
20 class CONTENT_EXPORT PeerConnectionHandlerJsep | |
21 : public PeerConnectionHandlerBase, | |
22 NON_EXPORTED_BASE(public WebKit::WebPeerConnection00Handler) { | |
23 public: | |
24 PeerConnectionHandlerJsep( | |
25 WebKit::WebPeerConnection00HandlerClient* client, | |
26 MediaStreamImpl* msi, | |
27 MediaStreamDependencyFactory* dependency_factory); | |
28 virtual ~PeerConnectionHandlerJsep(); | |
29 | |
30 // WebKit::WebPeerConnection00Handler implementation | |
31 virtual void initialize( | |
32 const WebKit::WebString& server_configuration, | |
33 const WebKit::WebString& username) OVERRIDE; | |
34 virtual WebKit::WebSessionDescriptionDescriptor createOffer( | |
35 const WebKit::WebMediaHints& hints) OVERRIDE; | |
36 virtual WebKit::WebSessionDescriptionDescriptor createAnswer( | |
37 const WebKit::WebString& offer, | |
38 const WebKit::WebMediaHints& hints) OVERRIDE; | |
39 virtual bool setLocalDescription( | |
40 Action action, | |
41 const WebKit::WebSessionDescriptionDescriptor& description) OVERRIDE; | |
42 virtual bool setRemoteDescription( | |
43 Action action, | |
44 const WebKit::WebSessionDescriptionDescriptor& description) OVERRIDE; | |
45 virtual WebKit::WebSessionDescriptionDescriptor localDescription() OVERRIDE; | |
46 virtual WebKit::WebSessionDescriptionDescriptor remoteDescription() OVERRIDE; | |
47 virtual bool startIce(const WebKit::WebICEOptions& options) OVERRIDE; | |
48 virtual bool processIceMessage( | |
49 const WebKit::WebICECandidateDescriptor& candidate) OVERRIDE; | |
50 virtual void addStream( | |
51 const WebKit::WebMediaStreamDescriptor& stream) OVERRIDE; | |
52 virtual void removeStream( | |
53 const WebKit::WebMediaStreamDescriptor& stream) OVERRIDE; | |
54 // We will be deleted by WebKit after stop has been returned. | |
55 virtual void stop() OVERRIDE; | |
56 | |
57 // webrtc::PeerConnectionObserver implementation | |
58 virtual void OnError() OVERRIDE; | |
59 virtual void OnMessage(const std::string& msg) OVERRIDE; | |
60 virtual void OnSignalingMessage(const std::string& msg) OVERRIDE; | |
61 virtual void OnStateChange(StateType state_changed) OVERRIDE; | |
62 virtual void OnAddStream(webrtc::MediaStreamInterface* stream) OVERRIDE; | |
63 virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) OVERRIDE; | |
64 virtual void OnIceCandidate( | |
65 const webrtc::IceCandidateInterface* candidate) OVERRIDE; | |
66 virtual void OnIceComplete() OVERRIDE; | |
67 | |
68 private: | |
69 FRIEND_TEST_ALL_PREFIXES(PeerConnectionHandlerJsepTest, Basic); | |
70 | |
71 webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( | |
72 const WebKit::WebSessionDescriptionDescriptor& description); | |
73 WebKit::WebSessionDescriptionDescriptor CreateWebKitSessionDescription( | |
74 const webrtc::SessionDescriptionInterface* native_desc); | |
75 bool GetNativeAction( | |
76 const Action action, | |
77 webrtc::PeerConnectionInterface::Action* native_action); | |
78 | |
79 // client_ is a weak pointer, and is valid until stop() has returned. | |
80 WebKit::WebPeerConnection00HandlerClient* client_; | |
81 | |
82 DISALLOW_COPY_AND_ASSIGN(PeerConnectionHandlerJsep); | |
83 }; | |
84 | |
85 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_HANDLER_JSEP_H_ | |
OLD | NEW |