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

Side by Side Diff: content/browser/renderer_host/media/media_stream_device_settings.cc

Issue 10534004: Implement CancelUserMediaRequest for the browser part (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed tommi's comments Created 8 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_device_settings.h" 5 #include "content/browser/renderer_host/media/media_stream_device_settings.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Request with this id already exists. 127 // Request with this id already exists.
128 requester_->SettingsError(label); 128 requester_->SettingsError(label);
129 return; 129 return;
130 } 130 }
131 131
132 // Create a new request. 132 // Create a new request.
133 requests_.insert(std::make_pair(label, new MediaStreamDeviceSettingsRequest( 133 requests_.insert(std::make_pair(label, new MediaStreamDeviceSettingsRequest(
134 render_process_id, render_view_id, security_origin, request_options))); 134 render_process_id, render_view_id, security_origin, request_options)));
135 } 135 }
136 136
137 void MediaStreamDeviceSettings::RemovePendingCaptureRequest(
138 const std::string& label) {
139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
140
141 SettingsRequests::iterator request_it = requests_.find(label);
142 if (request_it != requests_.end()) {
143 MediaStreamDeviceSettingsRequest* request = request_it->second;
144 requests_.erase(request_it);
145 delete request;
146 }
147 }
148
137 void MediaStreamDeviceSettings::AvailableDevices( 149 void MediaStreamDeviceSettings::AvailableDevices(
138 const std::string& label, 150 const std::string& label,
139 MediaStreamType stream_type, 151 MediaStreamType stream_type,
140 const StreamDeviceInfoArray& devices) { 152 const StreamDeviceInfoArray& devices) {
141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
142 154
143 SettingsRequests::iterator request_it = requests_.find(label); 155 SettingsRequests::iterator request_it = requests_.find(label);
144 DCHECK(request_it != requests_.end()); 156 DCHECK(request_it != requests_.end());
145 157
146 // Add the answer for the request. 158 // Add the answer for the request.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 BrowserThread::PostTask( 331 BrowserThread::PostTask(
320 BrowserThread::UI, FROM_HERE, 332 BrowserThread::UI, FROM_HERE,
321 base::Bind( 333 base::Bind(
322 &content::ContentBrowserClient::RequestMediaAccessPermission, 334 &content::ContentBrowserClient::RequestMediaAccessPermission,
323 base::Unretained(content::GetContentClient()->browser()), 335 base::Unretained(content::GetContentClient()->browser()),
324 request, callback)); 336 request, callback));
325 337
326 } 338 }
327 339
328 } // namespace media_stream 340 } // namespace media_stream
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698