OLD | NEW |
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 Loading... |
127 if (!host || !host->GetDelegate()) { | 127 if (!host || !host->GetDelegate()) { |
128 callback.Run(content::MediaStreamDevices()); | 128 callback.Run(content::MediaStreamDevices()); |
129 return; | 129 return; |
130 } | 130 } |
131 | 131 |
132 host->GetDelegate()->RequestMediaAccessPermission(&request, callback); | 132 host->GetDelegate()->RequestMediaAccessPermission(&request, callback); |
133 } | 133 } |
134 | 134 |
135 bool IsRequestReadyForView( | 135 bool IsRequestReadyForView( |
136 media_stream::MediaStreamDeviceSettingsRequest* request) { | 136 media_stream::MediaStreamDeviceSettingsRequest* request) { |
137 if ((request->options.audio && request->devices_full.count( | 137 if ((content::IsAudioMediaType(request->options.audio_type) && |
138 content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE) == 0) || | 138 request->devices_full.count(request->options.audio_type) == 0) || |
139 (request->options.video && request->devices_full.count( | 139 (content::IsVideoMediaType(request->options.video_type) && |
140 content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE) == 0)) { | 140 request->devices_full.count(request->options.video_type) == 0)) { |
141 return false; | 141 return false; |
142 } | 142 } |
143 | 143 |
144 // We have got all the requested devices, it is ready if it has not | 144 // We have got all the requested devices, it is ready if it has not |
145 // been posted for UI yet. | 145 // been posted for UI yet. |
146 return !request->posted_task; | 146 return !request->posted_task; |
147 } | 147 } |
148 | 148 |
149 } // namespace | 149 } // namespace |
150 | 150 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 } | 362 } |
363 } | 363 } |
364 | 364 |
365 BrowserThread::PostTask( | 365 BrowserThread::PostTask( |
366 BrowserThread::IO, FROM_HERE, | 366 BrowserThread::IO, FROM_HERE, |
367 base::Bind(&MediaStreamDeviceSettings::PostResponse, | 367 base::Bind(&MediaStreamDeviceSettings::PostResponse, |
368 weak_ptr_factory_.GetWeakPtr(), label, devices_to_use)); | 368 weak_ptr_factory_.GetWeakPtr(), label, devices_to_use)); |
369 } | 369 } |
370 | 370 |
371 } // namespace media_stream | 371 } // namespace media_stream |
OLD | NEW |