File: network_service_instance_impl.h

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 (80 lines) | stat: -rw-r--r-- 3,277 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
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_
#define CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_

#include <stdint.h>

#include "base/callback_list.h"
#include "base/command_line.h"
#include "base/functional/callback.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom-forward.h"
#include "services/network/public/mojom/cert_verifier_service_updater.mojom-forward.h"
#include "services/network/public/mojom/network_context.mojom-forward.h"

namespace content {

// Creates the network::NetworkService object on the IO thread directly instead
// of trying to go through the ServiceManager.
// This also calls ForceInProcessNetworkService().
CONTENT_EXPORT void ForceCreateNetworkServiceDirectlyForTesting();

// Resets the interface ptr to the network service.
CONTENT_EXPORT void ResetNetworkServiceForTesting();

using NetworkServiceProcessGoneHandler =
    base::RepeatingCallback<void(bool crashed)>;

// Registers |handler| to run (on UI thread) after mojo::Remote<NetworkService>
// encounters an error, in which case `crashed` will be true, or after the
// NetworkService is purposely restarted by the browser, in which case `crashed`
// will be false.  Note that there are no ordering guarantees wrt error
// handlers for other interfaces (e.g. mojo::Remote<NetworkContext> and/or
// mojo::Remote<URLLoaderFactory>).
//
// Can only be called on the UI thread.  No-op if NetworkService is disabled.
CONTENT_EXPORT base::CallbackListSubscription
RegisterNetworkServiceProcessGoneHandler(
    NetworkServiceProcessGoneHandler handler);

constexpr char kSSLKeyLogFileHistogram[] = "Net.SSLKeyLogFileUse";

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class SSLKeyLogFileAction {
  kLogFileEnabled = 0,
  kSwitchFound = 1,
  kEnvVarFound = 2,
  kMaxValue = kEnvVarFound,
};

// Shuts down the in-process network service or disconnects from the out-of-
// process one, allowing it to shut down.
CONTENT_EXPORT void ShutDownNetworkService();

// `on_restart` will be called at the end of every RestartNetworkService().
CONTENT_EXPORT void OnRestartNetworkServiceForTesting(
    base::RepeatingClosure on_restart);

// Returns a CertVerifierParams that can be placed into a new
// network::mojom::NetworkContextParams.
//
// Like |GetCertVerifierParams| but the |cert_verifier_updater_remote| pipe
// passed in can be used to update the returned CertVerifierService with new
// verification parameters.
CONTENT_EXPORT network::mojom::CertVerifierServiceRemoteParamsPtr
GetCertVerifierParamsWithUpdater(
    cert_verifier::mojom::CertVerifierCreationParamsPtr
        cert_verifier_creation_params,
    mojo::PendingReceiver<cert_verifier::mojom::CertVerifierServiceUpdater>
        cert_verifier_updater_remote);

CONTENT_EXPORT uint64_t GetNetLogMaximumFileSizeFromCommandLineForTesting(
    const base::CommandLine& command_line);
}  // namespace content

#endif  // CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_