File: pref_service_incognito_allowlist.cc

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 (236 lines) | stat: -rw-r--r-- 10,476 bytes parent folder | download | duplicates (6)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/prefs/pref_service_incognito_allowlist.h"

#include <vector>

#include "build/build_config.h"
#include "chrome/common/pref_names.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/metrics/metrics_pref_names.h"
#include "components/reading_list/core/reading_list_pref_names.h"
#include "components/ukm/ukm_pref_names.h"

#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#endif  // !BUILDFLAG(IS_ANDROID)

#if BUILDFLAG(IS_CHROMEOS)
#include "ash/constants/ash_pref_names.h"
#endif  // BUILDFLAG(IS_CHROMEOS)

namespace {

// List of keys that can be changed in the user prefs file by the incognito
// profile.
const char* const kPersistentPrefNames[] = {
#if BUILDFLAG(IS_CHROMEOS)
    // Accessibility preferences should be persisted if they are changed in
    // incognito mode.
    ash::prefs::kAccessibilityLargeCursorEnabled,
    ash::prefs::kAccessibilityLargeCursorDipSize,
    ash::prefs::kAccessibilityStickyKeysEnabled,
    ash::prefs::kAccessibilitySpokenFeedbackEnabled,
    ash::prefs::kAccessibilityChromeVoxAutoRead,
    ash::prefs::kAccessibilityChromeVoxAnnounceDownloadNotifications,
    ash::prefs::kAccessibilityChromeVoxAnnounceRichTextAttributes,
    ash::prefs::kAccessibilityChromeVoxAudioStrategy,
    ash::prefs::kAccessibilityChromeVoxBrailleSideBySide,
    ash::prefs::kAccessibilityChromeVoxBrailleTable,
    ash::prefs::kAccessibilityChromeVoxBrailleTable6,
    ash::prefs::kAccessibilityChromeVoxBrailleTable8,
    ash::prefs::kAccessibilityChromeVoxBrailleTableType,
    ash::prefs::kAccessibilityChromeVoxBrailleWordWrap,
    ash::prefs::kAccessibilityChromeVoxCapitalStrategy,
    ash::prefs::kAccessibilityChromeVoxCapitalStrategyBackup,
    ash::prefs::kAccessibilityChromeVoxEnableBrailleLogging,
    ash::prefs::kAccessibilityChromeVoxEnableEarconLogging,
    ash::prefs::kAccessibilityChromeVoxEnableEventStreamLogging,
    ash::prefs::kAccessibilityChromeVoxEnableSpeechLogging,
    ash::prefs::kAccessibilityChromeVoxEventStreamFilters,
    ash::prefs::kAccessibilityChromeVoxLanguageSwitching,
    ash::prefs::kAccessibilityChromeVoxMenuBrailleCommands,
    ash::prefs::kAccessibilityChromeVoxNumberReadingStyle,
    ash::prefs::kAccessibilityChromeVoxPreferredBrailleDisplayAddress,
    ash::prefs::kAccessibilityChromeVoxPunctuationEcho,
    ash::prefs::kAccessibilityChromeVoxSmartStickyMode,
    ash::prefs::kAccessibilityChromeVoxSpeakTextUnderMouse,
    ash::prefs::kAccessibilityChromeVoxUsePitchChanges,
    ash::prefs::kAccessibilityChromeVoxUseVerboseMode,
    ash::prefs::kAccessibilityChromeVoxVirtualBrailleColumns,
    ash::prefs::kAccessibilityChromeVoxVirtualBrailleRows,
    ash::prefs::kAccessibilityChromeVoxVoiceName,
    ash::prefs::kAccessibilityColorCorrectionEnabled,
    ash::prefs::kAccessibilityColorVisionCorrectionAmount,
    ash::prefs::kAccessibilityColorVisionCorrectionType,
    ash::prefs::kAccessibilityReducedAnimationsEnabled,
    ash::prefs::kAccessibilityAlwaysShowScrollbarsEnabled,
    ash::prefs::kAccessibilityFaceGazeAcceleratorDialogHasBeenAccepted,
    ash::prefs::kAccessibilityFaceGazeEnabled,
    ash::prefs::kAccessibilityFaceGazeCursorSpeedUp,
    ash::prefs::kAccessibilityFaceGazeCursorSpeedDown,
    ash::prefs::kAccessibilityFaceGazeCursorSpeedLeft,
    ash::prefs::kAccessibilityFaceGazeCursorSpeedRight,
    ash::prefs::kAccessibilityFaceGazeCursorUseAcceleration,
    ash::prefs::kAccessibilityFaceGazeGesturesToKeyCombos,
    ash::prefs::kAccessibilityFaceGazeGesturesToMacros,
    ash::prefs::kAccessibilityFaceGazeGesturesToConfidence,
    ash::prefs::kAccessibilityFaceGazeActionsEnabled,
    ash::prefs::kAccessibilityFaceGazeCursorControlEnabled,
    ash::prefs::kAccessibilityFaceGazeAdjustSpeedSeparately,
    ash::prefs::kAccessibilityFaceGazeVelocityThreshold,
    ash::prefs::kAccessibilityFaceGazePrecisionClick,
    ash::prefs::kAccessibilityFaceGazePrecisionClickSpeedFactor,
    ash::prefs::kAccessibilityFaceGazeEnabledSentinel,
    ash::prefs::kAccessibilityFaceGazeEnabledSentinelShowDialog,
    ash::prefs::kAccessibilityFaceGazeCursorControlEnabledSentinel,
    ash::prefs::kAccessibilityFaceGazeActionsEnabledSentinel,
    ash::prefs::kAccessibilityFlashNotificationsEnabled,
    ash::prefs::kAccessibilityFlashNotificationsColor,
    ash::prefs::kAccessibilityHighContrastEnabled,
    ash::prefs::kAccessibilityScreenMagnifierEnabled,
    ash::prefs::kAccessibilityScreenMagnifierFocusFollowingEnabled,
    ash::prefs::kAccessibilityMagnifierFollowsChromeVox,
    ash::prefs::kAccessibilityMagnifierFollowsSts,
    ash::prefs::kAccessibilityScreenMagnifierMouseFollowingMode,
    ash::prefs::kAccessibilityScreenMagnifierScale,
    ash::prefs::kAccessibilityVirtualKeyboardEnabled,
    ash::prefs::kAccessibilityMonoAudioEnabled,
    ash::prefs::kAccessibilityAutoclickEnabled,
    ash::prefs::kAccessibilityAutoclickDelayMs,
    ash::prefs::kAccessibilityAutoclickEventType,
    ash::prefs::kAccessibilityAutoclickRevertToLeftClick,
    ash::prefs::kAccessibilityAutoclickStabilizePosition,
    ash::prefs::kAccessibilityAutoclickMovementThreshold,
    ash::prefs::kAccessibilityBounceKeysEnabled,
    ash::prefs::kAccessibilityBounceKeysDelayMs,
    ash::prefs::kAccessibilityMouseKeysEnabled,
    ash::prefs::kAccessibilityMouseKeysAcceleration,
    ash::prefs::kAccessibilityMouseKeysMaxSpeed,
    ash::prefs::kAccessibilityMouseKeysUsePrimaryKeys,
    ash::prefs::kAccessibilityMouseKeysDominantHand,
    ash::prefs::kAccessibilityCaretHighlightEnabled,
    ash::prefs::kAccessibilityCaretBlinkInterval,
    ash::prefs::kAccessibilityCursorHighlightEnabled,
    ash::prefs::kAccessibilityCursorColorEnabled,
    ash::prefs::kAccessibilityCursorColor,
    ash::prefs::kAccessibilityFocusHighlightEnabled,
    ash::prefs::kAccessibilitySelectToSpeakEnabled,
    ash::prefs::kAccessibilitySlowKeysEnabled,
    ash::prefs::kAccessibilitySlowKeysDelayMs,
    ash::prefs::kAccessibilitySwitchAccessEnabled,
    ash::prefs::kAccessibilitySwitchAccessSelectDeviceKeyCodes,
    ash::prefs::kAccessibilitySwitchAccessNextDeviceKeyCodes,
    ash::prefs::kAccessibilitySwitchAccessPreviousDeviceKeyCodes,
    ash::prefs::kAccessibilitySwitchAccessAutoScanEnabled,
    ash::prefs::kAccessibilitySwitchAccessAutoScanSpeedMs,
    ash::prefs::kAccessibilitySwitchAccessAutoScanKeyboardSpeedMs,
    ash::prefs::kAccessibilitySwitchAccessPointScanSpeedDipsPerSecond,
    ash::prefs::kAccessibilityDictationEnabled,
    ash::prefs::kAccessibilityDictationLocale,
    ash::prefs::kDockedMagnifierEnabled,
    ash::prefs::kDockedMagnifierScale,
    ash::prefs::kDockedMagnifierScreenHeightDivisor,
    ash::prefs::kDockedMagnifierAcceleratorDialogHasBeenAccepted,
    ash::prefs::kHighContrastAcceleratorDialogHasBeenAccepted,
    ash::prefs::kScreenMagnifierAcceleratorDialogHasBeenAccepted,
    ash::prefs::kShouldAlwaysShowAccessibilityMenu,
    ash::prefs::kAccessibilityDisableTrackpadEnabled,
    ash::prefs::kAccessibilityDisableTrackpadMode,
#endif  // BUILDFLAG(IS_CHROMEOS)
#if !BUILDFLAG(IS_ANDROID)
    kAnimationPolicyAllowed,
    kAnimationPolicyOnce,
    kAnimationPolicyNone,
#endif  // !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(ENABLE_EXTENSIONS)
    prefs::kAnimationPolicy,
#endif

    // Bookmark preferences are common between incognito and regular mode.
    bookmarks::prefs::kBookmarkEditorExpandedNodes,
    bookmarks::prefs::kEditBookmarksEnabled,
    bookmarks::prefs::kManagedBookmarks,
    bookmarks::prefs::kManagedBookmarksFolderName,
    bookmarks::prefs::kShowAppsShortcutInBookmarkBar,
    bookmarks::prefs::kShowManagedBookmarksInBookmarkBar,
    bookmarks::prefs::kShowBookmarkBar,
#if BUILDFLAG(IS_ANDROID)
    prefs::kPartnerBookmarkMappings,
#endif  // BUILDFLAG(IS_ANDROID)

#if BUILDFLAG(IS_ANDROID)
    // Clipboard modification state is updated over all profiles.
    prefs::kClipboardLastModifiedTime,
#endif

    // Default browser bar's status is aggregated between regular and incognito
    // modes.
    prefs::kBrowserSuppressDefaultBrowserPrompt,
    prefs::kDefaultBrowserLastDeclined,
    prefs::kDefaultBrowserSettingEnabled,

    // Devtools preferences are stored cross profiles as they are not storing
    // user data and just keep debugging environment settings.
    prefs::kDevToolsAdbKey,
    prefs::kDevToolsAvailability,
    prefs::kDevToolsDiscoverUsbDevicesEnabled,
    prefs::kDevToolsEditedFiles,
    prefs::kDevToolsFileSystemPaths,
    prefs::kDevToolsPortForwardingEnabled,
    prefs::kDevToolsPortForwardingDefaultSet,
    prefs::kDevToolsPortForwardingConfig,
    prefs::kDevToolsPreferences,
    prefs::kDevToolsDiscoverTCPTargetsEnabled,
    prefs::kDevToolsTCPDiscoveryConfig,

#if BUILDFLAG(IS_WIN)
    // The total number of times that network profile warning is shown is
    // aggregated between regular and incognito modes.
    prefs::kNetworkProfileWarningsLeft,
#endif

    // Tab stats metrics are aggregated between regular and incognio mode.
    prefs::kTabStatsTotalTabCountMax,
    prefs::kTabStatsMaxTabsPerWindow,
    prefs::kTabStatsWindowCountMax,
    prefs::kTabStatsDailySample,

#if BUILDFLAG(IS_MAC)
    prefs::kShowFullscreenToolbar,
#endif

#if BUILDFLAG(IS_LINUX)
    // Toggleing custom frames affects all open windows in the profile, hence
    // should be written to the regular profile when changed in incognito mode.
    prefs::kUseCustomChromeFrame,
#endif

    // Although UKMs are not collected in incognito, theses preferences may be
    // changed by UMA/Sync/Unity consent, and need to be the same between
    // incognito and regular modes.
    ukm::prefs::kUkmClientId,
    ukm::prefs::kUkmUnsentLogStore,
    ukm::prefs::kUkmSessionId,

    // Cookie controls preference is, as in an initial release, surfaced only in
    // the incognito mode and therefore should be persisted between incognito
    // sessions.
    prefs::kCookieControlsMode,
};

}  // namespace

namespace prefs {

std::vector<const char*> GetIncognitoPersistentPrefsAllowlist() {
  std::vector<const char*> allowlist;
  allowlist.insert(allowlist.end(), std::begin(kPersistentPrefNames),
                   std::end(kPersistentPrefNames));
  return allowlist;
}

}  // namespace prefs