| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/webrtc/media_permission.h" | 5 #include "chrome/browser/media/webrtc/media_permission.h" |
| 6 | 6 |
| 7 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 7 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 8 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" | 8 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" |
| 9 #include "chrome/browser/permissions/permission_context_base.h" | 9 #include "chrome/browser/permissions/permission_context_base.h" |
| 10 #include "chrome/browser/permissions/permission_manager.h" | 10 #include "chrome/browser/permissions/permission_manager.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (!raw_list_value) { | 81 if (!raw_list_value) { |
| 82 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; | 82 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; |
| 83 return CONTENT_SETTING_BLOCK; | 83 return CONTENT_SETTING_BLOCK; |
| 84 } | 84 } |
| 85 | 85 |
| 86 const base::ListValue* list_value; | 86 const base::ListValue* list_value; |
| 87 const bool is_list = raw_list_value->GetAsList(&list_value); | 87 const bool is_list = raw_list_value->GetAsList(&list_value); |
| 88 DCHECK(is_list); | 88 DCHECK(is_list); |
| 89 for (const auto& base_value : *list_value) { | 89 for (const auto& base_value : *list_value) { |
| 90 std::string value; | 90 std::string value; |
| 91 if (base_value->GetAsString(&value)) { | 91 if (base_value.GetAsString(&value)) { |
| 92 const ContentSettingsPattern pattern = | 92 const ContentSettingsPattern pattern = |
| 93 ContentSettingsPattern::FromString(value); | 93 ContentSettingsPattern::FromString(value); |
| 94 if (pattern == ContentSettingsPattern::Wildcard()) { | 94 if (pattern == ContentSettingsPattern::Wildcard()) { |
| 95 LOG(WARNING) << "Ignoring wildcard URL pattern: " << value; | 95 LOG(WARNING) << "Ignoring wildcard URL pattern: " << value; |
| 96 continue; | 96 continue; |
| 97 } | 97 } |
| 98 if (pattern.IsValid() && pattern.Matches(requesting_origin_)) | 98 if (pattern.IsValid() && pattern.Matches(requesting_origin_)) |
| 99 return CONTENT_SETTING_ALLOW; | 99 return CONTENT_SETTING_ALLOW; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; | 103 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; |
| 104 return CONTENT_SETTING_BLOCK; | 104 return CONTENT_SETTING_BLOCK; |
| 105 } | 105 } |
| 106 #endif // defined(OS_CHROMEOS) | 106 #endif // defined(OS_CHROMEOS) |
| 107 | 107 |
| 108 // Check policy and content settings. | 108 // Check policy and content settings. |
| 109 ContentSetting content_setting = | 109 ContentSetting content_setting = |
| 110 permission_manager | 110 permission_manager |
| 111 ->GetPermissionStatus(content_type_, requesting_origin_, | 111 ->GetPermissionStatus(content_type_, requesting_origin_, |
| 112 embedding_origin_) | 112 embedding_origin_) |
| 113 .content_setting; | 113 .content_setting; |
| 114 if (content_setting == CONTENT_SETTING_BLOCK) | 114 if (content_setting == CONTENT_SETTING_BLOCK) |
| 115 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; | 115 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; |
| 116 return content_setting; | 116 return content_setting; |
| 117 } | 117 } |
| OLD | NEW |