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

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

Issue 2046293002: Implement DelegationTracker for tracking delegated permissions to RenderFrameHosts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-delegation-2-blink
Patch Set: Implement DelegationTracker for tracking delegated permissions to RenderFrameHosts Created 4 years, 6 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') | chrome/chrome_browser.gypi » ('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 "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
9 #include "chrome/browser/permissions/permission_uma_util.h" 9 #include "chrome/browser/permissions/permission_uma_util.h"
10 #include "components/content_settings/core/browser/host_content_settings_map.h" 10 #include "components/content_settings/core/browser/host_content_settings_map.h"
11 #include "content/public/browser/permission_type.h" 11 #include "content/public/browser/permission_type.h"
12 12
13 using content::PermissionType; 13 using content::PermissionType;
14 14
15 std::size_t PermissionTypeHash::operator()(
16 const content::PermissionType& type) const {
17 return static_cast<size_t>(type);
18 }
19
15 // The returned strings must match the RAPPOR metrics in rappor.xml, 20 // The returned strings must match the RAPPOR metrics in rappor.xml,
16 // and any Field Trial configs for the Permissions kill switch e.g. 21 // and any Field Trial configs for the Permissions kill switch e.g.
17 // Permissions.Action.Geolocation etc.. 22 // Permissions.Action.Geolocation etc..
18 std::string PermissionUtil::GetPermissionString( 23 std::string PermissionUtil::GetPermissionString(
19 content::PermissionType permission) { 24 content::PermissionType permission) {
20 switch (permission) { 25 switch (permission) {
21 case content::PermissionType::GEOLOCATION: 26 case content::PermissionType::GEOLOCATION:
22 return "Geolocation"; 27 return "Geolocation";
23 case content::PermissionType::NOTIFICATIONS: 28 case content::PermissionType::NOTIFICATIONS:
24 return "Notifications"; 29 return "Notifications";
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 primary_url, secondary_url, content_type, resource_identifier); 97 primary_url, secondary_url, content_type, resource_identifier);
93 98
94 if (previous_value == CONTENT_SETTING_ALLOW && 99 if (previous_value == CONTENT_SETTING_ALLOW &&
95 final_value != CONTENT_SETTING_ALLOW) { 100 final_value != CONTENT_SETTING_ALLOW) {
96 PermissionType permission_type; 101 PermissionType permission_type;
97 if (PermissionUtil::GetPermissionType(content_type, &permission_type)) { 102 if (PermissionUtil::GetPermissionType(content_type, &permission_type)) {
98 PermissionUmaUtil::PermissionRevoked(permission_type, primary_url); 103 PermissionUmaUtil::PermissionRevoked(permission_type, primary_url);
99 } 104 }
100 } 105 }
101 } 106 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_util.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698