| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 11 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 11 #include "chrome/browser/media/media_stream_capture_indicator.h" | 12 #include "chrome/browser/media/media_stream_capture_indicator.h" |
| 12 #include "chrome/browser/media/media_stream_device_permissions.h" | 13 #include "chrome/browser/media/media_stream_device_permissions.h" |
| 13 #include "chrome/browser/media/media_stream_devices_controller.h" | 14 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 14 #include "chrome/browser/media/webrtc_browsertest_base.h" | 15 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 policy_name = prefs::kVideoCaptureAllowed; | 85 policy_name = prefs::kVideoCaptureAllowed; |
| 85 break; | 86 break; |
| 86 } | 87 } |
| 87 prefs->SetBoolean(policy_name, access == ACCESS_ALLOWED); | 88 prefs->SetBoolean(policy_name, access == ACCESS_ALLOWED); |
| 88 } | 89 } |
| 89 | 90 |
| 90 // Set the content settings for mic/cam. | 91 // Set the content settings for mic/cam. |
| 91 void SetContentSettings(ContentSetting mic_setting, | 92 void SetContentSettings(ContentSetting mic_setting, |
| 92 ContentSetting cam_setting) { | 93 ContentSetting cam_setting) { |
| 93 HostContentSettingsMap* content_settings = | 94 HostContentSettingsMap* content_settings = |
| 94 Profile::FromBrowserContext(GetWebContents()->GetBrowserContext()) | 95 HostContentSettingsMapFactory::GetForProfile( |
| 95 ->GetHostContentSettingsMap(); | 96 Profile::FromBrowserContext(GetWebContents()->GetBrowserContext())); |
| 96 ContentSettingsPattern pattern = | 97 ContentSettingsPattern pattern = |
| 97 ContentSettingsPattern::FromURLNoWildcard(example_url_); | 98 ContentSettingsPattern::FromURLNoWildcard(example_url_); |
| 98 content_settings->SetContentSetting(pattern, pattern, | 99 content_settings->SetContentSetting(pattern, pattern, |
| 99 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, | 100 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
| 100 std::string(), mic_setting); | 101 std::string(), mic_setting); |
| 101 content_settings->SetContentSetting( | 102 content_settings->SetContentSetting( |
| 102 pattern, pattern, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | 103 pattern, pattern, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
| 103 std::string(), cam_setting); | 104 std::string(), cam_setting); |
| 104 } | 105 } |
| 105 | 106 |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 InitWithUrl(GURL("http://www.example.com")); | 706 InitWithUrl(GURL("http://www.example.com")); |
| 706 SetContentSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ALLOW); | 707 SetContentSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ALLOW); |
| 707 | 708 |
| 708 MediaStreamDevicesController controller( | 709 MediaStreamDevicesController controller( |
| 709 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), | 710 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 710 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 711 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 711 this)); | 712 this)); |
| 712 ASSERT_TRUE(controller.IsAskingForAudio()); | 713 ASSERT_TRUE(controller.IsAskingForAudio()); |
| 713 ASSERT_TRUE(controller.IsAskingForVideo()); | 714 ASSERT_TRUE(controller.IsAskingForVideo()); |
| 714 } | 715 } |
| OLD | NEW |