features.cc 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/permissions/features.h"
  5. namespace permissions {
  6. namespace features {
  7. // Enables or disables whether permission prompts are automatically blocked
  8. // after the user has explicitly dismissed them too many times.
  9. const base::Feature kBlockPromptsIfDismissedOften{
  10. "BlockPromptsIfDismissedOften", base::FEATURE_ENABLED_BY_DEFAULT};
  11. // Enables or disables whether permission prompts are automatically blocked
  12. // after the user has ignored them too many times.
  13. const base::Feature kBlockPromptsIfIgnoredOften{
  14. "BlockPromptsIfIgnoredOften", base::FEATURE_ENABLED_BY_DEFAULT};
  15. // Once the user declines a notification permission prompt in a WebContents,
  16. // automatically dismiss subsequent prompts in the same WebContents, from any
  17. // origin, until the next user-initiated navigation.
  18. const base::Feature kBlockRepeatedNotificationPermissionPrompts{
  19. "BlockRepeatedNotificationPermissionPrompts",
  20. base::FEATURE_ENABLED_BY_DEFAULT};
  21. const base::Feature kNotificationInteractionHistory{
  22. "NotificationInteractionHistory", base::FEATURE_DISABLED_BY_DEFAULT};
  23. const base::Feature kOneTimeGeolocationPermission{
  24. "OneTimeGeolocationPermission", base::FEATURE_DISABLED_BY_DEFAULT};
  25. // Enables an experimental permission prompt that uses a chip in the location
  26. // bar.
  27. const base::Feature kPermissionChip{"PermissionChip",
  28. base::FEATURE_DISABLED_BY_DEFAULT};
  29. // Enables a less prominent permission prompt that uses a chip in the location
  30. // bar. Requires chrome://flags/#quiet-notification-prompts to be enabled.
  31. const base::Feature kPermissionQuietChip{"PermissionQuietChip",
  32. base::FEATURE_ENABLED_BY_DEFAULT};
  33. const base::Feature kPermissionChipAutoDismiss{
  34. "PermissionChipAutoDismiss", base::FEATURE_ENABLED_BY_DEFAULT};
  35. const base::FeatureParam<int> kPermissionChipAutoDismissDelay{
  36. &kPermissionChipAutoDismiss, "delay_ms", 6000};
  37. // When kPermissionChip (above) is enabled, controls whether or not the
  38. // permission chip should be more prominent when the request is associated with
  39. // a gesture. Does nothing when kPermissionChip is disabled.
  40. const base::Feature kPermissionChipGestureSensitive{
  41. "PermissionChipGestureSensitive", base::FEATURE_DISABLED_BY_DEFAULT};
  42. // When kPermissionChip (above) is enabled, controls whether or not the
  43. // permission chip should be more or less prominent depending on the request
  44. // type. Does nothing when kPermissionChip is disabled.
  45. const base::Feature kPermissionChipRequestTypeSensitive{
  46. "PermissionChipRequestTypeSensitive", base::FEATURE_DISABLED_BY_DEFAULT};
  47. // When enabled, use the value of the `service_url` FeatureParam as the url
  48. // for the Web Permission Predictions Service.
  49. const base::Feature kPermissionPredictionServiceUseUrlOverride{
  50. "kPermissionPredictionServiceUseUrlOverride",
  51. base::FEATURE_DISABLED_BY_DEFAULT};
  52. const base::Feature kPermissionOnDeviceNotificationPredictions{
  53. "PermissionOnDeviceNotificationPredictions",
  54. base::FEATURE_ENABLED_BY_DEFAULT};
  55. #if BUILDFLAG(IS_ANDROID)
  56. // When enabled, blocks notifications permission prompt when Chrome doesn't
  57. // have app level Notification permission.
  58. const base::Feature kBlockNotificationPromptsIfDisabledOnAppLevel{
  59. "BlockNotificationPromptsIfDisabledOnAppLevel",
  60. base::FEATURE_ENABLED_BY_DEFAULT};
  61. #else
  62. // Controls whether to trigger showing a HaTS survey, with the given
  63. // `probability` and `trigger_id`, immediately after the user has taken the
  64. // action specified in `action_filter` on a permission prompt for the capability
  65. // specified in `request_type_filter`. All of the above-mentioned params are
  66. // required and should be coming from field trial params of the same name. The
  67. // `probability` parameter is an odd-one out and is defined and handled by the
  68. // HatsService itself.
  69. const base::Feature kPermissionsPostPromptSurvey{
  70. "PermissionsPostPromptSurvey", base::FEATURE_DISABLED_BY_DEFAULT};
  71. // When enabled, permissions grants with a durable session model will have
  72. // an expiration date set. The interpretation of the expiration date
  73. // is not handled by this component, but left to the embedding browser.
  74. const base::Feature kRecordPermissionExpirationTimestamps{
  75. "RecordPermissionExpirationTimestamps", base::FEATURE_ENABLED_BY_DEFAULT};
  76. #endif // BUILDFLAG(IS_ANDROID)
  77. } // namespace features
  78. namespace feature_params {
  79. const base::FeatureParam<bool> kOkButtonBehavesAsAllowAlways(
  80. &permissions::features::kOneTimeGeolocationPermission,
  81. "OkButtonBehavesAsAllowAlways",
  82. true);
  83. const base::FeatureParam<std::string> kPermissionPredictionServiceUrlOverride{
  84. &permissions::features::kPermissionPredictionServiceUseUrlOverride,
  85. "service_url", ""};
  86. const base::FeatureParam<double>
  87. kPermissionOnDeviceNotificationPredictionsHoldbackChance(
  88. &features::kPermissionOnDeviceNotificationPredictions,
  89. "holdback_chance",
  90. 0.3);
  91. #if !BUILDFLAG(IS_ANDROID)
  92. // Specifies the `trigger_id` of the HaTS survey to trigger immediately after
  93. // the user has interacted with a permission prompt.
  94. const base::FeatureParam<std::string> kPermissionsPostPromptSurveyTriggerId{
  95. &permissions::features::kPermissionsPostPromptSurvey, "trigger_id", ""};
  96. // Specifies the type of permission request for which the post-prompt HaTS
  97. // survey is triggered. For any given user, there is a single request type for
  98. // which they may see a survey. Valid values are the return values of
  99. // `GetPermissionRequestString`. An invalid or empty value will result in the
  100. // user not seeing any post-prompt survey.
  101. const base::FeatureParam<std::string>
  102. kPermissionsPostPromptSurveyRequestTypeFilter{
  103. &permissions::features::kPermissionsPostPromptSurvey,
  104. "request_type_filter", ""};
  105. // Specifies the action for which the post-prompt HaTS survey is triggered. For
  106. // any given user, there is a single permission action for which they may see a
  107. // survey, of those listed in RetuPermissionUmaUtil::GetPermissionActionString.
  108. // An invalid or empty value will result in the user not seeing any post-prompt
  109. // survey.
  110. const base::FeatureParam<std::string> kPermissionsPostPromptSurveyActionFilter{
  111. &permissions::features::kPermissionsPostPromptSurvey, "action_filter", ""};
  112. #endif // !BUILDFLAG(IS_ANDROID)
  113. } // namespace feature_params
  114. } // namespace permissions