John Abd-El-Malek | 984dc00 | 2019-05-29 01:26:59 | [diff] [blame] | 1 | // 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 | |
| 12 | namespace content { |
| 13 | |
| 14 | // Creates the network::NetworkService object on the IO thread directly instead |
| 15 | // of trying to go through the ServiceManager. |
| 16 | CONTENT_EXPORT void ForceCreateNetworkServiceDirectlyForTesting(); |
| 17 | |
| 18 | // Resets the interface ptr to the network service. |
| 19 | CONTENT_EXPORT void ResetNetworkServiceForTesting(); |
| 20 | |
Julie Jeongeun Kim | a3471c6 | 2019-10-15 07:09:24 | [diff] [blame] | 21 | // 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 Kim | 2811b95 | 2019-10-24 00:36:12 | [diff] [blame] | 24 | // mojo::Remote<URLLoaderFactory>). |
John Abd-El-Malek | 984dc00 | 2019-05-29 01:26:59 | [diff] [blame] | 25 | // |
| 26 | // Can only be called on the UI thread. No-op if NetworkService is disabled. |
Peter Kasting | 7ba9440c | 2020-11-22 01:49:02 | [diff] [blame^] | 27 | CONTENT_EXPORT base::CallbackListSubscription |
John Abd-El-Malek | 984dc00 | 2019-05-29 01:26:59 | [diff] [blame] | 28 | RegisterNetworkServiceCrashHandler(base::RepeatingClosure handler); |
| 29 | |
Clark DuVall | b026e58 | 2019-07-31 19:50:38 | [diff] [blame] | 30 | // 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. |
| 34 | enum 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 Thompson | 2a4c69e9 | 2019-08-21 16:29:11 | [diff] [blame] | 43 | constexpr 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. |
| 47 | enum class SSLKeyLogFileAction { |
| 48 | kLogFileEnabled = 0, |
| 49 | kSwitchFound = 1, |
| 50 | kEnvVarFound = 2, |
| 51 | kMaxValue = kEnvVarFound, |
| 52 | }; |
| 53 | |
Clark DuVall | b026e58 | 2019-07-31 19:50:38 | [diff] [blame] | 54 | // TODO(http://crbug.com/934317): Remove these when done debugging renderer |
| 55 | // hangs. |
| 56 | CONTENT_EXPORT NetworkServiceAvailability GetNetworkServiceAvailability(); |
| 57 | CONTENT_EXPORT base::TimeDelta GetTimeSinceLastNetworkServiceCrash(); |
Clark DuVall | 1f94e9f4 | 2019-08-21 04:09:36 | [diff] [blame] | 58 | CONTENT_EXPORT void PingNetworkService(base::OnceClosure closure); |
Clark DuVall | b026e58 | 2019-07-31 19:50:38 | [diff] [blame] | 59 | |
Ken Rockot | 91216c0f | 2019-10-11 20:38:11 | [diff] [blame] | 60 | // Shuts down the in-process network service or disconnects from the out-of- |
| 61 | // process one, allowing it to shut down. |
| 62 | CONTENT_EXPORT void ShutDownNetworkService(); |
| 63 | |
John Abd-El-Malek | 984dc00 | 2019-05-29 01:26:59 | [diff] [blame] | 64 | } // namespace content |
| 65 | |
| 66 | #endif // CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_ |