Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 DCHECK(!requests.empty()); | 349 DCHECK(!requests.empty()); |
| 350 DCHECK(requests.size() == 1); | 350 DCHECK(requests.size() == 1); |
| 351 | 351 |
| 352 PERMISSION_BUBBLE_TYPE_UMA(kPermissionsPromptDenied, | 352 PERMISSION_BUBBLE_TYPE_UMA(kPermissionsPromptDenied, |
| 353 requests[0]->GetPermissionRequestType()); | 353 requests[0]->GetPermissionRequestType()); |
| 354 PERMISSION_BUBBLE_GESTURE_TYPE_UMA( | 354 PERMISSION_BUBBLE_GESTURE_TYPE_UMA( |
| 355 kPermissionsPromptDeniedGesture, kPermissionsPromptDeniedNoGesture, | 355 kPermissionsPromptDeniedGesture, kPermissionsPromptDeniedNoGesture, |
| 356 requests[0]->GetGestureType(), requests[0]->GetPermissionRequestType()); | 356 requests[0]->GetGestureType(), requests[0]->GetPermissionRequestType()); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void PermissionUmaUtil::PermissionPromptDismissCount( | |
|
raymes
2016/08/06 00:50:21
Please get Kendra to take a look at this for the m
dominickn
2016/08/08 02:18:28
Will do.
| |
| 360 content::PermissionType permission, | |
| 361 int count) { | |
| 362 switch (permission) { | |
| 363 case PermissionType::GEOLOCATION: | |
| 364 UMA_HISTOGRAM_COUNTS_100("Permissions.DismissCount.Geolocation", count); | |
| 365 break; | |
| 366 case PermissionType::NOTIFICATIONS: | |
| 367 UMA_HISTOGRAM_COUNTS_100("Permissions.DismissCount.Notifications", count); | |
| 368 break; | |
| 369 case PermissionType::MIDI_SYSEX: | |
| 370 UMA_HISTOGRAM_COUNTS_100("Permissions.DismissCount.MidiSysEx", count); | |
| 371 break; | |
| 372 case PermissionType::PUSH_MESSAGING: | |
| 373 UMA_HISTOGRAM_COUNTS_100("Permissions.DismissCount.PushMessaging", count); | |
| 374 break; | |
| 375 case PermissionType::PROTECTED_MEDIA_IDENTIFIER: | |
| 376 UMA_HISTOGRAM_COUNTS_100("Permissions.DismissCount.ProtectedMedia", | |
| 377 count); | |
| 378 break; | |
| 379 case PermissionType::DURABLE_STORAGE: | |
| 380 UMA_HISTOGRAM_COUNTS_100("Permissions.DismissCount.DurableStorage", | |
| 381 count); | |
| 382 break; | |
| 383 case PermissionType::AUDIO_CAPTURE: | |
| 384 UMA_HISTOGRAM_COUNTS_100("Permissions.DismissCount.AudioCapture", count); | |
| 385 break; | |
| 386 case PermissionType::VIDEO_CAPTURE: | |
| 387 UMA_HISTOGRAM_COUNTS_100("Permissions.DismissCount.VideoCapture", count); | |
| 388 break; | |
| 389 // The user is not prompted for these permissions, thus there is no dismiss | |
| 390 // recorded for them. | |
| 391 case PermissionType::MIDI: | |
| 392 case PermissionType::BACKGROUND_SYNC: | |
| 393 case PermissionType::NUM: | |
| 394 NOTREACHED() << "PERMISSION " | |
| 395 << PermissionUtil::GetPermissionString(permission) | |
| 396 << " not accounted for"; | |
| 397 } | |
| 398 } | |
| 399 | |
| 359 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) { | 400 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) { |
| 360 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 401 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 361 switches::kEnablePermissionActionReporting)) | 402 switches::kEnablePermissionActionReporting)) |
| 362 return false; | 403 return false; |
| 363 | 404 |
| 364 DCHECK(profile); | 405 DCHECK(profile); |
| 365 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) | 406 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) |
| 366 return false; | 407 return false; |
| 367 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) | 408 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) |
| 368 return false; | 409 return false; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 if (!deprecated_metric.empty() && rappor_service) { | 513 if (!deprecated_metric.empty() && rappor_service) { |
| 473 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, | 514 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, |
| 474 requesting_origin); | 515 requesting_origin); |
| 475 | 516 |
| 476 std::string rappor_metric = deprecated_metric + "2"; | 517 std::string rappor_metric = deprecated_metric + "2"; |
| 477 rappor_service->RecordSample( | 518 rappor_service->RecordSample( |
| 478 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, | 519 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, |
| 479 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); | 520 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); |
| 480 } | 521 } |
| 481 } | 522 } |
| OLD | NEW |