Chromium Code Reviews| Index: content/browser/renderer_host/media/media_stream_device_settings.cc |
| =================================================================== |
| --- content/browser/renderer_host/media/media_stream_device_settings.cc (revision 146197) |
| +++ content/browser/renderer_host/media/media_stream_device_settings.cc (working copy) |
| @@ -112,14 +112,14 @@ |
| // Sends the request to the appropriate WebContents. |
| void DoDeviceRequest( |
| - const MediaStreamDeviceSettingsRequest* request, |
| + const MediaStreamDeviceSettingsRequest& request, |
| const content::MediaResponseCallback& callback) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| // Send the permission request to the web contents. |
| content::RenderViewHostImpl* host = |
| - content::RenderViewHostImpl::FromID(request->render_process_id, |
| - request->render_view_id); |
| + content::RenderViewHostImpl::FromID(request.render_process_id, |
| + request.render_view_id); |
| // Tab may have gone away. |
| if (!host || !host->GetDelegate()) { |
| @@ -127,7 +127,7 @@ |
| return; |
| } |
| - host->GetDelegate()->RequestMediaAccessPermission(request, callback); |
| + host->GetDelegate()->RequestMediaAccessPermission(&request, callback); |
|
tommi (sloooow) - chröme
2012/07/12 08:38:53
Thanks for the quick fix - qq - should we also cha
|
| } |
| } // namespace |
| @@ -166,7 +166,17 @@ |
| SettingsRequests::iterator request_it = requests_.find(label); |
| if (request_it != requests_.end()) { |
| + // Proceed the next pending request for the same page. |
| MediaStreamDeviceSettingsRequest* request = request_it->second; |
| + std::string new_label = FindReadyRequestForView(request->render_view_id, |
| + request->render_process_id); |
| + if (!new_label.empty()) { |
| + PostRequestToUi(new_label); |
| + } |
| + |
| + // TODO(xians): Post a cancel request on UI thread to dismiss the infobar |
| + // if request has been sent to the UI. |
| + // Remove the request from the queue. |
| requests_.erase(request_it); |
| delete request; |
| } |
| @@ -252,6 +262,10 @@ |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| SettingsRequests::iterator req = requests_.find(label); |
| + // Return if the request has been removed. |
| + if (req == requests_.end()) |
| + return; |
| + |
| DCHECK(req != requests_.end()) << "Invalid request label."; |
| DCHECK(requester_); |
| MediaStreamDeviceSettingsRequest* request = req->second; |
| @@ -356,7 +370,7 @@ |
| BrowserThread::PostTask( |
| BrowserThread::UI, FROM_HERE, |
| - base::Bind(&DoDeviceRequest, request, callback)); |
| + base::Bind(&DoDeviceRequest, *request, callback)); |
| } |
| } // namespace media_stream |