Chromium Code Reviews| Index: chrome/browser/media/media_stream_devices_controller.cc |
| diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc |
| index ef876bae3e02778d4552ca82041a58b1cf8d289b..0a62966d2970cec4a667688cd22a2ca7538aba43 100644 |
| --- a/chrome/browser/media/media_stream_devices_controller.cc |
| +++ b/chrome/browser/media/media_stream_devices_controller.cc |
| @@ -31,7 +31,10 @@ |
| #include "ui/base/l10n/l10n_util.h" |
| #if defined(OS_ANDROID) |
| +#include <vector> |
| + |
| #include "chrome/browser/android/preferences/pref_service_bridge.h" |
| +#include "chrome/browser/permissions/permission_update_infobar_delegate_android.h" |
| #include "content/public/browser/android/content_view_core.h" |
| #include "ui/android/window_android.h" |
| #endif // OS_ANDROID |
| @@ -92,6 +95,24 @@ MediaStreamDevicesController::MediaStreamDevicesController( |
| return; |
| } |
| +#if defined(OS_ANDROID) |
| + std::vector<ContentSettingsType> content_settings_types; |
| + if (old_audio_setting_ == CONTENT_SETTING_ALLOW) |
|
Guido Urdaneta
2015/09/23 13:32:14
Shouldn't you use IsAllowedForAudio() and IsAllowe
Ted C
2015/09/23 19:45:34
Done.
|
| + content_settings_types.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| + if (old_video_setting_ == CONTENT_SETTING_ALLOW) |
| + content_settings_types.push_back( |
| + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| + |
| + // If the site had been previously granted the access to audio or video but |
| + // Chrome is now missing the necessary permission, we need to show an infobar |
| + // to resolve the difference. |
| + if (!content_settings_types.empty() && |
| + PermissionUpdateInfoBarDelegate::ShouldShowPermissionInfobar( |
| + web_contents, content_settings_types)) { |
| + return; |
| + } |
| +#endif |
| + |
| // Otherwise we can run the callback immediately. |
| RunCallback(old_audio_setting_, old_video_setting_, denial_reason); |
| } |
| @@ -113,6 +134,14 @@ void MediaStreamDevicesController::RegisterProfilePrefs( |
| prefs->RegisterListPref(prefs::kAudioCaptureAllowedUrls); |
| } |
| +bool MediaStreamDevicesController::IsAllowedForAudio() const { |
| + return old_audio_setting_ == CONTENT_SETTING_ALLOW; |
| +} |
| + |
| +bool MediaStreamDevicesController::IsAllowedForVideo() const { |
| + return old_video_setting_ == CONTENT_SETTING_ALLOW; |
| +} |
| + |
| bool MediaStreamDevicesController::IsAskingForAudio() const { |
| return old_audio_setting_ == CONTENT_SETTING_ASK; |
| } |
| @@ -309,6 +338,7 @@ void MediaStreamDevicesController::RunCallback( |
| ContentSetting audio_setting, |
| ContentSetting video_setting, |
| content::MediaStreamRequestResult denial_reason) { |
| + CHECK(!callback_.is_null()); |
| StorePermission(audio_setting, video_setting); |
| UpdateTabSpecificContentSettings(audio_setting, video_setting); |