| 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 CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/linked_ptr.h" |
| 8 #include "chrome/renderer/extensions/object_backed_native_handler.h" | 11 #include "chrome/renderer/extensions/object_backed_native_handler.h" |
| 9 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 10 | 13 |
| 14 class CastSendTransport; |
| 15 class CastUdpTransport; |
| 16 |
| 11 namespace extensions { | 17 namespace extensions { |
| 12 | 18 |
| 13 class ChromeV8Context; | 19 class ChromeV8Context; |
| 14 | 20 |
| 15 // Native code that handle chrome.webrtc custom bindings. | 21 // Native code that handle chrome.webrtc custom bindings. |
| 16 class WebRtcNativeHandler : public ObjectBackedNativeHandler { | 22 class WebRtcNativeHandler : public ObjectBackedNativeHandler { |
| 17 public: | 23 public: |
| 18 explicit WebRtcNativeHandler(ChromeV8Context* context); | 24 explicit WebRtcNativeHandler(ChromeV8Context* context); |
| 19 virtual ~WebRtcNativeHandler(); | 25 virtual ~WebRtcNativeHandler(); |
| 20 | 26 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 | 40 |
| 35 void CreateCastUdpTransport( | 41 void CreateCastUdpTransport( |
| 36 const v8::FunctionCallbackInfo<v8::Value>& args); | 42 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 37 void DestroyCastUdpTransport( | 43 void DestroyCastUdpTransport( |
| 38 const v8::FunctionCallbackInfo<v8::Value>& args); | 44 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 39 void StartCastUdpTransport( | 45 void StartCastUdpTransport( |
| 40 const v8::FunctionCallbackInfo<v8::Value>& args); | 46 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 41 void StopCastUdpTransport( | 47 void StopCastUdpTransport( |
| 42 const v8::FunctionCallbackInfo<v8::Value>& args); | 48 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 43 | 49 |
| 50 // Gets the Send or UDP transport indexed by |transport_id|. |
| 51 // If not found, returns NULL and throws a V8 exception. |
| 52 CastSendTransport* GetSendTransportOrThrow(int transport_id) const; |
| 53 CastUdpTransport* GetUdpTransportOrThrow(int transport_id) const; |
| 54 |
| 55 int last_transport_id_; |
| 56 |
| 57 typedef std::map<int, linked_ptr<CastSendTransport> > SendTransportMap; |
| 58 SendTransportMap send_transport_map_; |
| 59 |
| 60 typedef std::map<int, linked_ptr<CastUdpTransport> > UdpTransportMap; |
| 61 UdpTransportMap udp_transport_map_; |
| 62 |
| 44 DISALLOW_COPY_AND_ASSIGN(WebRtcNativeHandler); | 63 DISALLOW_COPY_AND_ASSIGN(WebRtcNativeHandler); |
| 45 }; | 64 }; |
| 46 | 65 |
| 47 } // namespace extensions | 66 } // namespace extensions |
| 48 | 67 |
| 49 #endif // CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ | 68 #endif // CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ |
| OLD | NEW |