File: constants.cc

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (97 lines) | stat: -rw-r--r-- 3,937 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
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/segmentation_platform/embedder/home_modules/tips_manager/constants.h"

namespace segmentation_platform {

// LINT.IfChange(NameForTipIdentifier)
std::string NameForTipIdentifier(TipIdentifier tip) {
  switch (tip) {
    case TipIdentifier::kUnknown:
      return "Unknown";
    case TipIdentifier::kLensSearch:
      return "LensSearch";
    case TipIdentifier::kLensShop:
      return "LensShop";
    case TipIdentifier::kLensTranslate:
      return "LensTranslate";
    case TipIdentifier::kAddressBarPosition:
      return "AddressBarPosition";
    case TipIdentifier::kSavePasswords:
      return "SavePasswords";
    case TipIdentifier::kAutofillPasswords:
      return "AutofillPasswords";
    case TipIdentifier::kEnhancedSafeBrowsing:
      return "EnhancedSafeBrowsing";
  }
}
// LINT.ThenChange(/components/segmentation_platform/embedder/home_modules/tips_manager/constants.h:TipIdentifier)

// LINT.IfChange(TipIdentifierForName)
TipIdentifier TipIdentifierForName(std::string_view name) {
  if (name == "Unknown") {
    return TipIdentifier::kUnknown;
  } else if (name == "LensSearch") {
    return TipIdentifier::kLensSearch;
  } else if (name == "LensShop") {
    return TipIdentifier::kLensShop;
  } else if (name == "LensTranslate") {
    return TipIdentifier::kLensTranslate;
  } else if (name == "AddressBarPosition") {
    return TipIdentifier::kAddressBarPosition;
  } else if (name == "SavePasswords") {
    return TipIdentifier::kSavePasswords;
  } else if (name == "AutofillPasswords") {
    return TipIdentifier::kAutofillPasswords;
  } else if (name == "EnhancedSafeBrowsing") {
    return TipIdentifier::kEnhancedSafeBrowsing;
  } else {
    return TipIdentifier::kUnknown;  // Default to unknown if not found.
  }
}
// LINT.ThenChange(/components/segmentation_platform/embedder/home_modules/tips_manager/constants.h:TipIdentifier)

// LINT.IfChange(NameForTipPresentationContext)
std::string NameForTipPresentationContext(TipPresentationContext context) {
  switch (context) {
    case TipPresentationContext::kUnknown:
      return "Unknown";
    case TipPresentationContext::kIOSMagicStack:
      return "IOSMagicStack";
  }
}
// LINT.ThenChange(/components/segmentation_platform/embedder/home_modules/tips_manager/constants.h:TipPresentationContext)

constexpr char kFirstObservedTime[] = "first_observed_time";
constexpr char kLastObservedTime[] = "last_observed_time";
constexpr char kTotalOccurrences[] = "total_occurrences";
constexpr char kTipsSignalHistory[] =
    "segmentation_platform.tips.signal_history";

const char kAddressBarPositionEphemeralModuleInteractedPref[] =
    "ephemeral_pref_interacted."
    "address_bar_position_ephemeral_module_interacted";
const char kAutofillPasswordsEphemeralModuleInteractedPref[] =
    "ephemeral_pref_interacted."
    "autofill_passwords_ephemeral_module_interacted";
const char kEnhancedSafeBrowsingEphemeralModuleInteractedPref[] =
    "ephemeral_pref_interacted."
    "enhanced_safe_browsing_ephemeral_module_interacted";
const char kSavePasswordsEphemeralModuleInteractedPref[] =
    "ephemeral_pref_interacted."
    "save_passwords_ephemeral_module_interacted";
const char kLensEphemeralModuleInteractedPref[] =
    "ephemeral_pref_interacted.lens_ephemeral_module_interacted";
const char kLensEphemeralModuleSearchVariationInteractedPref[] =
    "ephemeral_pref_interacted."
    "lens_ephemeral_module_search_variation_interacted";
const char kLensEphemeralModuleShopVariationInteractedPref[] =
    "ephemeral_pref_interacted."
    "lens_ephemeral_module_shop_variation_interacted";
const char kLensEphemeralModuleTranslateVariationInteractedPref[] =
    "ephemeral_pref_interacted."
    "lens_ephemeral_module_translate_variation_interacted";

}  // namespace segmentation_platform