Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: chrome/renderer/extensions/cast_streaming_native_handler.h

Issue 90083002: Cast Extensions API: Major namespace and object renaming (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit_tests Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_CAST_STREAMING_NATIVE_HANDLER_H_
6 #define CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_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 "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/renderer/extensions/object_backed_native_handler.h" 12 #include "chrome/renderer/extensions/object_backed_native_handler.h"
13 #include "chrome/renderer/extensions/scoped_persistent.h" 13 #include "chrome/renderer/extensions/scoped_persistent.h"
14 #include "v8/include/v8.h" 14 #include "v8/include/v8.h"
15 15
16 class CastSendTransport; 16 class CastRtpStream;
17 class CastUdpTransport; 17 class CastUdpTransport;
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 class ChromeV8Context; 21 class ChromeV8Context;
22 22
23 // Native code that handle chrome.webrtc custom bindings. 23 // Native code that handle chrome.webrtc custom bindings.
24 class WebRtcNativeHandler : public ObjectBackedNativeHandler { 24 class CastStreamingNativeHandler : public ObjectBackedNativeHandler {
25 public: 25 public:
26 explicit WebRtcNativeHandler(ChromeV8Context* context); 26 explicit CastStreamingNativeHandler(ChromeV8Context* context);
27 virtual ~WebRtcNativeHandler(); 27 virtual ~CastStreamingNativeHandler();
28 28
29 private: 29 private:
30 void CreateCastSession( 30 void CreateCastSession(
31 const v8::FunctionCallbackInfo<v8::Value>& args); 31 const v8::FunctionCallbackInfo<v8::Value>& args);
32 32
33 void DestroyCastSendTransport( 33 void DestroyCastRtpStream(
34 const v8::FunctionCallbackInfo<v8::Value>& args); 34 const v8::FunctionCallbackInfo<v8::Value>& args);
35 void CreateParamsCastSendTransport( 35 void CreateParamsCastRtpStream(
36 const v8::FunctionCallbackInfo<v8::Value>& args); 36 const v8::FunctionCallbackInfo<v8::Value>& args);
37 void GetCapsCastSendTransport( 37 void GetCapsCastRtpStream(
38 const v8::FunctionCallbackInfo<v8::Value>& args); 38 const v8::FunctionCallbackInfo<v8::Value>& args);
39 void StartCastSendTransport( 39 void StartCastRtpStream(
40 const v8::FunctionCallbackInfo<v8::Value>& args); 40 const v8::FunctionCallbackInfo<v8::Value>& args);
41 void StopCastSendTransport( 41 void StopCastRtpStream(
42 const v8::FunctionCallbackInfo<v8::Value>& args); 42 const v8::FunctionCallbackInfo<v8::Value>& args);
43 43
44 void DestroyCastUdpTransport( 44 void DestroyCastUdpTransport(
45 const v8::FunctionCallbackInfo<v8::Value>& args); 45 const v8::FunctionCallbackInfo<v8::Value>& args);
46 void StartCastUdpTransport( 46 void StartCastUdpTransport(
47 const v8::FunctionCallbackInfo<v8::Value>& args); 47 const v8::FunctionCallbackInfo<v8::Value>& args);
48 void StopCastUdpTransport( 48 void StopCastUdpTransport(
49 const v8::FunctionCallbackInfo<v8::Value>& args); 49 const v8::FunctionCallbackInfo<v8::Value>& args);
50 50
51 // Helper method to call the v8 callback function after a session is 51 // Helper method to call the v8 callback function after a session is
52 // created. 52 // created.
53 void CallCreateCallback(scoped_ptr<CastSendTransport> stream1, 53 void CallCreateCallback(scoped_ptr<CastRtpStream> stream1,
54 scoped_ptr<CastSendTransport> stream2, 54 scoped_ptr<CastRtpStream> stream2,
55 scoped_ptr<CastUdpTransport> udp_transport); 55 scoped_ptr<CastUdpTransport> udp_transport);
56 56
57 // Gets the Send or UDP transport indexed by |transport_id|. 57 // Gets the RTP stream or UDP transport indexed by an ID.
58 // If not found, returns NULL and throws a V8 exception. 58 // If not found, returns NULL and throws a V8 exception.
59 CastSendTransport* GetSendTransportOrThrow(int transport_id) const; 59 CastRtpStream* GetRtpStreamOrThrow(int stream_id) const;
60 CastUdpTransport* GetUdpTransportOrThrow(int transport_id) const; 60 CastUdpTransport* GetUdpTransportOrThrow(int transport_id) const;
61 61
62 int last_transport_id_; 62 int last_transport_id_;
63 63
64 typedef std::map<int, linked_ptr<CastSendTransport> > SendTransportMap; 64 typedef std::map<int, linked_ptr<CastRtpStream> > RtpStreamMap;
65 SendTransportMap send_transport_map_; 65 RtpStreamMap rtp_stream_map_;
66 66
67 typedef std::map<int, linked_ptr<CastUdpTransport> > UdpTransportMap; 67 typedef std::map<int, linked_ptr<CastUdpTransport> > UdpTransportMap;
68 UdpTransportMap udp_transport_map_; 68 UdpTransportMap udp_transport_map_;
69 69
70 base::WeakPtrFactory<WebRtcNativeHandler> weak_factory_; 70 base::WeakPtrFactory<CastStreamingNativeHandler> weak_factory_;
71 71
72 extensions::ScopedPersistent<v8::Function> create_callback_; 72 extensions::ScopedPersistent<v8::Function> create_callback_;
73 73
74 DISALLOW_COPY_AND_ASSIGN(WebRtcNativeHandler); 74 DISALLOW_COPY_AND_ASSIGN(CastStreamingNativeHandler);
75 }; 75 };
76 76
77 } // namespace extensions 77 } // namespace extensions
78 78
79 #endif // CHROME_RENDERER_EXTENSIONS_WEBRTC_NATIVE_HANDLER_H_ 79 #endif // CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698