| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_RTC_DATA_CHANNEL_HANDLER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ | 6 #define CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" | 11 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" |
| 12 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h" | 12 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h" |
| 13 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" | 13 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 // RtcDataChannelHandler is a delegate for the RTC PeerConnection DataChannel | 17 // RtcDataChannelHandler is a delegate for the RTC PeerConnection DataChannel |
| 18 // API messages going between WebKit and native PeerConnection DataChannels in | 18 // API messages going between WebKit and native PeerConnection DataChannels in |
| 19 // libjingle. Instances of this class are owned by WebKit. | 19 // libjingle. Instances of this class are owned by WebKit. |
| 20 // WebKit call all of these methods on the main render thread. | 20 // WebKit call all of these methods on the main render thread. |
| 21 // Callbacks to the webrtc::DataChannelObserver implementation also occur on | 21 // Callbacks to the webrtc::DataChannelObserver implementation also occur on |
| 22 // the main render thread. | 22 // the main render thread. |
| 23 class CONTENT_EXPORT RtcDataChannelHandler | 23 class CONTENT_EXPORT RtcDataChannelHandler |
| 24 : NON_EXPORTED_BASE(public WebKit::WebRTCDataChannelHandler), | 24 : NON_EXPORTED_BASE(public blink::WebRTCDataChannelHandler), |
| 25 NON_EXPORTED_BASE(public webrtc::DataChannelObserver), | 25 NON_EXPORTED_BASE(public webrtc::DataChannelObserver), |
| 26 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 26 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 27 public: | 27 public: |
| 28 explicit RtcDataChannelHandler(webrtc::DataChannelInterface* channel); | 28 explicit RtcDataChannelHandler(webrtc::DataChannelInterface* channel); |
| 29 virtual ~RtcDataChannelHandler(); | 29 virtual ~RtcDataChannelHandler(); |
| 30 | 30 |
| 31 // WebKit::WebRTCDataChannelHandler implementation. | 31 // blink::WebRTCDataChannelHandler implementation. |
| 32 virtual void setClient( | 32 virtual void setClient( |
| 33 WebKit::WebRTCDataChannelHandlerClient* client) OVERRIDE; | 33 blink::WebRTCDataChannelHandlerClient* client) OVERRIDE; |
| 34 virtual WebKit::WebString label() OVERRIDE; | 34 virtual blink::WebString label() OVERRIDE; |
| 35 virtual bool isReliable() OVERRIDE; | 35 virtual bool isReliable() OVERRIDE; |
| 36 virtual bool ordered() const OVERRIDE; | 36 virtual bool ordered() const OVERRIDE; |
| 37 virtual unsigned short maxRetransmitTime() const OVERRIDE; | 37 virtual unsigned short maxRetransmitTime() const OVERRIDE; |
| 38 virtual unsigned short maxRetransmits() const OVERRIDE; | 38 virtual unsigned short maxRetransmits() const OVERRIDE; |
| 39 virtual WebKit::WebString protocol() const OVERRIDE; | 39 virtual blink::WebString protocol() const OVERRIDE; |
| 40 virtual bool negotiated() const OVERRIDE; | 40 virtual bool negotiated() const OVERRIDE; |
| 41 virtual unsigned short id() const OVERRIDE; | 41 virtual unsigned short id() const OVERRIDE; |
| 42 virtual unsigned long bufferedAmount() OVERRIDE; | 42 virtual unsigned long bufferedAmount() OVERRIDE; |
| 43 virtual bool sendStringData(const WebKit::WebString& data) OVERRIDE; | 43 virtual bool sendStringData(const blink::WebString& data) OVERRIDE; |
| 44 virtual bool sendRawData(const char* data, size_t length) OVERRIDE; | 44 virtual bool sendRawData(const char* data, size_t length) OVERRIDE; |
| 45 virtual void close() OVERRIDE; | 45 virtual void close() OVERRIDE; |
| 46 | 46 |
| 47 // webrtc::DataChannelObserver implementation. | 47 // webrtc::DataChannelObserver implementation. |
| 48 virtual void OnStateChange() OVERRIDE; | 48 virtual void OnStateChange() OVERRIDE; |
| 49 virtual void OnMessage(const webrtc::DataBuffer& buffer) OVERRIDE; | 49 virtual void OnMessage(const webrtc::DataBuffer& buffer) OVERRIDE; |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 scoped_refptr<webrtc::DataChannelInterface> channel_; | 52 scoped_refptr<webrtc::DataChannelInterface> channel_; |
| 53 WebKit::WebRTCDataChannelHandlerClient* webkit_client_; | 53 blink::WebRTCDataChannelHandlerClient* webkit_client_; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace content | 56 } // namespace content |
| 57 | 57 |
| 58 #endif // CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ | 58 #endif // CONTENT_RENDERER_MEDIA_RTC_DATA_CHANNEL_HANDLER_H_ |
| OLD | NEW |