Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / renderer / extensions / cast_streaming_native_handler.h
index 02d8efa..f468186 100644 (file)
@@ -9,21 +9,24 @@
 
 #include "base/memory/linked_ptr.h"
 #include "base/memory/weak_ptr.h"
-#include "chrome/renderer/extensions/object_backed_native_handler.h"
-#include "chrome/renderer/extensions/scoped_persistent.h"
+#include "extensions/renderer/object_backed_native_handler.h"
+#include "extensions/renderer/scoped_persistent.h"
 #include "v8/include/v8.h"
 
 class CastRtpStream;
 class CastUdpTransport;
 
-namespace extensions {
+namespace base {
+class BinaryValue;
+class DictionaryValue;
+}
 
-class ChromeV8Context;
+namespace extensions {
 
 // Native code that handle chrome.webrtc custom bindings.
 class CastStreamingNativeHandler : public ObjectBackedNativeHandler {
  public:
-  explicit CastStreamingNativeHandler(ChromeV8Context* context);
+  explicit CastStreamingNativeHandler(ScriptContext* context);
   virtual ~CastStreamingNativeHandler();
 
  private:
@@ -48,12 +51,25 @@ class CastStreamingNativeHandler : public ObjectBackedNativeHandler {
   void StopCastUdpTransport(
       const v8::FunctionCallbackInfo<v8::Value>& args);
 
+  void ToggleLogging(const v8::FunctionCallbackInfo<v8::Value>& args);
+  void GetRawEvents(const v8::FunctionCallbackInfo<v8::Value>& args);
+  void GetStats(const v8::FunctionCallbackInfo<v8::Value>& args);
+
   // Helper method to call the v8 callback function after a session is
   // created.
   void CallCreateCallback(scoped_ptr<CastRtpStream> stream1,
                           scoped_ptr<CastRtpStream> stream2,
                           scoped_ptr<CastUdpTransport> udp_transport);
 
+  void CallStartCallback(int stream_id);
+  void CallStopCallback(int stream_id);
+  void CallErrorCallback(int stream_id, const std::string& message);
+
+  void CallGetRawEventsCallback(int transport_id,
+                                scoped_ptr<base::BinaryValue> raw_events);
+  void CallGetStatsCallback(int transport_id,
+                            scoped_ptr<base::DictionaryValue> stats);
+
   // Gets the RTP stream or UDP transport indexed by an ID.
   // If not found, returns NULL and throws a V8 exception.
   CastRtpStream* GetRtpStreamOrThrow(int stream_id) const;
@@ -71,6 +87,12 @@ class CastStreamingNativeHandler : public ObjectBackedNativeHandler {
 
   extensions::ScopedPersistent<v8::Function> create_callback_;
 
+  typedef std::map<int,
+                   linked_ptr<extensions::ScopedPersistent<v8::Function> > >
+      RtpStreamCallbackMap;
+  RtpStreamCallbackMap get_raw_events_callbacks_;
+  RtpStreamCallbackMap get_stats_callbacks_;
+
   DISALLOW_COPY_AND_ASSIGN(CastStreamingNativeHandler);
 };