File: request_util.cc

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; 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,806; 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 (88 lines) | stat: -rw-r--r-- 4,223 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
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/fetch/request_util.h"

#include "services/network/public/mojom/fetch_api.mojom-blink.h"

namespace blink {

network::mojom::RequestMode V8RequestModeToMojom(const V8RequestMode& mode) {
  switch (mode.AsEnum()) {
    case blink::V8RequestMode::Enum::kSameOrigin:
      return network::mojom::RequestMode::kSameOrigin;
    case blink::V8RequestMode::Enum::kNoCors:
      return network::mojom::RequestMode::kNoCors;
    case blink::V8RequestMode::Enum::kCors:
      return network::mojom::RequestMode::kCors;
    case blink::V8RequestMode::Enum::kNavigate:
      return network::mojom::RequestMode::kNavigate;
  }
  NOTREACHED();
}

network::mojom::RequestDestination V8RequestDestinationToMojom(
    const V8RequestDestination& destination) {
  switch (destination.AsEnum()) {
    case blink::V8RequestDestination::Enum::k:
      return network::mojom::RequestDestination::kEmpty;
    case blink::V8RequestDestination::Enum::kAudio:
      return network::mojom::RequestDestination::kAudio;
    case blink::V8RequestDestination::Enum::kAudioworklet:
      return network::mojom::RequestDestination::kAudioWorklet;
    case blink::V8RequestDestination::Enum::kDocument:
      return network::mojom::RequestDestination::kDocument;
    case blink::V8RequestDestination::Enum::kEmbed:
      return network::mojom::RequestDestination::kEmbed;
    case blink::V8RequestDestination::Enum::kFont:
      return network::mojom::RequestDestination::kFont;
    case blink::V8RequestDestination::Enum::kFrame:
      return network::mojom::RequestDestination::kFrame;
    case blink::V8RequestDestination::Enum::kIFrame:
      return network::mojom::RequestDestination::kIframe;
    case blink::V8RequestDestination::Enum::kImage:
      return network::mojom::RequestDestination::kImage;
    case blink::V8RequestDestination::Enum::kJson:
      return network::mojom::RequestDestination::kJson;
    case blink::V8RequestDestination::Enum::kManifest:
      return network::mojom::RequestDestination::kManifest;
    case blink::V8RequestDestination::Enum::kObject:
      return network::mojom::RequestDestination::kObject;
    case blink::V8RequestDestination::Enum::kPaintworklet:
      return network::mojom::RequestDestination::kPaintWorklet;
    case blink::V8RequestDestination::Enum::kReport:
      return network::mojom::RequestDestination::kReport;
    case blink::V8RequestDestination::Enum::kScript:
      return network::mojom::RequestDestination::kScript;
    case blink::V8RequestDestination::Enum::kSharedworker:
      return network::mojom::RequestDestination::kSharedWorker;
    case blink::V8RequestDestination::Enum::kStyle:
      return network::mojom::RequestDestination::kStyle;
    case blink::V8RequestDestination::Enum::kTrack:
      return network::mojom::RequestDestination::kTrack;
    case blink::V8RequestDestination::Enum::kVideo:
      return network::mojom::RequestDestination::kVideo;
    case blink::V8RequestDestination::Enum::kWorker:
      return network::mojom::RequestDestination::kWorker;
    case blink::V8RequestDestination::Enum::kXslt:
      return network::mojom::RequestDestination::kXslt;
    case blink::V8RequestDestination::Enum::kFencedframe:
      return network::mojom::RequestDestination::kFencedframe;
    case blink::V8RequestDestination::Enum::kDictionary:
      return network::mojom::RequestDestination::kDictionary;
    case blink::V8RequestDestination::Enum::kSpeculationrules:
      return network::mojom::RequestDestination::kSpeculationRules;
    case blink::V8RequestDestination::Enum::kSharedstorageworklet:
      return network::mojom::RequestDestination::kSharedStorageWorklet;
    case blink::V8RequestDestination::Enum::kWebidentity:
      return network::mojom::RequestDestination::kWebIdentity;
    case blink::V8RequestDestination::Enum::kWebbundle:
      return network::mojom::RequestDestination::kWebBundle;
    case blink::V8RequestDestination::Enum::kServiceworker:
      return network::mojom::RequestDestination::kServiceWorker;
  }
  NOTREACHED();
}

}  // namespace blink