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 "chrome/browser/media/media_stream_devices_controller.h" | 5 #include "chrome/browser/media/media_stream_devices_controller.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 if (!callback_.is_null()) { | 208 if (!callback_.is_null()) { |
209 callback_.Run(content::MediaStreamDevices(), | 209 callback_.Run(content::MediaStreamDevices(), |
210 content::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, | 210 content::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, |
211 scoped_ptr<content::MediaStreamUI>()); | 211 scoped_ptr<content::MediaStreamUI>()); |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 // static | 215 // static |
216 void MediaStreamDevicesController::RegisterProfilePrefs( | 216 void MediaStreamDevicesController::RegisterProfilePrefs( |
217 user_prefs::PrefRegistrySyncable* prefs) { | 217 user_prefs::PrefRegistrySyncable* prefs) { |
218 prefs->RegisterBooleanPref(prefs::kVideoCaptureAllowed, | 218 prefs->RegisterBooleanPref(prefs::kVideoCaptureAllowed, true); |
219 true, | 219 prefs->RegisterBooleanPref(prefs::kAudioCaptureAllowed, true); |
220 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 220 prefs->RegisterListPref(prefs::kVideoCaptureAllowedUrls); |
221 prefs->RegisterBooleanPref(prefs::kAudioCaptureAllowed, | 221 prefs->RegisterListPref(prefs::kAudioCaptureAllowedUrls); |
222 true, | |
223 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
224 prefs->RegisterListPref(prefs::kVideoCaptureAllowedUrls, | |
225 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
226 prefs->RegisterListPref(prefs::kAudioCaptureAllowedUrls, | |
227 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
228 } | 222 } |
229 | 223 |
230 // TODO(gbillock): rename? doesn't actually dismiss. More of a 'check profile | 224 // TODO(gbillock): rename? doesn't actually dismiss. More of a 'check profile |
231 // and system for compatibility' thing. | 225 // and system for compatibility' thing. |
232 bool MediaStreamDevicesController::DismissInfoBarAndTakeActionOnSettings() { | 226 bool MediaStreamDevicesController::DismissInfoBarAndTakeActionOnSettings() { |
233 // Tab capture is allowed for extensions only and infobar is not shown for | 227 // Tab capture is allowed for extensions only and infobar is not shown for |
234 // extensions. | 228 // extensions. |
235 if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE || | 229 if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE || |
236 request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE) { | 230 request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE) { |
237 Deny(false, content::MEDIA_DEVICE_INVALID_STATE); | 231 Deny(false, content::MEDIA_DEVICE_INVALID_STATE); |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 } | 677 } |
684 | 678 |
685 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { | 679 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { |
686 #if defined(OS_ANDROID) | 680 #if defined(OS_ANDROID) |
687 // Don't approve device requests if the tab was hidden. | 681 // Don't approve device requests if the tab was hidden. |
688 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 682 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
689 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 683 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
690 #endif | 684 #endif |
691 return true; | 685 return true; |
692 } | 686 } |
OLD | NEW |