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/permissions/permission_util.h" | 5 #include "chrome/browser/permissions/permission_util.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 case CONTENT_SETTINGS_TYPE_PLUGINS: | 154 case CONTENT_SETTINGS_TYPE_PLUGINS: |
155 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 155 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
156 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 156 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
157 #endif | 157 #endif |
158 return true; | 158 return true; |
159 default: | 159 default: |
160 return false; | 160 return false; |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
| 164 PermissionStatusSource |
| 165 PermissionUtil::ConvertSettingSourceToPermissionStatusSource( |
| 166 content_settings::SettingSource source) { |
| 167 switch (source) { |
| 168 case content_settings::SETTING_SOURCE_NONE: |
| 169 case content_settings::SETTING_SOURCE_USER: |
| 170 case content_settings::SETTING_SOURCE_WHITELIST: |
| 171 case content_settings::SETTING_SOURCE_SUPERVISED: |
| 172 break; |
| 173 |
| 174 case content_settings::SETTING_SOURCE_POLICY: |
| 175 return PermissionStatusSource::ENTERPRISE_POLICY; |
| 176 case content_settings::SETTING_SOURCE_EXTENSION: |
| 177 return PermissionStatusSource::EXTENSION; |
| 178 } |
| 179 return PermissionStatusSource::UNSPECIFIED; |
| 180 } |
| 181 |
164 bool PermissionUtil::ShouldShowPersistenceToggle(ContentSettingsType type) { | 182 bool PermissionUtil::ShouldShowPersistenceToggle(ContentSettingsType type) { |
165 return (type == CONTENT_SETTINGS_TYPE_GEOLOCATION || | 183 return (type == CONTENT_SETTINGS_TYPE_GEOLOCATION || |
166 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | 184 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
167 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) && | 185 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) && |
168 base::FeatureList::IsEnabled( | 186 base::FeatureList::IsEnabled( |
169 features::kDisplayPersistenceToggleInPermissionPrompts); | 187 features::kDisplayPersistenceToggleInPermissionPrompts); |
170 } | 188 } |
171 | 189 |
172 PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter( | 190 PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter( |
173 Profile* profile, | 191 Profile* profile, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return; | 230 return; |
213 HostContentSettingsMap* settings_map = | 231 HostContentSettingsMap* settings_map = |
214 HostContentSettingsMapFactory::GetForProfile(profile_); | 232 HostContentSettingsMapFactory::GetForProfile(profile_); |
215 ContentSetting final_content_setting = settings_map->GetContentSetting( | 233 ContentSetting final_content_setting = settings_map->GetContentSetting( |
216 primary_url_, secondary_url_, content_type_, std::string()); | 234 primary_url_, secondary_url_, content_type_, std::string()); |
217 if (final_content_setting != CONTENT_SETTING_ALLOW) { | 235 if (final_content_setting != CONTENT_SETTING_ALLOW) { |
218 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_, | 236 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_, |
219 primary_url_, profile_); | 237 primary_url_, profile_); |
220 } | 238 } |
221 } | 239 } |
OLD | NEW |