File: request_header_to_enum.h

package info (click to toggle)
chromium 145.0.7632.159-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,976,224 kB
  • sloc: cpp: 36,198,469; ansic: 7,634,080; javascript: 3,564,060; python: 1,649,622; xml: 838,470; asm: 717,087; pascal: 185,708; sh: 88,786; perl: 88,718; objc: 79,984; sql: 59,811; cs: 42,452; fortran: 24,101; makefile: 21,144; tcl: 15,277; php: 14,022; yacc: 9,066; ruby: 7,553; awk: 3,720; lisp: 3,233; lex: 1,328; ada: 727; jsp: 228; sed: 36
file content (105 lines) | stat: -rw-r--r-- 3,066 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
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SERVICES_NETWORK_REQUEST_HEADER_TO_ENUM_H_
#define SERVICES_NETWORK_REQUEST_HEADER_TO_ENUM_H_

#include <string_view>

namespace network {

// Request header names that have been observed sent from Chrome on major sites
// and also appear in the source code. This does not include request headers
// that are added by CorsURLLoader or within //net, such as
// "Access-Control-Request-Method" or "Connection".

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(RequestHeader)
enum class RequestHeader {
  kOther = 0,
  kAccept = 1,
  kAcceptEncoding = 2,
  kAcceptLanguage = 3,
  kAuthorization = 4,
  kCacheControl = 5,
  kClientVersion = 6,
  kContentEncoding = 7,
  kContentType = 8,
  kDeviceMemory = 9,
  kDownlink = 10,
  kDpr = 11,
  kEct = 12,
  kGoogleTranslateElementMode = 13,
  kIfModifiedSince = 14,
  kIfNoneMatch = 15,
  kOrigin = 16,
  kPingFrom = 17,
  kPingTo = 18,
  kPragma = 19,
  kRange = 20,
  kRequestId = 21,
  kRtt = 22,
  kSecBrowsingTopics = 23,
  kSecChDeviceMemory = 24,
  kSecChDpr = 25,
  kSecChPrefersColorScheme = 26,
  kSecChUa = 27,
  kSecChUaArch = 28,
  kSecChUaBitness = 29,
  kSecChUaFormFactors = 30,
  kSecChUaFullVersion = 31,
  kSecChUaFullVersionList = 32,
  kSecChUaMobile = 33,
  kSecChUaModel = 34,
  kSecChUaPlatform = 35,
  kSecChUaPlatformVersion = 36,
  kSecChUaWow64 = 37,
  kSecChViewportHeight = 38,
  kSecChViewportWidth = 39,
  kSecPurpose = 40,
  kServiceWorker = 41,
  kServiceWorkerNavigationPreload = 42,
  kSID = 43,
  kTraceparent = 44,
  kUpgradeInsecureRequests = 45,
  kUserAgent = 46,
  kViewportWidth = 47,
  kXChromeConnected = 48,
  kXChromeIDConsistencyRequest = 49,
  kXClientData = 50,
  kXDeveloperKey = 51,
  kXGoogApiKey = 52,
  kXGoogEncodeResponseIfExecutable = 53,
  kXGoogExt174067345Bin = 54,
  kXGoogUpdateAppId = 55,
  kXGoogUpdateInteractivity = 56,
  kXGoogUpdateUpdater = 57,
  kXHTTPMethodOverride = 58,
  kXOAuthClientID = 59,
  kXRequestedWith = 60,
  kXServerTimeout = 61,
  kXUseAltService = 62,
  kXWebChannelContentType = 63,

  // If you need to add a new header, add it here. Do not attempt to preserve
  // alphabetic order.
  kMaxValue = kXWebChannelContentType,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/network/enums.xml:RequestHeader)

// Returns the corresponding enum value if `name` is a match
// for one of the headers in the RequestHeader enum, or RequestHeader::kOther
// otherwise. `name` must be in lower-case.
RequestHeader LowerCaseRequestHeaderToEnum(std::string_view name);

// Logs the request header to UMA with the specific histogram name.
// `header_name` must be in lower-case.
void LogLowerCaseRequestHeaderToUma(std::string_view histogram_name,
                                    std::string_view header_name);

}  // namespace network

#endif  // SERVICES_NETWORK_REQUEST_HEADER_TO_ENUM_H_