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

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

Issue 66293003: P2P <-> cast library integration v0.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge 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
« no previous file with comments | « no previous file | chrome/renderer/media/cast_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
Alpha Left Google 2013/12/03 23:03:44 This file has been renamed to cast_streaming_nativ
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/webrtc_native_handler.h" 5 #include "chrome/renderer/extensions/webrtc_native_handler.h"
6 6
7 #include <functional> 7 #include <functional>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/common/extensions/api/webrtc_cast_send_transport.h" 10 #include "chrome/common/extensions/api/webrtc_cast_send_transport.h"
11 #include "chrome/common/extensions/api/webrtc_cast_udp_transport.h" 11 #include "chrome/common/extensions/api/webrtc_cast_udp_transport.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 args.GetIsolate()->ThrowException(v8::Exception::TypeError( 297 args.GetIsolate()->ThrowException(v8::Exception::TypeError(
298 v8::String::NewFromUtf8(args.GetIsolate(), kUnableToConvertArgs))); 298 v8::String::NewFromUtf8(args.GetIsolate(), kUnableToConvertArgs)));
299 return; 299 return;
300 } 300 }
301 scoped_ptr<UdpParams> udp_params = UdpParams::FromValue(*udp_params_value); 301 scoped_ptr<UdpParams> udp_params = UdpParams::FromValue(*udp_params_value);
302 if (!udp_params) { 302 if (!udp_params) {
303 args.GetIsolate()->ThrowException(v8::Exception::TypeError( 303 args.GetIsolate()->ThrowException(v8::Exception::TypeError(
304 v8::String::NewFromUtf8(args.GetIsolate(), kInvalidUdpParams))); 304 v8::String::NewFromUtf8(args.GetIsolate(), kInvalidUdpParams)));
305 return; 305 return;
306 } 306 }
307 transport->Start(net::HostPortPair(udp_params->address, udp_params->port)); 307 net::IPAddressNumber ip;
308 if (!net::ParseIPLiteralToNumber(udp_params->address, &ip)) {
309 args.GetIsolate()->ThrowException(v8::Exception::TypeError(
310 v8::String::NewFromUtf8(args.GetIsolate(), kInvalidUdpParams)));
311 return;
312 }
313 transport->Start(net::IPEndPoint(ip, udp_params->port));
308 } 314 }
309 315
310 CastSendTransport* WebRtcNativeHandler::GetSendTransportOrThrow( 316 CastSendTransport* WebRtcNativeHandler::GetSendTransportOrThrow(
311 int transport_id) const { 317 int transport_id) const {
312 SendTransportMap::const_iterator iter = send_transport_map_.find( 318 SendTransportMap::const_iterator iter = send_transport_map_.find(
313 transport_id); 319 transport_id);
314 if (iter != send_transport_map_.end()) 320 if (iter != send_transport_map_.end())
315 return iter->second.get(); 321 return iter->second.get();
316 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); 322 v8::Isolate* isolate = context()->v8_context()->GetIsolate();
317 isolate->ThrowException(v8::Exception::RangeError( 323 isolate->ThrowException(v8::Exception::RangeError(
318 v8::String::NewFromUtf8(isolate, kSendTransportNotFound))); 324 v8::String::NewFromUtf8(isolate, kSendTransportNotFound)));
319 return NULL; 325 return NULL;
320 } 326 }
321 327
322 CastUdpTransport* WebRtcNativeHandler::GetUdpTransportOrThrow( 328 CastUdpTransport* WebRtcNativeHandler::GetUdpTransportOrThrow(
323 int transport_id) const { 329 int transport_id) const {
324 UdpTransportMap::const_iterator iter = udp_transport_map_.find( 330 UdpTransportMap::const_iterator iter = udp_transport_map_.find(
325 transport_id); 331 transport_id);
326 if (iter != udp_transport_map_.end()) 332 if (iter != udp_transport_map_.end())
327 return iter->second.get(); 333 return iter->second.get();
328 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); 334 v8::Isolate* isolate = context()->v8_context()->GetIsolate();
329 isolate->ThrowException(v8::Exception::RangeError( 335 isolate->ThrowException(v8::Exception::RangeError(
330 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound))); 336 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound)));
331 return NULL; 337 return NULL;
332 } 338 }
333 339
334 } // namespace extensions 340 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/media/cast_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698