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

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

Issue 1854983002: [Extensions] Add more bindings access checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 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
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <functional> 10 #include <functional>
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 return true; 181 return true;
182 } 182 }
183 183
184 } // namespace 184 } // namespace
185 185
186 CastStreamingNativeHandler::CastStreamingNativeHandler(ScriptContext* context) 186 CastStreamingNativeHandler::CastStreamingNativeHandler(ScriptContext* context)
187 : ObjectBackedNativeHandler(context), 187 : ObjectBackedNativeHandler(context),
188 last_transport_id_(1), 188 last_transport_id_(1),
189 weak_factory_(this) { 189 weak_factory_(this) {
190 RouteFunction("CreateSession", 190 RouteFunction("CreateSession", "cast.streaming.session",
191 base::Bind(&CastStreamingNativeHandler::CreateCastSession, 191 base::Bind(&CastStreamingNativeHandler::CreateCastSession,
192 weak_factory_.GetWeakPtr())); 192 weak_factory_.GetWeakPtr()));
193 RouteFunction("DestroyCastRtpStream", 193 RouteFunction("DestroyCastRtpStream", "cast.streaming.rtpStream",
194 base::Bind(&CastStreamingNativeHandler::DestroyCastRtpStream, 194 base::Bind(&CastStreamingNativeHandler::DestroyCastRtpStream,
195 weak_factory_.GetWeakPtr())); 195 weak_factory_.GetWeakPtr()));
196 RouteFunction( 196 RouteFunction(
197 "GetSupportedParamsCastRtpStream", 197 "GetSupportedParamsCastRtpStream", "cast.streaming.rtpStream",
198 base::Bind(&CastStreamingNativeHandler::GetSupportedParamsCastRtpStream, 198 base::Bind(&CastStreamingNativeHandler::GetSupportedParamsCastRtpStream,
199 weak_factory_.GetWeakPtr())); 199 weak_factory_.GetWeakPtr()));
200 RouteFunction("StartCastRtpStream", 200 RouteFunction("StartCastRtpStream", "cast.streaming.rtpStream",
201 base::Bind(&CastStreamingNativeHandler::StartCastRtpStream, 201 base::Bind(&CastStreamingNativeHandler::StartCastRtpStream,
202 weak_factory_.GetWeakPtr())); 202 weak_factory_.GetWeakPtr()));
203 RouteFunction("StopCastRtpStream", 203 RouteFunction("StopCastRtpStream", "cast.streaming.rtpStream",
204 base::Bind(&CastStreamingNativeHandler::StopCastRtpStream, 204 base::Bind(&CastStreamingNativeHandler::StopCastRtpStream,
205 weak_factory_.GetWeakPtr())); 205 weak_factory_.GetWeakPtr()));
206 RouteFunction("DestroyCastUdpTransport", 206 RouteFunction("DestroyCastUdpTransport", "cast.streaming.udpTransport",
207 base::Bind(&CastStreamingNativeHandler::DestroyCastUdpTransport, 207 base::Bind(&CastStreamingNativeHandler::DestroyCastUdpTransport,
208 weak_factory_.GetWeakPtr())); 208 weak_factory_.GetWeakPtr()));
209 RouteFunction( 209 RouteFunction(
210 "SetDestinationCastUdpTransport", 210 "SetDestinationCastUdpTransport", "cast.streaming.udpTransport",
211 base::Bind(&CastStreamingNativeHandler::SetDestinationCastUdpTransport, 211 base::Bind(&CastStreamingNativeHandler::SetDestinationCastUdpTransport,
212 weak_factory_.GetWeakPtr())); 212 weak_factory_.GetWeakPtr()));
213 RouteFunction( 213 RouteFunction(
214 "SetOptionsCastUdpTransport", 214 "SetOptionsCastUdpTransport", "cast.streaming.udpTransport",
215 base::Bind(&CastStreamingNativeHandler::SetOptionsCastUdpTransport, 215 base::Bind(&CastStreamingNativeHandler::SetOptionsCastUdpTransport,
216 weak_factory_.GetWeakPtr())); 216 weak_factory_.GetWeakPtr()));
217 RouteFunction("ToggleLogging", 217 RouteFunction("ToggleLogging", "cast.streaming.rtpStream",
218 base::Bind(&CastStreamingNativeHandler::ToggleLogging, 218 base::Bind(&CastStreamingNativeHandler::ToggleLogging,
219 weak_factory_.GetWeakPtr())); 219 weak_factory_.GetWeakPtr()));
220 RouteFunction("GetRawEvents", 220 RouteFunction("GetRawEvents", "cast.streaming.rtpStream",
221 base::Bind(&CastStreamingNativeHandler::GetRawEvents, 221 base::Bind(&CastStreamingNativeHandler::GetRawEvents,
222 weak_factory_.GetWeakPtr())); 222 weak_factory_.GetWeakPtr()));
223 RouteFunction("GetStats", base::Bind(&CastStreamingNativeHandler::GetStats, 223 RouteFunction("GetStats", "cast.streaming.rtpStream",
224 weak_factory_.GetWeakPtr())); 224 base::Bind(&CastStreamingNativeHandler::GetStats,
225 RouteFunction("StartCastRtpReceiver", 225 weak_factory_.GetWeakPtr()));
226 RouteFunction("StartCastRtpReceiver", "cast.streaming.receiverSession",
226 base::Bind(&CastStreamingNativeHandler::StartCastRtpReceiver, 227 base::Bind(&CastStreamingNativeHandler::StartCastRtpReceiver,
227 weak_factory_.GetWeakPtr())); 228 weak_factory_.GetWeakPtr()));
228 } 229 }
229 230
230 CastStreamingNativeHandler::~CastStreamingNativeHandler() { 231 CastStreamingNativeHandler::~CastStreamingNativeHandler() {
231 // Note: A superclass's destructor will call Invalidate(), but Invalidate() 232 // Note: A superclass's destructor will call Invalidate(), but Invalidate()
232 // may also be called at any time before destruction. 233 // may also be called at any time before destruction.
233 } 234 }
234 235
235 void CastStreamingNativeHandler::Invalidate() { 236 void CastStreamingNativeHandler::Invalidate() {
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 LOG(ERROR) << "Failed to add Cast audio track to media stream."; 877 LOG(ERROR) << "Failed to add Cast audio track to media stream.";
877 } 878 }
878 if (!content::AddVideoTrackToMediaStream(std::move(video), true, // is_remote 879 if (!content::AddVideoTrackToMediaStream(std::move(video), true, // is_remote
879 true, // is_readonly 880 true, // is_readonly
880 &web_stream)) { 881 &web_stream)) {
881 LOG(ERROR) << "Failed to add Cast video track to media stream."; 882 LOG(ERROR) << "Failed to add Cast video track to media stream.";
882 } 883 }
883 } 884 }
884 885
885 } // namespace extensions 886 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698