// Copyright 2016 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_NQE_EFFECTIVE_CONNECTION_TYPE_H_ #define NET_NQE_EFFECTIVE_CONNECTION_TYPE_H_ #include <optional> #include <string_view> #include "net/base/net_export.h" namespace net { NET_EXPORT extern const char kEffectiveConnectionTypeUnknown[]; NET_EXPORT extern const char kEffectiveConnectionTypeOffline[]; NET_EXPORT extern const char kEffectiveConnectionTypeSlow2G[]; NET_EXPORT extern const char kEffectiveConnectionType2G[]; NET_EXPORT extern const char kEffectiveConnectionType3G[]; NET_EXPORT extern const char kEffectiveConnectionType4G[]; // EffectiveConnectionType is the connection type whose typical performance is // most similar to the measured performance of the network in use. In many // cases, the "effective" connection type and the actual type of connection in // use are the same, but often a network connection performs significantly // differently, usually worse, from its expected capabilities. // EffectiveConnectionType of a network is independent of if the current // connection is metered or not. For example, an unmetered slow connection may // have EFFECTIVE_CONNECTION_TYPE_SLOW_2G as its effective connection type. The // effective connection type enums are be in increasing order of quality. // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net // GENERATED_JAVA_PREFIX_TO_STRIP: EFFECTIVE_CONNECTION_ enum EffectiveConnectionType { … }; // Returns the string equivalent of |type|. NET_EXPORT const char* GetNameForEffectiveConnectionType( EffectiveConnectionType type); // Returns the EffectiveConnectionType that corresponds to // |connection_type_name|. If the effective connection type is unavailable or if // |connection_type_name| does not match to a known effective connection type, // an unset value is returned. NET_EXPORT std::optional<EffectiveConnectionType> GetEffectiveConnectionTypeForName(std::string_view connection_type_name); // Returns the string equivalent of |type|. Deprecated, and replaced by // GetNameForEffectiveConnectionType. NET_EXPORT_PRIVATE const char* DeprecatedGetNameForEffectiveConnectionType( EffectiveConnectionType type); } // namespace net #endif // NET_NQE_EFFECTIVE_CONNECTION_TYPE_H_