| 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.AudioCapture", action, | 665 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.AudioCapture", action, |
| 666 PERMISSION_ACTION_NUM); | 666 PERMISSION_ACTION_NUM); |
| 667 break; | 667 break; |
| 668 case PermissionType::VIDEO_CAPTURE: | 668 case PermissionType::VIDEO_CAPTURE: |
| 669 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.VideoCapture", action, | 669 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.VideoCapture", action, |
| 670 PERMISSION_ACTION_NUM); | 670 PERMISSION_ACTION_NUM); |
| 671 break; | 671 break; |
| 672 case PermissionType::FLASH: | 672 case PermissionType::FLASH: |
| 673 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Flash", | 673 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Flash", |
| 674 "Permissions.Action.SecureOrigin.Flash", | 674 "Permissions.Action.SecureOrigin.Flash", |
| 675 "Permissions.Action.InsecureOrigin.Flash", | 675 "Permissions.Action.InsecureOrigin.Flash", action); |
| 676 action); | |
| 677 break; | 676 break; |
| 678 // The user is not prompted for these permissions, thus there is no | 677 // The user is not prompted for these permissions, thus there is no |
| 679 // permission action recorded for them. | 678 // permission action recorded for them. |
| 680 case PermissionType::MIDI: | 679 case PermissionType::MIDI: |
| 681 case PermissionType::BACKGROUND_SYNC: | 680 case PermissionType::BACKGROUND_SYNC: |
| 682 case PermissionType::NUM: | 681 case PermissionType::NUM: |
| 683 NOTREACHED() << "PERMISSION " | 682 NOTREACHED() << "PERMISSION " |
| 684 << PermissionUtil::GetPermissionString(permission) | 683 << PermissionUtil::GetPermissionString(permission) |
| 685 << " not accounted for"; | 684 << " not accounted for"; |
| 686 } | 685 } |
| 687 | 686 |
| 688 // Retrieve the name of the RAPPOR metric. Currently, the new metric name is | 687 // Retrieve the name of the RAPPOR metric. Currently, the new metric name is |
| 689 // the deprecated name with "2" on the end, e.g. | 688 // the deprecated name with "2" on the end, e.g. |
| 690 // ContentSettings.PermissionActions_Geolocation.Granted.Url2. For simplicity, | 689 // ContentSettings.PermissionActions_Geolocation.Granted.Url2. For simplicity, |
| 691 // we retrieve the deprecated name and append the "2" for the new name. | 690 // we retrieve the deprecated name and append the "2" for the new name. |
| 692 // TODO(dominickn): remove the deprecated metric and replace it solely with | 691 // TODO(dominickn): remove the deprecated metric and replace it solely with |
| 693 // the new one in GetRapporMetric - crbug.com/605836. | 692 // the new one in GetRapporMetric - crbug.com/605836. |
| 694 const std::string deprecated_metric = GetRapporMetric(permission, action); | 693 const std::string deprecated_metric = GetRapporMetric(permission, action); |
| 695 rappor::RapporService* rappor_service = g_browser_process->rappor_service(); | 694 rappor::RapporService* rappor_service = g_browser_process->rappor_service(); |
| 696 if (!deprecated_metric.empty() && rappor_service) { | 695 if (!deprecated_metric.empty() && rappor_service) { |
| 697 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, | 696 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, |
| 698 requesting_origin); | 697 requesting_origin); |
| 699 | 698 |
| 700 std::string rappor_metric = deprecated_metric + "2"; | 699 std::string rappor_metric = deprecated_metric + "2"; |
| 701 rappor_service->RecordSample( | 700 rappor_service->RecordSample( |
| 702 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, | 701 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, |
| 703 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); | 702 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); |
| 704 } | 703 } |
| 705 } | 704 } |
| OLD | NEW |