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

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

Issue 2153133002: Add gesture type value from desktop prompt to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-user-gesture-to-reporting-part
Patch Set: Change back mistake Created 4 years, 4 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_uma_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_uma_util.h" 5 #include "chrome/browser/permissions/permission_uma_util.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // Make sure you update histograms.xml permission histogram_suffix if you 210 // Make sure you update histograms.xml permission histogram_suffix if you
211 // add new permission 211 // add new permission
212 void PermissionUmaUtil::PermissionRequested(PermissionType permission, 212 void PermissionUmaUtil::PermissionRequested(PermissionType permission,
213 const GURL& requesting_origin, 213 const GURL& requesting_origin,
214 const GURL& embedding_origin, 214 const GURL& embedding_origin,
215 Profile* profile) { 215 Profile* profile) {
216 RecordPermissionRequest(permission, requesting_origin, embedding_origin, 216 RecordPermissionRequest(permission, requesting_origin, embedding_origin,
217 profile); 217 profile);
218 } 218 }
219 219
220 void PermissionUmaUtil::PermissionGranted(PermissionType permission, 220 void PermissionUmaUtil::PermissionGranted(
221 const GURL& requesting_origin, 221 PermissionType permission,
222 Profile* profile) { 222 PermissionRequestGestureType gesture_type,
223 const GURL& requesting_origin,
224 Profile* profile) {
223 RecordPermissionAction(permission, GRANTED, PermissionSourceUI::PROMPT, 225 RecordPermissionAction(permission, GRANTED, PermissionSourceUI::PROMPT,
224 requesting_origin, profile); 226 gesture_type, requesting_origin, profile);
225 } 227 }
226 228
227 void PermissionUmaUtil::PermissionDenied(PermissionType permission, 229 void PermissionUmaUtil::PermissionDenied(
228 const GURL& requesting_origin, 230 PermissionType permission,
229 Profile* profile) { 231 PermissionRequestGestureType gesture_type,
232 const GURL& requesting_origin,
233 Profile* profile) {
230 RecordPermissionAction(permission, DENIED, PermissionSourceUI::PROMPT, 234 RecordPermissionAction(permission, DENIED, PermissionSourceUI::PROMPT,
231 requesting_origin, profile); 235 gesture_type, requesting_origin, profile);
232 } 236 }
233 237
234 void PermissionUmaUtil::PermissionDismissed(PermissionType permission, 238 void PermissionUmaUtil::PermissionDismissed(
235 const GURL& requesting_origin, 239 PermissionType permission,
236 Profile* profile) { 240 PermissionRequestGestureType gesture_type,
241 const GURL& requesting_origin,
242 Profile* profile) {
237 RecordPermissionAction(permission, DISMISSED, PermissionSourceUI::PROMPT, 243 RecordPermissionAction(permission, DISMISSED, PermissionSourceUI::PROMPT,
238 requesting_origin, profile); 244 gesture_type, requesting_origin, profile);
239 } 245 }
240 246
241 void PermissionUmaUtil::PermissionIgnored(PermissionType permission, 247 void PermissionUmaUtil::PermissionIgnored(
242 const GURL& requesting_origin, 248 PermissionType permission,
243 Profile* profile) { 249 PermissionRequestGestureType gesture_type,
250 const GURL& requesting_origin,
251 Profile* profile) {
244 RecordPermissionAction(permission, IGNORED, PermissionSourceUI::PROMPT, 252 RecordPermissionAction(permission, IGNORED, PermissionSourceUI::PROMPT,
245 requesting_origin, profile); 253 gesture_type, requesting_origin, profile);
246 } 254 }
247 255
248 void PermissionUmaUtil::PermissionRevoked(PermissionType permission, 256 void PermissionUmaUtil::PermissionRevoked(PermissionType permission,
249 PermissionSourceUI source_ui, 257 PermissionSourceUI source_ui,
250 const GURL& revoked_origin, 258 const GURL& revoked_origin,
251 Profile* profile) { 259 Profile* profile) {
252 // TODO(tsergeant): Expand metrics definitions for revocation to include all 260 // TODO(tsergeant): Expand metrics definitions for revocation to include all
253 // permissions. 261 // permissions.
254 if (permission == PermissionType::NOTIFICATIONS || 262 if (permission == PermissionType::NOTIFICATIONS ||
255 permission == PermissionType::GEOLOCATION || 263 permission == PermissionType::GEOLOCATION ||
256 permission == PermissionType::AUDIO_CAPTURE || 264 permission == PermissionType::AUDIO_CAPTURE ||
257 permission == PermissionType::VIDEO_CAPTURE) { 265 permission == PermissionType::VIDEO_CAPTURE) {
258 RecordPermissionAction(permission, REVOKED, source_ui, revoked_origin, 266 RecordPermissionAction(permission, REVOKED, source_ui,
259 profile); 267 PermissionRequestGestureType::UNKNOWN,
timvolodine 2016/07/26 14:47:40 maybe add a comment explaining why this has to be
stefanocs 2016/07/27 03:38:29 Done.
268 revoked_origin, profile);
260 } 269 }
261 } 270 }
262 271
263 void PermissionUmaUtil::PermissionPromptShown( 272 void PermissionUmaUtil::PermissionPromptShown(
264 const std::vector<PermissionRequest*>& requests) { 273 const std::vector<PermissionRequest*>& requests) {
265 DCHECK(!requests.empty()); 274 DCHECK(!requests.empty());
266 275
267 PermissionRequestType permission_prompt_type = 276 PermissionRequestType permission_prompt_type =
268 PermissionRequestType::MULTIPLE; 277 PermissionRequestType::MULTIPLE;
269 PermissionRequestGestureType permission_gesture_type = 278 PermissionRequestGestureType permission_gesture_type =
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 syncer::ModelTypeSet preferred_data_types = 379 syncer::ModelTypeSet preferred_data_types =
371 profile_sync_service->GetPreferredDataTypes(); 380 profile_sync_service->GetPreferredDataTypes();
372 if (!preferred_data_types.Has(syncer::PROXY_TABS)) 381 if (!preferred_data_types.Has(syncer::PROXY_TABS))
373 return false; 382 return false;
374 if (!preferred_data_types.Has(syncer::PRIORITY_PREFERENCES)) 383 if (!preferred_data_types.Has(syncer::PRIORITY_PREFERENCES))
375 return false; 384 return false;
376 385
377 return true; 386 return true;
378 } 387 }
379 388
380 void PermissionUmaUtil::RecordPermissionAction(PermissionType permission, 389 void PermissionUmaUtil::RecordPermissionAction(
381 PermissionAction action, 390 PermissionType permission,
382 PermissionSourceUI source_ui, 391 PermissionAction action,
383 const GURL& requesting_origin, 392 PermissionSourceUI source_ui,
384 Profile* profile) { 393 PermissionRequestGestureType gesture_type,
394 const GURL& requesting_origin,
395 Profile* profile) {
385 if (IsOptedIntoPermissionActionReporting(profile)) { 396 if (IsOptedIntoPermissionActionReporting(profile)) {
386 // TODO(stefanocs): Add browsertests to make sure the reports are being 397 // TODO(stefanocs): Add browsertests to make sure the reports are being
387 // sent. 398 // sent.
388 // TODO(stefanocs): Get the actual |user_gesture| from permission layer.
389 g_browser_process->safe_browsing_service() 399 g_browser_process->safe_browsing_service()
390 ->ui_manager() 400 ->ui_manager()
391 ->ReportPermissionAction(requesting_origin, permission, action, 401 ->ReportPermissionAction(requesting_origin, permission, action,
392 source_ui, 402 source_ui, gesture_type);
393 PermissionRequestGestureType::UNKNOWN);
394 } 403 }
395 404
396 bool secure_origin = content::IsOriginSecure(requesting_origin); 405 bool secure_origin = content::IsOriginSecure(requesting_origin);
397 406
398 switch (permission) { 407 switch (permission) {
399 case PermissionType::GEOLOCATION: 408 case PermissionType::GEOLOCATION:
400 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Geolocation", 409 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Geolocation",
401 "Permissions.Action.SecureOrigin.Geolocation", 410 "Permissions.Action.SecureOrigin.Geolocation",
402 "Permissions.Action.InsecureOrigin.Geolocation", 411 "Permissions.Action.InsecureOrigin.Geolocation",
403 action); 412 action);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 if (!deprecated_metric.empty() && rappor_service) { 472 if (!deprecated_metric.empty() && rappor_service) {
464 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, 473 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric,
465 requesting_origin); 474 requesting_origin);
466 475
467 std::string rappor_metric = deprecated_metric + "2"; 476 std::string rappor_metric = deprecated_metric + "2";
468 rappor_service->RecordSample( 477 rappor_service->RecordSample(
469 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 478 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
470 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); 479 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
471 } 480 }
472 } 481 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_uma_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698