Chromium Code Reviews| 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 // Helper methods to get transport indexed by |transport_id|. | |
| 51 // If the transport is not found then return NULL and throw a v8 | |
|
scherkus (not reviewing)
2013/10/29 17:38:17
as much as it's nice to save a handful of lines of
Alpha Left Google
2013/10/29 19:52:18
Okay I'll move the exception to each caller.
| |
| 52 // exception. | |
| 53 CastSendTransport* GetSendTransport(int transport_id) const; | |
| 54 CastUdpTransport* GetUdpTransport(int transport_id) const; | |
| 55 | |
| 56 int last_transport_id_; | |
|
justinlin
2013/10/29 18:22:29
You probably want to take a look at ApiResourceMan
Alpha Left Google
2013/10/29 19:52:18
I don't think that's doable because ApiResourceMan
| |
| 57 typedef std::map<int, linked_ptr<CastSendTransport> > SendTransportMap; | |
| 58 SendTransportMap send_transport_map_; | |
| 59 typedef std::map<int, linked_ptr<CastUdpTransport> > UdpTransportMap; | |
| 60 UdpTransportMap udp_transport_map_; | |
| 61 | |
| 44 DISALLOW_COPY_AND_ASSIGN(WebRtcNativeHandler); | 62 DISALLOW_COPY_AND_ASSIGN(WebRtcNativeHandler); |
| 45 }; | 63 }; |
| 46 | 64 |
| 47 } // namespace extensions | 65 } // namespace extensions |
| 48 | 66 |
| 49 #endif // CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ | 67 #endif // CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ |
| OLD | NEW |