// Copyright 2014 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_PERMISSIONS_PERMISSION_UMA_UTIL_H_ #define COMPONENTS_PERMISSIONS_PERMISSION_UMA_UTIL_H_ #include <optional> #include <set> #include <string> #include <vector> #include "base/memory/raw_ptr.h" #include "base/time/time.h" #include "base/version.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings_types.h" #include "components/permissions/permission_request.h" #include "components/permissions/prediction_service/prediction_service_messages.pb.h" #include "components/permissions/request_type.h" #include "content/public/browser/permission_result.h" #include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-forward.h" namespace blink { enum class PermissionType; } namespace content { class BrowserContext; class RenderFrameHost; class WebContents; class RenderFrameHost; } // namespace content class GURL; namespace permissions { enum class PermissionRequestGestureType; enum class PermissionAction; class PermissionRequest; enum class ActivityIndicatorState { … }; // Used for UMA to record the types of permission prompts shown. // When updating, you also need to update: // 1) The PermissionRequestType enum in // tools/metrics/histograms/metadata/permissions/enums.xml. // 2) The PermissionRequestTypes suffix list in // tools/metrics/histograms/metadata/histogram_suffixes_list.xml. // 3) GetPermissionRequestString function in // components/permissions/permission_uma_util.cc // // The usual rules of updating UMA values applies to this enum: // - don't remove values // - only ever add values at the end enum class RequestTypeForUma { … }; // Any new values should be inserted immediately prior to kMaxValue. enum class PermissionSourceUI { … }; // Any new values should be inserted immediately prior to NUM. enum class PermissionEmbargoStatus { … }; // Used for UMA to record the strict level of permission policy which is // configured to allow sub-frame origin. Any new values should be inserted // immediately prior to NUM. All values here should have corresponding entries // PermissionsPolicyConfiguration area of enums.xml. enum class PermissionHeaderPolicyForUMA { … }; // The kind of permission prompt UX used to surface a permission request. // Enum used in UKMs and UMAs, do not re-order or change values. Deprecated // items should only be commented out. New items should be added at the end, // and the "PermissionPromptDisposition" histogram suffix needs to be updated to // match (tools/metrics/histograms/metadata/histogram_suffixes_list.xml). enum class PermissionPromptDisposition { … }; // The reason why the permission prompt disposition was used. Enum used in UKMs, // do not re-order or change values. Deprecated items should only be commented // out. enum class PermissionPromptDispositionReason { … }; enum class AdaptiveTriggers { … }; enum class DismissedReason { … }; enum class OsScreen { … }; enum class OsScreenAction { … }; // These values are logged to UMA. Entries should not be renumbered and // numeric values should never be reused. Please keep in sync with // "OneTimePermissionEvent" in tools/metrics/histograms/enums.xml. enum class OneTimePermissionEvent { … }; // Prompt views shown after the user clicks on the embedded permission prompt. // The values represent the priority of each variant, higher number means // higher priority. // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum class ElementAnchoredBubbleVariant { … }; enum class PermissionAutoRevocationHistory { … }; // This enum backs up the `AutoDSEPermissionRevertTransition` histogram enum. // Never reuse values and mirror any updates to it. // Describes the transition that has occured for the setting of a DSE origin // when DSE autogrant becomes disabled. enum class AutoDSEPermissionRevertTransition { … }; // This enum backs up the 'PermissionPredictionSource` histogram enum. It // indicates whether the permission prediction was done by the local on device // model or by the server side model. enum class PermissionPredictionSource { … }; // This enum backs up the 'PageInfoDialogAccessType' histogram enum. // It is used for collecting page info access type metrics in the context of // the confirmation chip. enum class PageInfoDialogAccessType { … }; constexpr auto kConfirmationConsiderationDurationForUma = …; // This enum backs up the // 'Permissions.PageInfo.ChangedWithin1m.{PermissionType}' histograms enum. It // is used for collecting page info permission change metrics following in the // first minute after a PermissionAction has been taken. Note that // PermissionActions DISMISSED and IGNORED are not taken into account, as they // don't have an effect on the content settings. enum class PermissionChangeAction { … }; // This enum backs up the 'ElementAnchoredBubbleAction' histograms enum. enum class ElementAnchoredBubbleAction { … }; // The reason the permission action `PermissionAction::IGNORED` was triggered. enum class PermissionIgnoredReason { … }; // This enum backs up the // 'Permissions.PageInfo.Changed.{PermissionType}.Reallowed.Outcome' histograms // enum. It is used for collecting permission usage rates after permission // status was reallowed via PageInfo. It is applicable only if permission is // allowed as all other states are no-op for an origin. // // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum class PermissionChangeInfo { … }; // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.permissions // GENERATED_JAVA_CLASS_NAME_OVERRIDE: DismissalType enum class DismissalType { … }; // Provides a convenient way of logging UMA for permission related operations. class PermissionUmaUtil { … }; } // namespace permissions #endif // COMPONENTS_PERMISSIONS_PERMISSION_UMA_UTIL_H_