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

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

Issue 2463393003: Record permission prompt gesture metrics on Android. (Closed)
Patch Set: Address comments 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_request_impl.h" 5 #include "chrome/browser/permissions/permission_request_impl.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/permissions/permission_uma_util.h" 8 #include "chrome/browser/permissions/permission_uma_util.h"
9 #include "chrome/browser/permissions/permission_util.h" 9 #include "chrome/browser/permissions/permission_util.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 delete_callback_.Run(); 138 delete_callback_.Run();
139 } 139 }
140 140
141 bool PermissionRequestImpl::ShouldShowPersistenceToggle() const { 141 bool PermissionRequestImpl::ShouldShowPersistenceToggle() const {
142 return (permission_type_ == content::PermissionType::GEOLOCATION) && 142 return (permission_type_ == content::PermissionType::GEOLOCATION) &&
143 PermissionUtil::ShouldShowPersistenceToggle(); 143 PermissionUtil::ShouldShowPersistenceToggle();
144 } 144 }
145 145
146 PermissionRequestType PermissionRequestImpl::GetPermissionRequestType() 146 PermissionRequestType PermissionRequestImpl::GetPermissionRequestType()
147 const { 147 const {
148 switch (permission_type_) { 148 return PermissionUtil::GetRequestType(permission_type_);
149 case content::PermissionType::GEOLOCATION:
150 return PermissionRequestType::PERMISSION_GEOLOCATION;
151 #if defined(ENABLE_NOTIFICATIONS)
152 case content::PermissionType::NOTIFICATIONS:
153 return PermissionRequestType::PERMISSION_NOTIFICATIONS;
154 #endif
155 case content::PermissionType::MIDI_SYSEX:
156 return PermissionRequestType::PERMISSION_MIDI_SYSEX;
157 case content::PermissionType::PUSH_MESSAGING:
158 return PermissionRequestType::PERMISSION_PUSH_MESSAGING;
159 #if defined(OS_CHROMEOS)
160 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
161 return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER;
162 #endif
163 case content::PermissionType::FLASH:
164 return PermissionRequestType::PERMISSION_FLASH;
165 default:
166 NOTREACHED();
167 return PermissionRequestType::UNKNOWN;
168 }
169 } 149 }
170 150
171 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() 151 PermissionRequestGestureType PermissionRequestImpl::GetGestureType()
172 const { 152 const {
173 return has_gesture_ ? PermissionRequestGestureType::GESTURE 153 return PermissionUtil::GetGestureType(has_gesture_);
174 : PermissionRequestGestureType::NO_GESTURE;
175 } 154 }
176 155
177 ContentSettingsType PermissionRequestImpl::GetContentSettingsType() const { 156 ContentSettingsType PermissionRequestImpl::GetContentSettingsType() const {
178 switch (permission_type_) { 157 switch (permission_type_) {
179 case content::PermissionType::GEOLOCATION: 158 case content::PermissionType::GEOLOCATION:
180 return CONTENT_SETTINGS_TYPE_GEOLOCATION; 159 return CONTENT_SETTINGS_TYPE_GEOLOCATION;
181 case content::PermissionType::PUSH_MESSAGING: 160 case content::PermissionType::PUSH_MESSAGING:
182 #if defined(ENABLE_NOTIFICATIONS) 161 #if defined(ENABLE_NOTIFICATIONS)
183 case content::PermissionType::NOTIFICATIONS: 162 case content::PermissionType::NOTIFICATIONS:
184 #endif 163 #endif
185 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; 164 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
186 case content::PermissionType::MIDI_SYSEX: 165 case content::PermissionType::MIDI_SYSEX:
187 return CONTENT_SETTINGS_TYPE_MIDI_SYSEX; 166 return CONTENT_SETTINGS_TYPE_MIDI_SYSEX;
188 #if defined(OS_CHROMEOS) 167 #if defined(OS_CHROMEOS)
189 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: 168 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
190 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; 169 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER;
191 #endif 170 #endif
192 case content::PermissionType::FLASH: 171 case content::PermissionType::FLASH:
193 return CONTENT_SETTINGS_TYPE_PLUGINS; 172 return CONTENT_SETTINGS_TYPE_PLUGINS;
194 default: 173 default:
195 NOTREACHED(); 174 NOTREACHED();
196 return CONTENT_SETTINGS_TYPE_DEFAULT; 175 return CONTENT_SETTINGS_TYPE_DEFAULT;
197 } 176 }
198 } 177 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_queue_controller.cc ('k') | chrome/browser/permissions/permission_uma_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698