OLD | NEW |
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 "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 5 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/frame_host/render_frame_host_delegate.h" | 8 #include "content/browser/frame_host/render_frame_host_delegate.h" |
9 #include "content/browser/frame_host/render_frame_host_impl.h" | 9 #include "content/browser/frame_host/render_frame_host_impl.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 camera_access_ = access; | 261 camera_access_ = access; |
262 } | 262 } |
263 | 263 |
264 void FakeMediaStreamUIProxy::RequestAccess( | 264 void FakeMediaStreamUIProxy::RequestAccess( |
265 const MediaStreamRequest& request, | 265 const MediaStreamRequest& request, |
266 const ResponseCallback& response_callback) { | 266 const ResponseCallback& response_callback) { |
267 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 267 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
268 | 268 |
269 response_callback_ = response_callback; | 269 response_callback_ = response_callback; |
270 | 270 |
271 if (CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 271 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
272 switches::kUseFakeUIForMediaStream) == "deny") { | 272 switches::kUseFakeUIForMediaStream) == "deny") { |
273 // Immediately deny the request. | 273 // Immediately deny the request. |
274 BrowserThread::PostTask( | 274 BrowserThread::PostTask( |
275 BrowserThread::IO, FROM_HERE, | 275 BrowserThread::IO, FROM_HERE, |
276 base::Bind(&MediaStreamUIProxy::ProcessAccessRequestResponse, | 276 base::Bind(&MediaStreamUIProxy::ProcessAccessRequestResponse, |
277 weak_factory_.GetWeakPtr(), | 277 weak_factory_.GetWeakPtr(), |
278 MediaStreamDevices(), | 278 MediaStreamDevices(), |
279 MEDIA_DEVICE_PERMISSION_DENIED)); | 279 MEDIA_DEVICE_PERMISSION_DENIED)); |
280 return; | 280 return; |
281 } | 281 } |
282 | 282 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 const GURL& security_origin, | 325 const GURL& security_origin, |
326 MediaStreamType type, | 326 MediaStreamType type, |
327 int render_process_id, | 327 int render_process_id, |
328 int render_frame_id, | 328 int render_frame_id, |
329 const base::Callback<void(bool)>& callback) { | 329 const base::Callback<void(bool)>& callback) { |
330 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 330 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
331 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || | 331 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || |
332 type == MEDIA_DEVICE_VIDEO_CAPTURE); | 332 type == MEDIA_DEVICE_VIDEO_CAPTURE); |
333 | 333 |
334 bool have_access = false; | 334 bool have_access = false; |
335 if (CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 335 if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
336 switches::kUseFakeUIForMediaStream) != "deny") { | 336 switches::kUseFakeUIForMediaStream) != "deny") { |
337 have_access = | 337 have_access = |
338 type == MEDIA_DEVICE_AUDIO_CAPTURE ? mic_access_ : camera_access_; | 338 type == MEDIA_DEVICE_AUDIO_CAPTURE ? mic_access_ : camera_access_; |
339 } | 339 } |
340 | 340 |
341 BrowserThread::PostTask( | 341 BrowserThread::PostTask( |
342 BrowserThread::IO, | 342 BrowserThread::IO, |
343 FROM_HERE, | 343 FROM_HERE, |
344 base::Bind(&MediaStreamUIProxy::OnCheckedAccess, | 344 base::Bind(&MediaStreamUIProxy::OnCheckedAccess, |
345 weak_factory_.GetWeakPtr(), | 345 weak_factory_.GetWeakPtr(), |
346 callback, | 346 callback, |
347 have_access)); | 347 have_access)); |
348 return; | 348 return; |
349 } | 349 } |
350 | 350 |
351 void FakeMediaStreamUIProxy::OnStarted( | 351 void FakeMediaStreamUIProxy::OnStarted( |
352 const base::Closure& stop_callback, | 352 const base::Closure& stop_callback, |
353 const WindowIdCallback& window_id_callback) {} | 353 const WindowIdCallback& window_id_callback) {} |
354 | 354 |
355 } // namespace content | 355 } // namespace content |
OLD | NEW |