File: omnibox_prefs.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 (119 lines) | stat: -rw-r--r-- 5,280 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// Copyright 2015 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_OMNIBOX_BROWSER_OMNIBOX_PREFS_H_
#define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PREFS_H_

#include <string>

class PrefRegistrySimple;
class PrefService;

namespace omnibox {

// These values are persisted to prefs. They cannot be freely changed.
enum SuggestionGroupVisibility {
  // When DEFAULT is returned, the group's visibility should be controlled by
  // the server-provided hint.
  DEFAULT = 0,

  // HIDDEN means the user has manually hidden the group before, and so this
  // group should be hidden regardless of the server-provided hint.
  HIDDEN = 1,

  // SHOWN means the user has manually shown the group before, and so this
  // group should be shown regardless of the server-provided hint.
  SHOWN = 2,
};

// Histograms being recorded when visibility of suggestion group IDs change.
inline constexpr char kGroupIdToggledOffHistogram[] =
    "Omnibox.GroupId.ToggledOff";
inline constexpr char kGroupIdToggledOnHistogram[] =
    "Omnibox.GroupId.ToggledOn";

// Alphabetical list of preference names specific to the omnibox component.
// Keep alphabetized, and document each.

// Enum specifying the active behavior for the intranet redirect detector.
// The browser pref kDNSInterceptionChecksEnabled also impacts the redirector.
// Values are defined in omnibox::IntranetRedirectorBehavior.
inline constexpr char kIntranetRedirectBehavior[] =
    "browser.intranet_redirect_behavior";

// Boolean that controls whether scoped search mode can be triggered by <space>.
inline constexpr char kKeywordSpaceTriggeringEnabled[] =
    "omnibox.keyword_space_triggering_enabled";

// Boolean that specifies whether to show the LensOverlay entry point.
inline constexpr char kShowGoogleLensShortcut[] =
    "omnibox.show_google_lens_shortcut";

// Boolean that specifies whether to show the search tools at the bottom of the
// omnibox.
inline constexpr char kShowSearchTools[] = "omnibox.show_search_tools";

// Boolean that specifies whether to always show full URLs in the omnibox.
inline constexpr char kPreventUrlElisionsInOmnibox[] =
    "omnibox.prevent_url_elisions";

// A cache of NTP zero suggest results using a JSON dictionary serialized into a
// string.
inline constexpr char kZeroSuggestCachedResults[] = "zerosuggest.cachedresults";

// A cache of SRP/Web zero suggest results using a JSON dictionary serialized
// into a string keyed off the page URL.
inline constexpr char kZeroSuggestCachedResultsWithURL[] =
    "zerosuggest.cachedresults_with_url";

// Booleans that specify whether various IPH suggestions have been dismissed.
inline constexpr char kDismissedGeminiIph[] = "omnibox.dismissed_gemini_iph";
inline constexpr char kDismissedEnterpriseSearchAggregatorIphPrefName[] =
    "omnibox.dismissed_enterprise_search_aggregator_iph";
inline constexpr char kDismissedFeaturedEnterpriseSiteSearchIphPrefName[] =
    "omnibox.dismissed_featured_enterprise_search_iph";
inline constexpr char kDismissedHistoryEmbeddingsSettingsPromo[] =
    "omnibox.dismissed_history_embeddings_settings_promo";
inline constexpr char kDismissedHistoryScopePromo[] =
    "omnibox.dismissed_history_scope_promo";
inline constexpr char kDismissedHistoryEmbeddingsScopePromo[] =
    "omnibox.dismissed_history_embeddings_scope_promo";

// How many times the various IPH suggestions were shown.
inline constexpr char kShownCountGeminiIph[] = "omnibox.shown_count_gemini_iph";
inline constexpr char kShownCountEnterpriseSearchAggregatorIph[] =
    "omnibox.shown_count_enterprise_search_aggregator_iph";
inline constexpr char kShownCountFeaturedEnterpriseSiteSearchIph[] =
    "omnibox.shown_count_featured_enterprise_search_iph";
inline constexpr char kShownCountHistoryEmbeddingsSettingsPromo[] =
    "omnibox.shown_count_history_embeddings_settings_promo";
inline constexpr char kShownCountHistoryScopePromo[] =
    "omnibox.shown_count_history_scope_promo";
inline constexpr char kShownCountHistoryEmbeddingsScopePromo[] =
    "omnibox.shown_count_history_embeddings_scope_promo";
inline constexpr char kFocusedSrpWebCount[] = "omnibox.focused_srp_web_count";
inline constexpr char kAIModeSettings[] = "omnibox.ai_mode_settings";

// Many of the prefs defined above are registered locally where they're used.
// New prefs should be added here and ordered the same as they're defined above.
void RegisterProfilePrefs(PrefRegistrySimple* registry);

// Updates the ZPS dictionary preference to cache the given |response| value
// using the |page_url| as the cache key.
void SetUserPreferenceForZeroSuggestCachedResponse(PrefService* prefs,
                                                   const std::string& page_url,
                                                   const std::string& response);

// Returns the cached response from the ZPS dictionary preference associated
// with the given |page_url|.
std::string GetUserPreferenceForZeroSuggestCachedResponse(
    PrefService* prefs,
    const std::string& page_url);

// Returns true if the AIM is allowed per the policy.
bool IsAimAllowedByPolicy(PrefService* prefs);

}  // namespace omnibox

#endif  // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_PREFS_H_