Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Side by Side Diff: chrome/browser/permissions/permission_util.cc

Issue 2701343002: Implement permission embargo suppression metrics. (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/permissions/permission_util.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // The returned strings must match the RAPPOR metrics in rappor.xml, 24 // The returned strings must match the RAPPOR metrics in rappor.xml,
19 // and any Field Trial configs for the Permissions kill switch e.g. 25 // and any Field Trial configs for the Permissions kill switch e.g.
20 // Permissions.Action.Geolocation etc.. 26 // Permissions.Action.Geolocation etc..
21 std::string PermissionUtil::GetPermissionString( 27 std::string PermissionUtil::GetPermissionString(
22 ContentSettingsType content_type) { 28 ContentSettingsType content_type) {
23 switch (content_type) { 29 switch (content_type) {
24 case CONTENT_SETTINGS_TYPE_GEOLOCATION: 30 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
25 return "Geolocation"; 31 return "Geolocation";
26 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 32 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
27 return "Notifications"; 33 return "Notifications";
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return; 189 return;
184 HostContentSettingsMap* settings_map = 190 HostContentSettingsMap* settings_map =
185 HostContentSettingsMapFactory::GetForProfile(profile_); 191 HostContentSettingsMapFactory::GetForProfile(profile_);
186 ContentSetting final_content_setting = settings_map->GetContentSetting( 192 ContentSetting final_content_setting = settings_map->GetContentSetting(
187 primary_url_, secondary_url_, content_type_, std::string()); 193 primary_url_, secondary_url_, content_type_, std::string());
188 if (final_content_setting != CONTENT_SETTING_ALLOW) { 194 if (final_content_setting != CONTENT_SETTING_ALLOW) {
189 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_, 195 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_,
190 primary_url_, profile_); 196 primary_url_, profile_);
191 } 197 }
192 } 198 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_util.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698