1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PERMISSIONS_PERMISSION_UMA_UTIL_H_
6 #define COMPONENTS_PERMISSIONS_PERMISSION_UMA_UTIL_H_
10 #include "base/memory/raw_ptr.h"
11 #include "base/time/time.h"
12 #include "base/version.h"
13 #include "components/content_settings/core/browser/host_content_settings_map.h"
14 #include "components/content_settings/core/common/content_settings_types.h"
15 #include "components/permissions/permission_request.h"
16 #include "components/permissions/prediction_service/prediction_service_messages.pb.h"
17 #include "components/permissions/request_type.h"
18 #include "content/public/browser/permission_result.h"
19 #include "third_party/abseil-cpp/absl/types/optional.h"
20 #include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-forward.h"
23 enum class PermissionType;
28 class RenderFrameHost;
30 class RenderFrameHost;
31 } // namespace content
35 namespace permissions {
36 enum class PermissionRequestGestureType;
37 enum class PermissionAction;
38 class PermissionRequest;
40 // Used for UMA to record the types of permission prompts shown.
41 // When updating, you also need to update:
42 // 1) The PermissionRequestType enum in tools/metrics/histograms/enums.xml.
43 // 2) The PermissionRequestTypes suffix list in
44 // tools/metrics/histograms/metadata/histogram_suffixes_list.xml.
45 // 3) GetPermissionRequestString below.
47 // The usual rules of updating UMA values applies to this enum:
48 // - don't remove values
49 // - only ever add values at the end
50 enum class RequestTypeForUma {
53 // UNUSED_PERMISSION = 2,
57 REGISTER_PROTOCOL_HANDLER = 6,
58 PERMISSION_GEOLOCATION = 7,
59 PERMISSION_MIDI_SYSEX = 8,
60 PERMISSION_NOTIFICATIONS = 9,
61 PERMISSION_PROTECTED_MEDIA_IDENTIFIER = 10,
62 // PERMISSION_PUSH_MESSAGING = 11,
63 PERMISSION_FLASH = 12,
64 PERMISSION_MEDIASTREAM_MIC = 13,
65 PERMISSION_MEDIASTREAM_CAMERA = 14,
66 PERMISSION_ACCESSIBILITY_EVENTS = 15,
67 // PERMISSION_CLIPBOARD_READ = 16, // Replaced by
68 // PERMISSION_CLIPBOARD_READ_WRITE in M81.
69 // PERMISSION_SECURITY_KEY_ATTESTATION = 17,
70 PERMISSION_PAYMENT_HANDLER = 18,
72 PERMISSION_CLIPBOARD_READ_WRITE = 20,
75 PERMISSION_STORAGE_ACCESS = 23,
76 PERMISSION_CAMERA_PAN_TILT_ZOOM = 24,
77 PERMISSION_WINDOW_MANAGEMENT = 25,
78 PERMISSION_LOCAL_FONTS = 26,
79 PERMISSION_IDLE_DETECTION = 27,
80 PERMISSION_FILE_HANDLING = 28,
81 // PERMISSION_U2F_API_REQUEST = 29,
82 PERMISSION_TOP_LEVEL_STORAGE_ACCESS = 30,
84 PERMISSION_FILE_SYSTEM_ACCESS = 32,
85 // NUM must be the last value in the enum.
89 // Any new values should be inserted immediately prior to NUM.
90 enum class PermissionSourceUI {
94 // Origin info bubble.
95 // https://www.chromium.org/Home/chromium-security/enamel/goals-for-the-origin-info-bubble
98 // chrome://settings/content/siteDetails?site=[SITE]
99 // chrome://settings/content/[PERMISSION TYPE]
102 // Page action bubble.
105 // Permission settings from Android.
106 // Currently this value is only used when revoking notification permission in
107 // Android O+ system channel settings.
108 ANDROID_SETTINGS = 4,
110 // Permission settings as part of the event's UI.
111 // Currently this value is only used when revoking notification permission
112 // through the notification UI.
115 // Permission settings changes as part of the abusive origins revocation.
118 // Always keep this at the end.
122 // Any new values should be inserted immediately prior to NUM.
123 enum class PermissionEmbargoStatus {
125 // Removed: PERMISSIONS_BLACKLISTING = 1,
126 REPEATED_DISMISSALS = 2,
127 REPEATED_IGNORES = 3,
130 // Keep this at the end.
134 // Used for UMA to record the strict level of permission policy which is
135 // configured to allow sub-frame origin. Any new values should be inserted
136 // immediately prior to NUM. All values here should have corresponding entries
137 // PermissionsPolicyConfiguration area of enums.xml.
138 enum class PermissionHeaderPolicyForUMA {
139 // No (or an invalid) Permissions-Policy header was present, results in an
140 // empty features list. It indicates none security-awareness of permissions
141 // policy configuration.
142 HEADER_NOT_PRESENT_OR_INVALID = 0,
144 // Permissions-Policy header was present, but it did not define an allowlist
145 // for the feature. It indicates less security-awareness of permissions policy
147 FEATURE_NOT_PRESENT = 1,
149 // The sub-frame origin is included in allow-list of permission
150 // policy. This indicates a good policy configuration.
151 FEATURE_ALLOWLIST_EXPLICITLY_MATCHES_ORIGIN = 2,
153 // Granted by setting value of permission policy to '*'. This also
154 // indicates a bad policy configuration.
155 FEATURE_ALLOWLIST_IS_WILDCARD = 3,
157 // The Permissions-Policy header was present and defined an empty
158 // allowlist for the feature. The feature will be disabled everywhere.
159 FEATURE_ALLOWLIST_IS_NONE = 4,
161 // The sub-frame origin is not explicitly declared in allow-list of top level
162 // permission policy. It generally indicates less security-awareness of
163 // policy configuration.
164 FEATURE_ALLOWLIST_DOES_NOT_MATCH_ORIGIN = 5,
166 // Always keep this at the end.
170 // The kind of permission prompt UX used to surface a permission request.
171 // Enum used in UKMs and UMAs, do not re-order or change values. Deprecated
172 // items should only be commented out. New items should be added at the end,
173 // and the "PermissionPromptDisposition" histogram suffix needs to be updated to
174 // match (tools/metrics/histograms/metadata/histogram_suffixes_list.xml).
175 enum class PermissionPromptDisposition {
176 // Not all permission actions will have an associated permission prompt (e.g.
177 // changing permission via the settings page).
180 // Only used on desktop, a bubble under the site settings padlock.
183 // Only used on desktop, a static indicator on the right-hand side of the
185 LOCATION_BAR_RIGHT_STATIC_ICON = 2,
187 // Only used on desktop, an animated indicator on the right-hand side of the
189 LOCATION_BAR_RIGHT_ANIMATED_ICON = 3,
191 // Only used on Android, a modal dialog.
194 // Only used on Android, an initially-collapsed infobar at the bottom of the
198 // Only used on desktop, a chip on the left-hand side of the location bar that
199 // shows a bubble when clicked.
200 LOCATION_BAR_LEFT_CHIP = 6,
202 // There was no UI being shown. This is usually because the user closed an
203 // inactive tab that had a pending permission request.
206 // Other custom modal dialogs.
207 CUSTOM_MODAL_DIALOG = 8,
209 // Only used on desktop, a less prominent version of chip on the left-hand
210 // side of the location bar that shows a bubble when clicked.
211 LOCATION_BAR_LEFT_QUIET_CHIP = 9,
213 // Only used on Android, a message bubble near top of the screen and below the
214 // location bar. Message UI is an alternative UI to infobar UI.
217 // Only used on desktop, a chip on the left-hand side of the location bar that
218 // automatically shows a bubble.
219 LOCATION_BAR_LEFT_QUIET_ABUSIVE_CHIP = 11,
221 // Only used on desktop, a chip on the left-hand side of the location bar that
222 // automatically shows a bubble.
223 LOCATION_BAR_LEFT_CHIP_AUTO_BUBBLE = 12,
225 // Only used on desktop, a bubble shown near the embedded permission element,
226 // after the user clicks on the element.
227 ELEMENT_ANCHORED_BUBBLE = 13,
230 // The reason why the permission prompt disposition was used. Enum used in UKMs,
231 // do not re-order or change values. Deprecated items should only be commented
233 enum class PermissionPromptDispositionReason {
234 // Disposition was selected in prefs.
235 USER_PREFERENCE_IN_SETTINGS = 0,
237 // Disposition was chosen because Safe Browsing classifies the origin
238 // as being spammy or abusive with permission requests.
239 SAFE_BROWSING_VERDICT = 1,
241 // Disposition was chosen based on grant likelihood predicted by the
242 // Web Permission Prediction Service.
243 PREDICTION_SERVICE = 2,
245 // Disposition was used as a fallback, if no selector made a decision.
246 DEFAULT_FALLBACK = 3,
248 // Disposition was chosen based on grant likelihood predicted by the On-Device
249 // Permission Prediction Model.
250 ON_DEVICE_PREDICTION_MODEL = 4,
253 enum class AdaptiveTriggers {
254 // None of the adaptive triggers were met. Currently this means two or less
255 // consecutive denies in a row.
258 // User denied permission prompt 3 or more times.
259 THREE_CONSECUTIVE_DENIES = 0x01,
262 // These values are logged to UMA. Entries should not be renumbered and
263 // numeric values should never be reused. Please keep in sync with
264 // "OneTimePermissionEvent" in tools/metrics/histograms/enums.xml.
265 enum class OneTimePermissionEvent {
266 // Recorded for each one time grant
267 GRANTED_ONE_TIME = 0,
269 // Recorded when the user manually revokes a one time grant
270 REVOKED_MANUALLY = 1,
272 // Recorded when a one time grant expires because all tabs are either closed
274 ALL_TABS_CLOSED_OR_DISCARDED = 2,
276 // Recorded when a one time grant expires because the permission was unused in
278 EXPIRED_IN_BACKGROUND = 3,
280 // Revoked because of the maximum one time permission lifetime
281 // `kOneTimePermissionMaximumLifetime`
282 EXPIRED_AFTER_MAXIMUM_LIFETIME = 4,
284 // Recorded when a one time grant expires because the device was suspended.
285 EXPIRED_ON_SUSPEND = 5,
287 kMaxValue = EXPIRED_ON_SUSPEND
290 enum class PermissionAutoRevocationHistory {
291 // Permission has not been automatically revoked.
294 // Permission has been automatically revoked.
295 PREVIOUSLY_AUTO_REVOKED = 0x01,
298 // This enum backs up the `AutoDSEPermissionRevertTransition` histogram enum.
299 // Never reuse values and mirror any updates to it.
300 // Describes the transition that has occured for the setting of a DSE origin
301 // when DSE autogrant becomes disabled.
302 enum class AutoDSEPermissionRevertTransition {
303 // The user has not previously made any decision so it results in an `ASK` end
306 // The user has decided to `ALLOW` the origin before it was the DSE origin and
307 // has not reverted this decision.
309 // The user has previously `BLOCKED` the origin but has allowed it after it
310 // became the DSE origin. Resolve the conflict by setting it to `ASK` so the
311 // user will make a decision again.
313 // The user has blocked the DSE origin and has not made a previous decision
314 // before the origin became the DSE origin.
315 PRESERVE_BLOCK_ASK = 3,
316 // The user has blocked the DSE origin and has `ALLOWED` it before it became
317 // the DSE origin, preserve the latest decision.
318 PRESERVE_BLOCK_ALLOW = 4,
319 // The user has blocked the DSE origin and has `BLOCKED` it before it became
320 // the DSE origin as well.
321 PRESERVE_BLOCK_BLOCK = 5,
322 // There has been an invalid transition.
323 INVALID_END_STATE = 6,
325 // Always keep at the end.
326 kMaxValue = INVALID_END_STATE,
329 // This enum backs up the 'PermissionPredictionSource` histogram enum. It
330 // indicates whether the permission prediction was done by the local on device
331 // model or by the server side model.
332 enum class PermissionPredictionSource {
336 // Always keep at the end.
337 kMaxValue = SERVER_SIDE,
340 // This enum backs up the 'PageInfoDialogAccessType' histogram enum.
341 // It is used for collecting page info access type metrics in the context of
342 // the confirmation chip.
343 enum class PageInfoDialogAccessType {
344 // The user opened page info by clicking on the lock in a situation that is
345 // considered independent of the display of a confirmation chip.
347 // The user opened page info by clicking on the lock while a confirmation chip
348 // was being displayed.
349 LOCK_CLICK_DURING_CONFIRMATION_CHIP = 1,
350 // The user opened page info by clicking on the confirmation chip while it was
352 CONFIRMATION_CHIP_CLICK = 2,
354 // The user opened page info by clicking on the lock within
355 // 'kConfirmationConsiderationDurationForUma' after confirmation chip has
356 // collapsed. This click may be considered influenced by the displaying of the
357 // confirmation chip.
358 LOCK_CLICK_SHORTLY_AFTER_CONFIRMATION_CHIP = 3,
360 // Always keep at the end.
361 kMaxValue = LOCK_CLICK_SHORTLY_AFTER_CONFIRMATION_CHIP
364 constexpr auto kConfirmationConsiderationDurationForUma = base::Seconds(20);
366 // This enum backs up the
367 // 'Permissions.PageInfo.ChangedWithin1m.{PermissionType}' histograms enum. It
368 // is used for collecting page info permission change metrics following in the
369 // first minute after a PermissionAction has been taken. Note that
370 // PermissionActions DISMISSED and IGNORED are not taken into account, as they
371 // don't have an effect on the content settings.
372 enum class PermissionChangeAction {
373 // PermissionAction was one of {GRANTED, GRANTED_ONCE} and the content
374 // setting is changed to CONTENT_SETTING_BLOCK.
377 // PermissionAction was DENIED and the content setting is changed to
378 // CONTENT_SETTING_ALLOW.
381 // PermissionAction was one of {GRANTED, GRANTED_ONCE} and the content setting
382 // is changed to CONTENT_SETTING_DEFAULT.
383 RESET_FROM_ALLOWED = 2,
385 // PermissionAction was DENIED and the content setting is changed to
386 // CONTENT_SETTING_DEFAULT.
387 RESET_FROM_DENIED = 3,
389 // For one time grantable permissions, the user can toggle a remember checkbox
390 // in the secondary page info page which toggles grants between permanent
391 // grant and one time grant.
392 REMEMBER_CHECKBOX_TOGGLED = 4,
394 // Always keep at the end.
395 kMaxValue = REMEMBER_CHECKBOX_TOGGLED
398 // The reason the permission action `PermissionAction::IGNORED` was triggered.
399 enum class PermissionIgnoredReason {
400 // Ignore was triggered due to closure of the browser window
403 // Ignore was triggered due to closure of the tab
406 // Ignore was triggered due to navigation
409 // Catches all other cases
412 // Always keep at the end
416 // This enum backs up the
417 // 'Permissions.PageInfo.Changed.{PermissionType}.Reallowed.Outcome' histograms
418 // enum. It is used for collecting permission usage rates after permission
419 // status was reallowed via PageInfo. It is applicable only if permission is
420 // allowed as all other states are no-op for an origin.
422 // These values are persisted to logs. Entries should not be renumbered and
423 // numeric values should never be reused.
424 enum class PermissionChangeInfo {
425 kInfobarShownPageReloadPermissionUsed = 0,
427 kInfobarShownPageReloadPermissionNotUsed = 1,
429 kInfobarShownNoPageReloadPermissionUsed = 2,
431 kInfobarShownNoPageReloadPermissionNotUsed = 3,
433 kInfobarNotShownPageReloadPermissionUsed = 4,
435 kInfobarNotShownPageReloadPermissionNotUsed = 5,
437 kInfobarNotShownNoPageReloadPermissionUsed = 6,
439 kInfobarNotShownNoPageReloadPermissionNotUsed = 7,
441 // Always keep at the end.
442 kMaxValue = kInfobarNotShownNoPageReloadPermissionNotUsed
445 // Provides a convenient way of logging UMA for permission related operations.
446 class PermissionUmaUtil {
448 using PredictionGrantLikelihood =
449 PermissionPrediction_Likelihood_DiscretizedLikelihood;
451 static const char kPermissionsPromptShown[];
452 static const char kPermissionsPromptShownGesture[];
453 static const char kPermissionsPromptShownNoGesture[];
454 static const char kPermissionsPromptAccepted[];
455 static const char kPermissionsPromptAcceptedGesture[];
456 static const char kPermissionsPromptAcceptedNoGesture[];
457 static const char kPermissionsPromptAcceptedOnce[];
458 static const char kPermissionsPromptAcceptedOnceGesture[];
459 static const char kPermissionsPromptAcceptedOnceNoGesture[];
460 static const char kPermissionsPromptDenied[];
461 static const char kPermissionsPromptDeniedGesture[];
462 static const char kPermissionsPromptDeniedNoGesture[];
464 static const char kPermissionsExperimentalUsagePrefix[];
465 static const char kPermissionsActionPrefix[];
467 PermissionUmaUtil() = delete;
468 PermissionUmaUtil(const PermissionUmaUtil&) = delete;
469 PermissionUmaUtil& operator=(const PermissionUmaUtil&) = delete;
471 static void PermissionRequested(ContentSettingsType permission);
473 static void RecordPermissionRequestedFromFrame(
474 ContentSettingsType content_settings_type,
475 content::RenderFrameHost* rfh);
477 static void PermissionRequestPreignored(blink::PermissionType permission);
479 // Records the revocation UMA and UKM metrics for ContentSettingsTypes that
480 // have user facing permission prompts. The passed in `permission` must be
481 // such that PermissionUtil::IsPermission(permission) returns true.
482 static void PermissionRevoked(ContentSettingsType permission,
483 PermissionSourceUI source_ui,
484 const GURL& revoked_origin,
485 content::BrowserContext* browser_context);
487 static void RecordEmbargoPromptSuppression(
488 PermissionEmbargoStatus embargo_status);
490 static void RecordEmbargoPromptSuppressionFromSource(
491 content::PermissionStatusSource source);
493 static void RecordEmbargoStatus(PermissionEmbargoStatus embargo_status);
495 static void RecordPermissionRecoverySuccessRate(
496 ContentSettingsType permission,
501 // Recorded when a permission prompt creation is in progress.
502 static void RecordPermissionPromptAttempt(
503 const std::vector<PermissionRequest*>& requests,
504 bool IsLocationBarEditingOrEmpty);
506 // UMA specifically for when permission prompts are shown. This should be
507 // roughly equivalent to the metrics above, however it is
508 // useful to have separate UMA to a few reasons:
509 // - to account for, and get data on coalesced permission bubbles
510 // - there are other types of permissions prompts (e.g. download limiting)
511 // which don't go through PermissionContext
512 // - the above metrics don't always add up (e.g. sum of
513 // granted+denied+dismissed+ignored is not equal to requested), so it is
514 // unclear from those metrics alone how many prompts are seen by users.
515 static void PermissionPromptShown(
516 const std::vector<PermissionRequest*>& requests);
518 static void PermissionPromptResolved(
519 const std::vector<PermissionRequest*>& requests,
520 content::WebContents* web_contents,
521 PermissionAction permission_action,
522 base::TimeDelta time_to_decision,
523 PermissionPromptDisposition ui_disposition,
524 absl::optional<PermissionPromptDispositionReason> ui_reason,
525 absl::optional<PredictionGrantLikelihood> predicted_grant_likelihood,
526 absl::optional<bool> prediction_decision_held_back,
527 absl::optional<permissions::PermissionIgnoredReason> ignored_reason,
528 bool did_show_prompt,
529 bool did_click_manage,
530 bool did_click_learn_more);
532 static void RecordInfobarDetailsExpanded(bool expanded);
534 static void RecordCrowdDenyDelayedPushNotification(base::TimeDelta delay);
536 static void RecordCrowdDenyVersionAtAbuseCheckTime(
537 const absl::optional<base::Version>& version);
539 // Record UMAs related to the Android "Missing permissions" infobar.
540 static void RecordMissingPermissionInfobarShouldShow(
542 const std::vector<ContentSettingsType>& content_settings_types);
543 static void RecordMissingPermissionInfobarAction(
544 PermissionAction action,
545 const std::vector<ContentSettingsType>& content_settings_types);
547 static void RecordPermissionUsage(ContentSettingsType permission_type,
548 content::BrowserContext* browser_context,
549 content::WebContents* web_contents,
550 const GURL& requesting_origin);
552 static void RecordTimeElapsedBetweenGrantAndUse(ContentSettingsType type,
553 base::TimeDelta delta);
555 static void RecordTimeElapsedBetweenGrantAndRevoke(ContentSettingsType type,
556 base::TimeDelta delta);
558 static void RecordAutoDSEPermissionReverted(
559 ContentSettingsType permission_type,
560 ContentSetting backed_up_setting,
561 ContentSetting effective_setting,
562 ContentSetting end_state_setting);
564 static void RecordDSEEffectiveSetting(ContentSettingsType permission_type,
565 ContentSetting setting);
567 static void RecordPermissionPredictionSource(
568 PermissionPredictionSource prediction_type);
570 static void RecordPermissionPredictionServiceHoldback(
571 RequestType request_type,
575 static void RecordPageInfoDialogAccessType(
576 PageInfoDialogAccessType access_type);
578 static std::string GetOneTimePermissionEventHistogram(
579 ContentSettingsType type);
581 static void RecordOneTimePermissionEvent(ContentSettingsType type,
582 OneTimePermissionEvent event);
584 static void RecordPageInfoPermissionChangeWithin1m(
585 ContentSettingsType type,
586 PermissionAction previous_action,
587 ContentSetting setting_after);
589 static void RecordPageInfoPermissionChange(ContentSettingsType type,
590 ContentSetting setting_before,
591 ContentSetting setting_after,
592 bool suppress_reload_page_bar);
594 static std::string GetPermissionActionString(
595 PermissionAction permission_action);
597 static std::string GetPromptDispositionString(
598 PermissionPromptDisposition ui_disposition);
600 static std::string GetPromptDispositionReasonString(
601 PermissionPromptDispositionReason ui_disposition_reason);
603 static std::string GetRequestTypeString(RequestType request_type);
605 static bool IsPromptDispositionQuiet(
606 PermissionPromptDisposition prompt_disposition);
608 static bool IsPromptDispositionLoud(
609 PermissionPromptDisposition prompt_disposition);
611 static void RecordIgnoreReason(
612 const std::vector<PermissionRequest*>& requests,
613 PermissionPromptDisposition prompt_disposition,
614 PermissionIgnoredReason reason);
616 // Record metrics related to usage of permissions delegation.
617 static void RecordPermissionsUsageSourceAndPolicyConfiguration(
618 ContentSettingsType content_settings_type,
619 content::RenderFrameHost* render_frame_host);
621 static void RecordCrossOriginFrameActionAndPolicyConfiguration(
622 ContentSettingsType content_settings_type,
623 PermissionAction action,
624 content::RenderFrameHost* render_frame_host);
626 static void RecordTopLevelPermissionsHeaderPolicyOnNavigation(
627 content::RenderFrameHost* render_frame_host);
629 // Logs a metric that captures how long since revocation, due to a site being
630 // considered unused, the user regrants a revoked permission.
631 static void RecordPermissionRegrantForUnusedSites(
633 ContentSettingsType request_type,
634 PermissionSourceUI source_ui,
635 content::BrowserContext* browser_context,
636 base::Time current_time);
638 static absl::optional<uint32_t> GetDaysSinceUnusedSitePermissionRevocation(
640 ContentSettingsType content_settings_type,
641 base::Time current_time,
642 HostContentSettingsMap* hcsm);
644 // A scoped class that will check the current resolved content setting on
645 // construction and report a revocation metric accordingly if the revocation
646 // condition is met (from ALLOW to something else).
647 class ScopedRevocationReporter {
649 ScopedRevocationReporter(content::BrowserContext* browser_context,
650 const GURL& primary_url,
651 const GURL& secondary_url,
652 ContentSettingsType content_type,
653 PermissionSourceUI source_ui);
655 ScopedRevocationReporter(content::BrowserContext* browser_context,
656 const ContentSettingsPattern& primary_pattern,
657 const ContentSettingsPattern& secondary_pattern,
658 ContentSettingsType content_type,
659 PermissionSourceUI source_ui);
661 ~ScopedRevocationReporter();
664 raw_ptr<content::BrowserContext> browser_context_;
665 const GURL primary_url_;
666 const GURL secondary_url_;
667 ContentSettingsType content_type_;
668 PermissionSourceUI source_ui_;
669 bool is_initially_allowed_;
670 base::Time last_modified_date_;
674 friend class PermissionUmaUtilTest;
676 // Records UMA and UKM metrics for ContentSettingsTypes that have user facing
677 // permission prompts. The passed in `permission` must be such that
678 // PermissionUtil::IsPermission(permission) returns true.
679 // web_contents may be null when for recording non-prompt actions.
680 static void RecordPermissionAction(
681 ContentSettingsType permission,
682 PermissionAction action,
683 PermissionSourceUI source_ui,
684 PermissionRequestGestureType gesture_type,
685 base::TimeDelta time_to_decision,
686 PermissionPromptDisposition ui_disposition,
687 absl::optional<PermissionPromptDispositionReason> ui_reason,
688 const GURL& requesting_origin,
689 content::WebContents* web_contents,
690 content::BrowserContext* browser_context,
691 content::RenderFrameHost* render_frame_host,
692 absl::optional<PredictionGrantLikelihood> predicted_grant_likelihood,
693 absl::optional<bool> prediction_decision_held_back);
695 // Records |count| total prior actions for a prompt of type |permission|
696 // for a single origin using |prefix| for the metric.
697 static void RecordPermissionPromptPriorCount(ContentSettingsType permission,
698 const std::string& prefix,
701 static void RecordPromptDecided(
702 const std::vector<PermissionRequest*>& requests,
707 } // namespace permissions
709 #endif // COMPONENTS_PERMISSIONS_PERMISSION_UMA_UTIL_H_