File: enums.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 (187 lines) | stat: -rw-r--r-- 6,782 bytes parent folder | download | duplicates (5)
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
// Copyright 2020 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_FEED_CORE_V2_ENUMS_H_
#define COMPONENTS_FEED_CORE_V2_ENUMS_H_

#include <iosfwd>
#include <string_view>

namespace feed {

// One value for each network API method used by the feed.
enum class NetworkRequestType : int {
  kFeedQuery = 0,
  kUploadActions = 1,
  kNextPage = 2,
  kListWebFeeds = 3,
  kUnfollowWebFeed = 4,
  kFollowWebFeed = 5,
  kListRecommendedWebFeeds = 6,
  kWebFeedListContents = 7,
  kQueryInteractiveFeed = 8,
  kQueryBackgroundFeed = 9,
  kQueryNextPage = 10,
  kSingleWebFeedListContents = 11,
  kQueryWebFeed = 12,
};
std::ostream& operator<<(std::ostream& out, NetworkRequestType value);

// Denotes how the stream content loading is used for.
enum class LoadType {
  // Loads the stream model into memory. If successful, this directly forces a
  // model load in |FeedStream()| before completing the task.
  kInitialLoad = 0,
  // Loads additional content from the network when the model is already loaded.
  kLoadMore = 1,
  // Refreshes the stored stream data from the network, on the background. This
  // will fail if the model is already loaded.
  kBackgroundRefresh = 2,
  // Refreshes the stored stream data from the network, per the user request.
  // The stored stream data and the loaded model will not be affected if the
  // network request fails.
  kManualRefresh = 3,
  // Same as kBackgroundRefresh but specifically scheduled based on user
  // interaction with the feed.
  kFeedCloseBackgroundRefresh = 4,
};

// This must be kept in sync with FeedLoadStreamStatus in enums.xml.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.feed.v2
enum class LoadStreamStatus {
  // Loading was not attempted.
  kNoStatus = 0,

  // Final loading statuses where loading succeeds. :
  kLoadedFromStore = 1,
  kLoadedFromNetwork = 2,
  kLoadedStaleDataFromStoreDueToNetworkFailure = 21,

  // Statuses where data is loaded from the persistent store, but is stale.
  kDataInStoreIsStale = 8,
  // The timestamp for stored data is in the future, so we're treating stored
  // data as it it is stale.
  kDataInStoreIsStaleTimestampInFuture = 9,
  kDataInStoreStaleMissedLastRefresh = 20,

  // Failure statuses where content is not loaded.
  kFailedWithStoreError = 3,
  kNoStreamDataInStore = 4,
  kModelAlreadyLoaded = 5,
  kNoResponseBody = 6,
  kProtoTranslationFailed = 7,
  kCannotLoadFromNetworkSupressedForHistoryDelete_DEPRECATED = 10,
  kCannotLoadFromNetworkOffline = 11,
  kCannotLoadFromNetworkThrottled = 12,
  kLoadNotAllowedEulaNotAccepted = 13,
  kLoadNotAllowedArticlesListHidden = 14,
  kCannotParseNetworkResponseBody = 15,
  kLoadMoreModelIsNotLoaded = 16,
  kLoadNotAllowedDisabledByEnterprisePolicy = 17,
  kNetworkFetchFailed = 18,
  kCannotLoadMoreNoNextPageToken = 19,
  kDataInStoreIsExpired = 22,
  kDataInStoreIsForAnotherUser = 23,
  kAbortWithPendingClearAll = 24,
  kAlreadyHaveUnreadContent = 25,
  kNotAWebFeedSubscriber = 26,
  kAccountTokenFetchFailedWrongAccount = 27,
  kAccountTokenFetchTimedOut = 28,
  kNetworkFetchTimedOut = 29,
  kLoadNotAllowedDisabled = 30,
  kLoadNotAllowedDisabledByDse = 31,
  kNoCardReceived = 32,
  kMaxValue = kNoCardReceived,
};

// Were we able to load fresh Feed data. This should be 'true' unless some kind
// of error occurred.
bool IsLoadingSuccessfulAndFresh(LoadStreamStatus status);

std::ostream& operator<<(std::ostream& out, LoadStreamStatus value);

// Keep this in sync with FeedUploadActionsStatus in enums.xml.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.feed.v2
enum class UploadActionsStatus {
  kNoStatus = 0,
  kNoPendingActions = 1,
  kFailedToStorePendingAction = 2,
  kStoredPendingAction = 3,
  kUpdatedConsistencyToken = 4,
  kFinishedWithoutUpdatingConsistencyToken = 5,
  kAbortUploadForSignedOutUser = 6,
  // TODO(b/213622639): This is unused, remove it.
  kAbortUploadBecauseDisabled = 7,
  kAbortUploadForWrongUser = 8,
  kAbortUploadActionsWithPendingClearAll = 9,
  kMaxValue = kAbortUploadActionsWithPendingClearAll,
};

// Keep this in sync with FeedUploadActionsBatchStatus in enums.xml.
enum class UploadActionsBatchStatus {
  kNoStatus = 0,
  kFailedToUpdateStore = 1,
  kFailedToUpload = 2,
  kFailedToRemoveUploadedActions = 3,
  kExhaustedUploadQuota = 4,
  kAllActionsWereStale = 5,
  kSuccessfullyUploadedBatch = 6,
  kMaxValue = kSuccessfullyUploadedBatch,
};

std::ostream& operator<<(std::ostream& out, UploadActionsStatus value);
std::ostream& operator<<(std::ostream& out, UploadActionsBatchStatus value);

// This must be kept in sync with WebFeedRefreshStatus in enums.xml.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
// Status of updating recommended or subscribed web feeds.
enum class WebFeedRefreshStatus {
  kNoStatus = 0,
  kSuccess = 1,
  kNetworkFailure = 2,
  kNetworkRequestThrottled = 3,
  kAbortFetchWebFeedPendingClearAll = 4,
  kMaxValue = kAbortFetchWebFeedPendingClearAll,
};
std::ostream& operator<<(std::ostream& out, WebFeedRefreshStatus value);

// This must be kept in sync with FeedUserSettingsOnStart in enums.xml.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
// Reports last known state of user settings which affect Feed content.
// This includes WAA (whether activity is recorded), and DP (whether
// Discover personalization is enabled).
enum class UserSettingsOnStart {
  // The Feed is disabled by enterprise policy.
  kFeedNotEnabledByPolicy = 0,
  // The Feed is enabled by enterprise policy, but the user has hidden and
  // disabled the Feed, so other user settings beyond sign-in status are not
  // available.
  kFeedNotVisibleSignedOut = 1,
  kFeedNotVisibleSignedIn = 2,
  // The Feed is enabled, the user is not signed in.
  kSignedOut = 3,
  // The Feed is enabled, the user is signed in, and setting states are known.
  kSignedInWaaOnDpOn = 4,
  kSignedInWaaOnDpOff = 5,
  kSignedInWaaOffDpOn = 6,
  kSignedInWaaOffDpOff = 7,
  // The Feed is enabled, but there is no recent Feed data, so user settings
  // state is unknown.
  kSignedInNoRecentData = 8,
  // The Feed is disabled.
  kFeedNotEnabled = 9,
  // The Feed is disabled if swapping out NTP is enabled and DSE isn't Google.
  kFeedNotEnabledByDse = 10,
  kMaxValue = kFeedNotEnabledByDse,
};
std::string_view ToString(UserSettingsOnStart v);
std::ostream& operator<<(std::ostream& out, UserSettingsOnStart value);

}  // namespace feed

#endif  // COMPONENTS_FEED_CORE_V2_ENUMS_H_