blob: e59083293826706d37e9ed64f64b5e97149ab689 [file] [log] [blame]
John Abd-El-Malek984dc002019-05-29 01:26:591// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_
6#define CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_
7
8#include "base/callback.h"
9#include "base/callback_list.h"
10#include "content/common/content_export.h"
11
12namespace content {
13
14// Creates the network::NetworkService object on the IO thread directly instead
15// of trying to go through the ServiceManager.
16CONTENT_EXPORT void ForceCreateNetworkServiceDirectlyForTesting();
17
18// Resets the interface ptr to the network service.
19CONTENT_EXPORT void ResetNetworkServiceForTesting();
20
Julie Jeongeun Kima3471c62019-10-15 07:09:2421// Registers |handler| to run (on UI thread) after mojo::Remote<NetworkService>
22// encounters an error. Note that there are no ordering guarantees wrt error
23// handlers for other interfaces (e.g. mojo::Remote<NetworkContext> and/or
Julie Jeongeun Kim2811b952019-10-24 00:36:1224// mojo::Remote<URLLoaderFactory>).
John Abd-El-Malek984dc002019-05-29 01:26:5925//
26// Can only be called on the UI thread. No-op if NetworkService is disabled.
Peter Kasting7ba9440c2020-11-22 01:49:0227CONTENT_EXPORT base::CallbackListSubscription
John Abd-El-Malek984dc002019-05-29 01:26:5928RegisterNetworkServiceCrashHandler(base::RepeatingClosure handler);
29
Clark DuVallb026e582019-07-31 19:50:3830// Corresponds to the "NetworkServiceAvailability" histogram enumeration type in
31// src/tools/metrics/histograms/enums.xml.
32//
33// DO NOT REORDER OR CHANGE THE MEANING OF THESE VALUES.
34enum class NetworkServiceAvailability {
35 AVAILABLE = 0,
36 NOT_CREATED = 1,
37 NOT_BOUND = 2,
38 ENCOUNTERED_ERROR = 3,
39 NOT_RESPONDING = 4,
40 kMaxValue = NOT_RESPONDING
41};
42
Christopher Thompson2a4c69e92019-08-21 16:29:1143constexpr char kSSLKeyLogFileHistogram[] = "Net.SSLKeyLogFileUse";
44
45// These values are persisted to logs. Entries should not be renumbered and
46// numeric values should never be reused.
47enum class SSLKeyLogFileAction {
48 kLogFileEnabled = 0,
49 kSwitchFound = 1,
50 kEnvVarFound = 2,
51 kMaxValue = kEnvVarFound,
52};
53
Clark DuVallb026e582019-07-31 19:50:3854// TODO(http://crbug.com/934317): Remove these when done debugging renderer
55// hangs.
56CONTENT_EXPORT NetworkServiceAvailability GetNetworkServiceAvailability();
57CONTENT_EXPORT base::TimeDelta GetTimeSinceLastNetworkServiceCrash();
Clark DuVall1f94e9f42019-08-21 04:09:3658CONTENT_EXPORT void PingNetworkService(base::OnceClosure closure);
Clark DuVallb026e582019-07-31 19:50:3859
Ken Rockot91216c0f2019-10-11 20:38:1160// Shuts down the in-process network service or disconnects from the out-of-
61// process one, allowing it to shut down.
62CONTENT_EXPORT void ShutDownNetworkService();
63
John Abd-El-Malek984dc002019-05-29 01:26:5964} // namespace content
65
66#endif // CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_