File: user_education_features.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (99 lines) | stat: -rw-r--r-- 4,084 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright 2023 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_USER_EDUCATION_COMMON_USER_EDUCATION_FEATURES_H_
#define COMPONENTS_USER_EDUCATION_COMMON_USER_EDUCATION_FEATURES_H_

#include "base/feature_list.h"
#include "base/time/time.h"

namespace user_education::features {

// Command-line switch that disables rate limiting in User Education, like the
// new profile grace period and the heavyweight IPH cooldown.
//
// For testing purposes, strongly prefer to inherit from
// `InteractiveFeaturePromoTest`, but this is not possible for unit tests, so
// this is provided as a public constant for convenience.
inline constexpr char kDisableRateLimitingCommandLine[] =
    "disable-user-education-rate-limiting";

BASE_DECLARE_FEATURE(kUserEducationExperienceVersion2Point5);
BASE_DECLARE_FEATURE(kNewBadgeTestFeature);

// Returns whether User Education Version 2.5 policies are enabled.
// This requires User Education Version 2.
extern bool IsUserEducationV25();

// Returns the minimum amount of time a session must last. If this is less than
// `GetIdleTimeBetweenSessions()` then it will have no effect.
extern base::TimeDelta GetMinimumValidSessionLength();

// Returns the minimum amount of time the application must be idle before a new
// session can start.
extern base::TimeDelta GetIdleTimeBetweenSessions();

// Returns the amount of time in which low-priority, heavyweight IPH are
// prevented from showing after a new session starts.
extern base::TimeDelta GetSessionStartGracePeriod();

// Gets the amount of time that must pass after a heavyweight promo before a
// low-priority heavyweight promo can be shown.
extern base::TimeDelta GetLowPriorityCooldown();

// Gets the amount of time after a new profile is created on a device before
// most low-priority user education primitives can be displayed.
extern base::TimeDelta GetNewProfileGracePeriod();

// Gets the minimum amount of time from when an IPH is snoozed until it can be
// shown again. For low-priority IPH, if this is shorter than
// `GetLowPriorityCooldown()` then it will have no additional effect.
extern base::TimeDelta GetSnoozeDuration();

// Gets the minimum amount of time from when a low-priority IPH is aborted due
// to a UI change (i.e. not via user snooze or dismissal) to when it can show
// again.
extern base::TimeDelta GetAbortCooldown();

// Returns the maximum number of times the user can hit "snooze" on an IPH until
// the snooze button no longer appears.
extern int GetMaxSnoozeCount();

// Returns the maximum number of times a low-priority is allowed to show at all
// before it is permanently blocked.
extern int GetMaxPromoShowCount();

// Returns the number of times a "New" Badge is shown before it stops appearing.
extern int GetNewBadgeShowCount();

// Returns the number of times the feature being promoted by a "New" Badge can
// be used before the badge disappears.
extern int GetNewBadgeFeatureUsedCount();

// Returns the amount of time from when a feature being promoted by a "New"
// Badge becomes active that the badge can be displayed to the user. Badges stop
// being displayed after this period.
extern base::TimeDelta GetNewBadgeDisplayWindow();

// Returns timeouts for high, medium, and low-priority promos in the queue for
// User Education 2.5.
extern base::TimeDelta GetHighPriorityTimeout();
extern base::TimeDelta GetMediumPriorityTimeout();
extern base::TimeDelta GetLowPriorityTimeout();

// Returns how long the user must stop sending input before a heavyweight promo
// can be shown.
extern base::TimeDelta GetIdleTimeBeforeHeavyweightPromo();

// Returns the polling interval for the promo controller for User Education 2.5.
extern base::TimeDelta GetPromoControllerPollingInterval();

// Advertises browser features in New Tab Page promos.
BASE_DECLARE_FEATURE(kEnableNtpBrowserPromos);

extern bool NtpBrowserPromosEnabled();

}  // namespace user_education::features

#endif  // COMPONENTS_USER_EDUCATION_COMMON_USER_EDUCATION_FEATURES_H_