| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 permission == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | 362 permission == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
| 363 permission == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { | 363 permission == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { |
| 364 // An unknown gesture type is passed in since gesture type is only | 364 // An unknown gesture type is passed in since gesture type is only |
| 365 // applicable in prompt UIs where revocations are not possible. | 365 // applicable in prompt UIs where revocations are not possible. |
| 366 RecordPermissionAction(permission, REVOKED, source_ui, | 366 RecordPermissionAction(permission, REVOKED, source_ui, |
| 367 PermissionRequestGestureType::UNKNOWN, | 367 PermissionRequestGestureType::UNKNOWN, |
| 368 revoked_origin, profile); | 368 revoked_origin, profile); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 | 371 |
| 372 void PermissionUmaUtil::RecordPermissionEmbargoStatus( | 372 void PermissionUmaUtil::RecordEmbargoPromptSuppression( |
| 373 PermissionEmbargoStatus embargo_status) { |
| 374 UMA_HISTOGRAM_ENUMERATION("Permissions.AutoBlocker.EmbargoPromptSuppression", |
| 375 embargo_status, |
| 376 PermissionEmbargoStatus::STATUS_NUM); |
| 377 } |
| 378 |
| 379 void PermissionUmaUtil::RecordEmbargoPromptSuppressionFromSource( |
| 380 PermissionStatusSource source) { |
| 381 // Explicitly switch to ensure that any new PermissionStatusSource values are |
| 382 // dealt with appropriately. |
| 383 switch (source) { |
| 384 case PermissionStatusSource::MULTIPLE_DISMISSALS: |
| 385 PermissionUmaUtil::RecordEmbargoPromptSuppression( |
| 386 PermissionEmbargoStatus::REPEATED_DISMISSALS); |
| 387 break; |
| 388 case PermissionStatusSource::SAFE_BROWSING_BLACKLIST: |
| 389 PermissionUmaUtil::RecordEmbargoPromptSuppression( |
| 390 PermissionEmbargoStatus::PERMISSIONS_BLACKLISTING); |
| 391 break; |
| 392 case PermissionStatusSource::UNSPECIFIED: |
| 393 case PermissionStatusSource::KILL_SWITCH: |
| 394 // The permission wasn't under embargo, so don't record anything. We may |
| 395 // embargo it later. |
| 396 break; |
| 397 } |
| 398 } |
| 399 |
| 400 void PermissionUmaUtil::RecordEmbargoStatus( |
| 373 PermissionEmbargoStatus embargo_status) { | 401 PermissionEmbargoStatus embargo_status) { |
| 374 UMA_HISTOGRAM_ENUMERATION("Permissions.AutoBlocker.EmbargoStatus", | 402 UMA_HISTOGRAM_ENUMERATION("Permissions.AutoBlocker.EmbargoStatus", |
| 375 embargo_status, | 403 embargo_status, |
| 376 PermissionEmbargoStatus::STATUS_NUM); | 404 PermissionEmbargoStatus::STATUS_NUM); |
| 377 } | 405 } |
| 378 | 406 |
| 379 void PermissionUmaUtil::RecordSafeBrowsingResponse( | 407 void PermissionUmaUtil::RecordSafeBrowsingResponse( |
| 380 base::TimeDelta response_time, | 408 base::TimeDelta response_time, |
| 381 SafeBrowsingResponse response) { | 409 SafeBrowsingResponse response) { |
| 382 UMA_HISTOGRAM_TIMES("Permissions.AutoBlocker.SafeBrowsingResponseTime", | 410 UMA_HISTOGRAM_TIMES("Permissions.AutoBlocker.SafeBrowsingResponseTime", |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 if (!deprecated_metric.empty() && rappor_service) { | 764 if (!deprecated_metric.empty() && rappor_service) { |
| 737 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, | 765 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, |
| 738 requesting_origin); | 766 requesting_origin); |
| 739 | 767 |
| 740 std::string rappor_metric = deprecated_metric + "2"; | 768 std::string rappor_metric = deprecated_metric + "2"; |
| 741 rappor_service->RecordSampleString( | 769 rappor_service->RecordSampleString( |
| 742 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, | 770 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, |
| 743 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); | 771 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); |
| 744 } | 772 } |
| 745 } | 773 } |
| OLD | NEW |