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