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

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

Issue 240603003: Remove ChromeV8Extension & most of ChromeV8Context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 8 months 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 #include "chrome/renderer/extensions/cast_streaming_native_handler.h" 5 #include "chrome/renderer/extensions/cast_streaming_native_handler.h"
6 6
7 #include <functional> 7 #include <functional>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "chrome/common/extensions/api/cast_streaming_rtp_stream.h" 13 #include "chrome/common/extensions/api/cast_streaming_rtp_stream.h"
14 #include "chrome/common/extensions/api/cast_streaming_udp_transport.h" 14 #include "chrome/common/extensions/api/cast_streaming_udp_transport.h"
15 #include "chrome/renderer/extensions/chrome_v8_context.h"
16 #include "chrome/renderer/media/cast_rtp_stream.h" 15 #include "chrome/renderer/media/cast_rtp_stream.h"
17 #include "chrome/renderer/media/cast_session.h" 16 #include "chrome/renderer/media/cast_session.h"
18 #include "chrome/renderer/media/cast_udp_transport.h" 17 #include "chrome/renderer/media/cast_udp_transport.h"
19 #include "content/public/renderer/v8_value_converter.h" 18 #include "content/public/renderer/v8_value_converter.h"
19 #include "extensions/renderer/script_context.h"
20 #include "net/base/host_port_pair.h" 20 #include "net/base/host_port_pair.h"
21 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 21 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
22 #include "third_party/WebKit/public/web/WebDOMMediaStreamTrack.h" 22 #include "third_party/WebKit/public/web/WebDOMMediaStreamTrack.h"
23 23
24 using content::V8ValueConverter; 24 using content::V8ValueConverter;
25 25
26 // Extension types. 26 // Extension types.
27 using extensions::api::cast_streaming_rtp_stream::CodecSpecificParams; 27 using extensions::api::cast_streaming_rtp_stream::CodecSpecificParams;
28 using extensions::api::cast_streaming_rtp_stream::RtpParams; 28 using extensions::api::cast_streaming_rtp_stream::RtpParams;
29 using extensions::api::cast_streaming_rtp_stream::RtpPayloadParams; 29 using extensions::api::cast_streaming_rtp_stream::RtpPayloadParams;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (!ToCastRtpPayloadParamsOrThrow(isolate, 138 if (!ToCastRtpPayloadParamsOrThrow(isolate,
139 ext_params.payload, 139 ext_params.payload,
140 &cast_params->payload)) { 140 &cast_params->payload)) {
141 return false; 141 return false;
142 } 142 }
143 return true; 143 return true;
144 } 144 }
145 145
146 } // namespace 146 } // namespace
147 147
148 CastStreamingNativeHandler::CastStreamingNativeHandler(ChromeV8Context* context) 148 CastStreamingNativeHandler::CastStreamingNativeHandler(ScriptContext* context)
149 : ObjectBackedNativeHandler(context), 149 : ObjectBackedNativeHandler(context),
150 last_transport_id_(1), 150 last_transport_id_(1),
151 weak_factory_(this) { 151 weak_factory_(this) {
152 RouteFunction("CreateSession", 152 RouteFunction("CreateSession",
153 base::Bind(&CastStreamingNativeHandler::CreateCastSession, 153 base::Bind(&CastStreamingNativeHandler::CreateCastSession,
154 base::Unretained(this))); 154 base::Unretained(this)));
155 RouteFunction("DestroyCastRtpStream", 155 RouteFunction("DestroyCastRtpStream",
156 base::Bind(&CastStreamingNativeHandler::DestroyCastRtpStream, 156 base::Bind(&CastStreamingNativeHandler::DestroyCastRtpStream,
157 base::Unretained(this))); 157 base::Unretained(this)));
158 RouteFunction("GetSupportedParamsCastRtpStream", 158 RouteFunction("GetSupportedParamsCastRtpStream",
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 transport_id); 532 transport_id);
533 if (iter != udp_transport_map_.end()) 533 if (iter != udp_transport_map_.end())
534 return iter->second.get(); 534 return iter->second.get();
535 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); 535 v8::Isolate* isolate = context()->v8_context()->GetIsolate();
536 isolate->ThrowException(v8::Exception::RangeError( 536 isolate->ThrowException(v8::Exception::RangeError(
537 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound))); 537 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound)));
538 return NULL; 538 return NULL;
539 } 539 }
540 540
541 } // namespace extensions 541 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698