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_capture_devices_dispatcher.h" | 5 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/browser_finder.h" | 22 #include "chrome/browser/ui/browser_finder.h" |
23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
24 #include "chrome/browser/ui/screen_capture_notification_ui.h" | 24 #include "chrome/browser/ui/screen_capture_notification_ui.h" |
25 #include "chrome/browser/ui/simple_message_box.h" | 25 #include "chrome/browser/ui/simple_message_box.h" |
26 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 26 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/chrome_version_info.h" | 28 #include "chrome/common/chrome_version_info.h" |
29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
30 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
31 #include "components/content_settings/core/browser/content_settings_provider.h" | |
32 #include "components/content_settings/core/browser/host_content_settings_map.h" | 31 #include "components/content_settings/core/browser/host_content_settings_map.h" |
33 #include "components/pref_registry/pref_registry_syncable.h" | 32 #include "components/pref_registry/pref_registry_syncable.h" |
34 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
35 #include "content/public/browser/desktop_media_id.h" | 34 #include "content/public/browser/desktop_media_id.h" |
36 #include "content/public/browser/media_capture_devices.h" | 35 #include "content/public/browser/media_capture_devices.h" |
37 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
38 #include "content/public/browser/notification_source.h" | 37 #include "content/public/browser/notification_source.h" |
39 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
40 #include "content/public/browser/render_frame_host.h" | 39 #include "content/public/browser/render_frame_host.h" |
41 #include "content/public/browser/render_process_host.h" | 40 #include "content/public/browser/render_process_host.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 : prefs::kVideoCaptureAllowedUrls; | 407 : prefs::kVideoCaptureAllowedUrls; |
409 if (GetDevicePolicy( | 408 if (GetDevicePolicy( |
410 profile, security_origin, policy_name, list_policy_name) == | 409 profile, security_origin, policy_name, list_policy_name) == |
411 ALWAYS_ALLOW) { | 410 ALWAYS_ALLOW) { |
412 return true; | 411 return true; |
413 } | 412 } |
414 | 413 |
415 // There's no secondary URL for these content types, hence duplicating | 414 // There's no secondary URL for these content types, hence duplicating |
416 // |security_origin|. | 415 // |security_origin|. |
417 if (profile->GetHostContentSettingsMap()->GetContentSetting( | 416 if (profile->GetHostContentSettingsMap()->GetContentSetting( |
418 security_origin, | 417 security_origin, security_origin, |
419 security_origin, | |
420 type == content::MEDIA_DEVICE_AUDIO_CAPTURE | 418 type == content::MEDIA_DEVICE_AUDIO_CAPTURE |
421 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC | 419 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC |
422 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | 420 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
423 NO_RESOURCE_IDENTIFIER) == CONTENT_SETTING_ALLOW) { | 421 NoResourceIdentifier::GetResourceIdentifier()) == |
| 422 CONTENT_SETTING_ALLOW) { |
424 return true; | 423 return true; |
425 } | 424 } |
426 | 425 |
427 return false; | 426 return false; |
428 } | 427 } |
429 | 428 |
430 bool MediaCaptureDevicesDispatcher::CheckMediaAccessPermission( | 429 bool MediaCaptureDevicesDispatcher::CheckMediaAccessPermission( |
431 content::WebContents* web_contents, | 430 content::WebContents* web_contents, |
432 const GURL& security_origin, | 431 const GURL& security_origin, |
433 content::MediaStreamType type) { | 432 content::MediaStreamType type) { |
(...skipping 15 matching lines...) Expand all Loading... |
449 : prefs::kVideoCaptureAllowedUrls; | 448 : prefs::kVideoCaptureAllowedUrls; |
450 if (GetDevicePolicy( | 449 if (GetDevicePolicy( |
451 profile, security_origin, policy_name, list_policy_name) == | 450 profile, security_origin, policy_name, list_policy_name) == |
452 ALWAYS_ALLOW) { | 451 ALWAYS_ALLOW) { |
453 return true; | 452 return true; |
454 } | 453 } |
455 | 454 |
456 // There's no secondary URL for these content types, hence duplicating | 455 // There's no secondary URL for these content types, hence duplicating |
457 // |security_origin|. | 456 // |security_origin|. |
458 if (profile->GetHostContentSettingsMap()->GetContentSetting( | 457 if (profile->GetHostContentSettingsMap()->GetContentSetting( |
459 security_origin, | 458 security_origin, security_origin, |
460 security_origin, | |
461 type == content::MEDIA_DEVICE_AUDIO_CAPTURE | 459 type == content::MEDIA_DEVICE_AUDIO_CAPTURE |
462 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC | 460 ? CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC |
463 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | 461 : CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
464 NO_RESOURCE_IDENTIFIER) == CONTENT_SETTING_ALLOW) { | 462 NoResourceIdentifier::GetResourceIdentifier()) == |
| 463 CONTENT_SETTING_ALLOW) { |
465 return true; | 464 return true; |
466 } | 465 } |
467 | 466 |
468 return false; | 467 return false; |
469 } | 468 } |
470 | 469 |
471 #if defined(ENABLE_EXTENSIONS) | 470 #if defined(ENABLE_EXTENSIONS) |
472 bool MediaCaptureDevicesDispatcher::CheckMediaAccessPermission( | 471 bool MediaCaptureDevicesDispatcher::CheckMediaAccessPermission( |
473 content::WebContents* web_contents, | 472 content::WebContents* web_contents, |
474 const GURL& security_origin, | 473 const GURL& security_origin, |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 | 1135 |
1137 void MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices( | 1136 void MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices( |
1138 const MediaStreamDevices& devices) { | 1137 const MediaStreamDevices& devices) { |
1139 test_audio_devices_ = devices; | 1138 test_audio_devices_ = devices; |
1140 } | 1139 } |
1141 | 1140 |
1142 void MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices( | 1141 void MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices( |
1143 const MediaStreamDevices& devices) { | 1142 const MediaStreamDevices& devices) { |
1144 test_video_devices_ = devices; | 1143 test_video_devices_ = devices; |
1145 } | 1144 } |
OLD | NEW |