| 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" |
| 11 #include "chrome/browser/permissions/permission_uma_util.h" | 11 #include "chrome/browser/permissions/permission_uma_util.h" |
| 12 #include "chrome/common/chrome_features.h" | 12 #include "chrome/common/chrome_features.h" |
| 13 #include "components/content_settings/core/browser/host_content_settings_map.h" | 13 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 14 #include "content/public/browser/permission_type.h" | 14 #include "content/public/browser/permission_type.h" |
| 15 | 15 |
| 16 using content::PermissionType; | 16 using content::PermissionType; |
| 17 | 17 |
| 18 PermissionResult::PermissionResult(ContentSetting cs, |
| 19 PermissionStatusSource pss) |
| 20 : content_setting(cs), source(pss) {} |
| 21 |
| 22 PermissionResult::~PermissionResult() {} |
| 23 |
| 18 std::string PermissionUtil::GetPermissionString( | 24 std::string PermissionUtil::GetPermissionString( |
| 19 ContentSettingsType content_type) { | 25 ContentSettingsType content_type) { |
| 20 PermissionType permission_type; | 26 PermissionType permission_type; |
| 21 bool success = PermissionUtil::GetPermissionType( | 27 bool success = PermissionUtil::GetPermissionType( |
| 22 content_type, &permission_type); | 28 content_type, &permission_type); |
| 23 DCHECK(success); | 29 DCHECK(success); |
| 24 return GetPermissionString(permission_type); | 30 return GetPermissionString(permission_type); |
| 25 } | 31 } |
| 26 | 32 |
| 27 // The returned strings must match the RAPPOR metrics in rappor.xml, | 33 // The returned strings must match the RAPPOR metrics in rappor.xml, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 ContentSetting final_content_setting = settings_map->GetContentSetting( | 200 ContentSetting final_content_setting = settings_map->GetContentSetting( |
| 195 primary_url_, secondary_url_, content_type_, std::string()); | 201 primary_url_, secondary_url_, content_type_, std::string()); |
| 196 if (final_content_setting != CONTENT_SETTING_ALLOW) { | 202 if (final_content_setting != CONTENT_SETTING_ALLOW) { |
| 197 PermissionType permission_type; | 203 PermissionType permission_type; |
| 198 if (PermissionUtil::GetPermissionType(content_type_, &permission_type)) { | 204 if (PermissionUtil::GetPermissionType(content_type_, &permission_type)) { |
| 199 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_, | 205 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_, |
| 200 primary_url_, profile_); | 206 primary_url_, profile_); |
| 201 } | 207 } |
| 202 } | 208 } |
| 203 } | 209 } |
| OLD | NEW |