Chromium Code Reviews| Index: content/browser/renderer_host/media/video_capture_manager.cc |
| diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc |
| index 24cf4bedea3e8eb57cf76459a73a995f291977e0..e0c1146e4f7d23d735567e6715b562b831883df1 100644 |
| --- a/content/browser/renderer_host/media/video_capture_manager.cc |
| +++ b/content/browser/renderer_host/media/video_capture_manager.cc |
| @@ -840,36 +840,23 @@ void VideoCaptureManager::MaybePostDesktopCaptureWindowId( |
| notification_window_ids_.erase(window_id_it); |
| } |
| -bool VideoCaptureManager::TakePhoto( |
| +void VideoCaptureManager::TakePhoto( |
| int session_id, |
| - const media::VideoCaptureDevice::TakePhotoCallback& photo_callback) { |
| + media::ScopedCallback<media::VideoCaptureDevice::TakePhotoCallback> cb) { |
|
Reilly Grant (use Gerrit)
2016/05/26 17:50:03
nit: s/cb/callback/
mcasas
2016/05/26 18:33:32
Done.
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| SessionMap::const_iterator session_it = sessions_.find(session_id); |
| if (session_it == sessions_.end()) |
| - return false; |
| + return; |
| DeviceEntry* const device_info = |
| GetDeviceEntryForMediaStreamDevice(session_it->second); |
| if (!device_info) |
| - return false; |
| + return; |
| device_task_runner_->PostTask( |
| FROM_HERE, |
| - base::Bind(&VideoCaptureManager::DoTakePhotoOnDeviceThread, this, |
| - device_info->video_capture_device(), photo_callback)); |
| - return true; |
| -} |
| - |
| -void VideoCaptureManager::DoTakePhotoOnDeviceThread( |
| - media::VideoCaptureDevice* device, |
| - const media::VideoCaptureDevice::TakePhotoCallback& photo_callback) { |
| - DCHECK(IsOnDeviceThread()); |
| - if (device->TakePhoto(photo_callback)) |
| - return; |
| - |
| - // TakePhoto() failed synchronously: Make sure |photo_callback| is Run(). |
| - std::unique_ptr<std::vector<uint8_t>> empty_vector( |
| - new std::vector<uint8_t>()); |
| - photo_callback.Run("", std::move(empty_vector)); |
| + base::Bind(&media::VideoCaptureDevice::TakePhoto, |
| + base::Unretained(device_info->video_capture_device()), |
| + base::Passed(std::move(cb)))); |
|
Reilly Grant (use Gerrit)
2016/05/26 17:50:03
base::Passed(&cb)
mcasas
2016/05/26 18:33:32
Done.
|
| } |
| void VideoCaptureManager::DoStopDeviceOnDeviceThread( |