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

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

Issue 2463393003: Record permission prompt gesture metrics on Android. (Closed)
Patch Set: Created 4 years, 1 month 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
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/feature_list.h" 7 #include "base/feature_list.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
10 #include "chrome/browser/permissions/permission_uma_util.h" 10 #include "chrome/browser/permissions/permission_uma_util.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return "BackgroundSync"; 47 return "BackgroundSync";
48 case content::PermissionType::FLASH: 48 case content::PermissionType::FLASH:
49 return "Flash"; 49 return "Flash";
50 case content::PermissionType::NUM: 50 case content::PermissionType::NUM:
51 break; 51 break;
52 } 52 }
53 NOTREACHED(); 53 NOTREACHED();
54 return std::string(); 54 return std::string();
55 } 55 }
56 56
57 PermissionRequestGestureType PermissionUtil::GetGestureType(bool user_gesture) {
58 return user_gesture ? PermissionRequestGestureType::GESTURE
59 : PermissionRequestGestureType::NO_GESTURE;
60 }
61
62
57 bool PermissionUtil::GetPermissionType(ContentSettingsType type, 63 bool PermissionUtil::GetPermissionType(ContentSettingsType type,
58 PermissionType* out) { 64 PermissionType* out) {
59 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { 65 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
60 *out = PermissionType::GEOLOCATION; 66 *out = PermissionType::GEOLOCATION;
61 } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { 67 } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
62 *out = PermissionType::NOTIFICATIONS; 68 *out = PermissionType::NOTIFICATIONS;
63 } else if (type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { 69 } else if (type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) {
64 *out = PermissionType::MIDI_SYSEX; 70 *out = PermissionType::MIDI_SYSEX;
65 } else if (type == CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) { 71 } else if (type == CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) {
66 *out = PermissionType::DURABLE_STORAGE; 72 *out = PermissionType::DURABLE_STORAGE;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ContentSetting final_content_setting = settings_map->GetContentSetting( 137 ContentSetting final_content_setting = settings_map->GetContentSetting(
132 primary_url_, secondary_url_, content_type_, std::string()); 138 primary_url_, secondary_url_, content_type_, std::string());
133 if (final_content_setting != CONTENT_SETTING_ALLOW) { 139 if (final_content_setting != CONTENT_SETTING_ALLOW) {
134 PermissionType permission_type; 140 PermissionType permission_type;
135 if (PermissionUtil::GetPermissionType(content_type_, &permission_type)) { 141 if (PermissionUtil::GetPermissionType(content_type_, &permission_type)) {
136 PermissionUmaUtil::PermissionRevoked(permission_type, source_ui_, 142 PermissionUmaUtil::PermissionRevoked(permission_type, source_ui_,
137 primary_url_, profile_); 143 primary_url_, profile_);
138 } 144 }
139 } 145 }
140 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698