chromium/ui/chromeos/strings/network/network_element_localized_strings_provider.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/chromeos/strings/network/network_element_localized_strings_provider.h"

#include "ash/constants/ash_features.h"
#include "ash/constants/url_constants.h"
#include "base/feature_list.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chromeos/ash/components/login/login_state/login_state.h"
#include "chromeos/ash/components/network/network_connection_handler.h"
#include "chromeos/ash/components/network/policy_util.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "components/login/localized_values_builder.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_ui_data_source.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/chromeos/shill_error.h"
#include "ui/chromeos/strings/grit/ui_chromeos_strings.h"
#include "ui/strings/grit/ui_strings.h"

namespace ui {
namespace network_element {

namespace {

constexpr webui::LocalizedString kElementLocalizedStrings[] = {
    {"invalidDomainSuffixMatchEntry", IDS_NETWORK_INVALID_DSM_VALUE},
    {"invalidSubjectAlternativeNameMatchEntry", IDS_NETWORK_INVALID_SAN_ENTRY},
    {"missingEapDefaultServerCaSubjectVerification",
     IDS_NETWORK_EAP_DEFAULT_SERVER_CA_WITHOUT_SUBJECT_VERIFICATION},
    {"OncType", IDS_NETWORK_TYPE},
    {"OncTypeCellular", IDS_NETWORK_TYPE_CELLULAR},
    {"OncTypeEthernet", IDS_NETWORK_TYPE_ETHERNET},
    {"OncTypeMobile", IDS_NETWORK_TYPE_MOBILE_DATA},
    {"OncTypeTether", IDS_NETWORK_TYPE_TETHER},
    {"OncTypeVPN", IDS_NETWORK_TYPE_VPN},
    {"OncTypeWireless", IDS_NETWORK_TYPE_WIRELESS},
    {"OncTypeWiFi", IDS_NETWORK_TYPE_WIFI},
    {"ipAddressNotAvailable", IDS_NETWORK_IP_ADDRESS_NA},
    {"networkListItemConnected", IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED},
    {"networkListItemConnectedNoConnectivity",
     IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED_NO_CONNECTIVITY},
    {"networkListItemConnecting", IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING},
    {"networkListItemSignIn", IDS_STATUSBAR_NETWORK_DEVICE_SIGNIN},
    {"networkListItemCellularSignIn",
     IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR_SIGNIN},
    {"networkListItemConnectingTo", IDS_NETWORK_LIST_CONNECTING_TO},
    {"networkListItemInitializing", IDS_NETWORK_LIST_INITIALIZING},
    {"networkListItemTitle", IDS_NETWORK_LIST_ITEM_TITLE},
    {"networkListItemActivateAfterDeviceSetup",
     IDS_NETWORK_LIST_ACTIVATE_AFTER_DEVICE_SETUP},
    {"networkListItemSubpageButtonLabel",
     IDS_NETWORK_LIST_ITEM_SUBPAGE_BUTTON_LABEL},
    {"networkListItemLabel", IDS_NETWORK_LIST_ITEM_LABEL},
    {"networkListItemLabelCellular", IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR},
    {"networkListItemLabelCellularWithProviderName",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_WITH_PROVIDER_NAME},
    {"networkListItemLabelCellularManaged",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_MANAGED},
    {"networkListItemLabelCellularManagedWithProviderName",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_MANAGED_WITH_PROVIDER_NAME},
    {"networkListItemLabelEthernetManaged",
     IDS_NETWORK_LIST_ITEM_LABEL_ETHERNET_MANAGED},
    {"networkListItemLabelTether", IDS_NETWORK_LIST_ITEM_LABEL_TETHER},
    {"networkListItemLabelTetherWithProviderName",
     IDS_NETWORK_LIST_ITEM_LABEL_TETHER_WITH_PROVIDER_NAME},
    {"networkListItemLabelWifi", IDS_NETWORK_LIST_ITEM_LABEL_WIFI},
    {"networkListItemLabelWifiManaged",
     IDS_NETWORK_LIST_ITEM_LABEL_WIFI_MANAGED},
    {"networkListItemLabelEthernetWithConnectionStatus",
     IDS_NETWORK_LIST_ITEM_LABEL_ETHERNET_WITH_CONNECTION_STATUS},
    {"networkListItemLabelEthernetManagedWithConnectionStatus",
     IDS_NETWORK_LIST_ITEM_LABEL_ETHERNET_MANAGED_WITH_CONNECTION_STATUS},
    {"networkListItemLabelCellularWithConnectionStatus",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_WITH_CONNECTION_STATUS},
    {"networkListItemLabelCellularWithConnectionStatusAndProviderName",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_WITH_CONNECTION_STATUS_AND_PROVIDER_NAME},
    {"networkListItemLabelCellularManagedWithConnectionStatus",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_MANAGED_WITH_CONNECTION_STATUS},
    {"networkListItemLabelCellularManagedWithConnectionStatusAndProviderName",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_MANAGED_WITH_CONNECTION_STATUS_AND_PROVIDER_NAME},
    {"networkListItemLabelCellularUnactivated",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_UNACTIVATED},
    {"networkListItemLabelCellularUnactivatedWithConnectionStatus",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_UNACTIVATED_WITH_CONNECTION_STATUS},
    {"networkListItemLabelWifiWithConnectionStatus",
     IDS_NETWORK_LIST_ITEM_LABEL_WIFI_WITH_CONNECTION_STATUS},
    {"networkListItemLabelWifiManagedWithConnectionStatus",
     IDS_NETWORK_LIST_ITEM_LABEL_WIFI_MANAGED_WITH_CONNECTION_STATUS},
    {"networkListItemLabelTetherWithConnectionStatus",
     IDS_NETWORK_LIST_ITEM_LABEL_TETHER_WITH_CONNECTION_STATUS},
    {"networkListItemLabelTetherWithConnectionStatusAndProviderName",
     IDS_NETWORK_LIST_ITEM_LABEL_TETHER_WITH_CONNECTION_STATUS_AND_PROVIDER_NAME},
    {"networkListItemLabelESimPendingProfile",
     IDS_NETWORK_LIST_ITEM_LABEL_ESIM_PENDING_PROFILE},
    {"networkListItemLabelESimPendingProfileWithProviderName",
     IDS_NETWORK_LIST_ITEM_LABEL_ESIM_PENDING_PROFILE_WITH_PROVIDER_NAME},
    {"networkListItemLabelActivateAfterSetup",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_ACTIVATE_AFTER_SETUP},
    {"networkListItemLabelActivateAfterSetupWithProviderName",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_ACTIVATE_AFTER_SETUP_WITH_PROVIDER_NAME},
    {"networkListItemLabelManagedActivateAfterSetup",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_MANAGED_ACTIVATE_AFTER_SETUP},
    {"networkListItemLabelManagedActivateAfterSetupWithProviderName",
     IDS_NETWORK_LIST_ITEM_LABEL_CELLULAR_MANAGED_ACTIVATE_AFTER_SETUP_WITH_PROVIDER_NAME},
    {"networkListItemLabelESimPendingProfileInstalling",
     IDS_NETWORK_LIST_ITEM_LABEL_ESIM_PENDING_PROFILE_INSTALLING},
    {"networkListItemLabelESimPendingProfileWithProviderNameInstalling",
     IDS_NETWORK_LIST_ITEM_LABEL_ESIM_PENDING_PROFILE_WITH_PROVIDER_NAME_INSTALLING},
    {"wifiNetworkStatusSecured", IDS_WIFI_NETWORK_STATUS_SECURED},
    {"wifiNetworkStatusUnsecured", IDS_WIFI_NETWORK_STATUS_UNSECURED},
    {"networkListItemUpdatedCellularSimCardLocked",
     IDS_NETWORK_LIST_UPDATED_CELLULAR_SIM_CARD_LOCKED},
    {"networkListItemNotConnected", IDS_NETWORK_LIST_NOT_CONNECTED},
    {"networkListItemNoNetwork", IDS_NETWORK_LIST_NO_NETWORK},
    {"networkListItemActivate", IDS_NETWORK_LIST_ITEM_ACTIVATE},
    {"networkListItemActivateA11yLabel",
     IDS_NETWORK_LIST_ITEM_ACTIVATE_A11Y_LABEL},
    {"networkListItemActivating", IDS_NETWORK_LIST_ITEM_ACTIVATING},
    {"networkListItemCellularBlockedA11yLabel",
     IDS_NETWORK_LIST_ITEM_CELLULAR_BLOCKED_A11Y_LABEL},
    {"networkListItemCellularBlockedWithConnectionStatusA11yLabel",
     IDS_NETWORK_LIST_ITEM_CELLULAR_BLOCKED_WITH_CONNECTION_STATUS_A11Y_LABEL},
    {"networkListItemWiFiBlockedA11yLabel",
     IDS_NETWORK_LIST_ITEM_WIFI_BLOCKED_A11Y_LABEL},
    {"networkListItemWiFiBlockedWithConnectionStatusA11yLabel",
     IDS_NETWORK_LIST_ITEM_WIFI_BLOCKED_WITH_CONNECTION_STATUS_A11Y_LABEL},
    {"networkListItemUnavailableSimNetwork",
     IDS_NETWORK_LIST_ITEM_UNAVAILABLE_SIM_NETWORK},
    {"networkListItemDownload", IDS_NETWORK_LIST_ITEM_DOWNLOAD},
    {"networkListItemDownloadA11yLabel",
     IDS_NETWORK_LIST_ITEM_DOWNLOAD_A11Y_LABEL},
    {"networkListItemUnlock", IDS_NETWORK_LIST_ITEM_UNLOCK},
    {"networkListItemUnlockA11YLabel", IDS_NETWORK_LIST_ITEM_UNLOCK_A11Y_LABEL},
    {"networkListItemAddingProfile", IDS_NETWORK_LIST_ITEM_ADDING_PROFILE},
    {"vpnNameTemplate", IDS_NETWORK_LIST_THIRD_PARTY_VPN_NAME_TEMPLATE},
    {"networkIconLabelEthernet", IDS_NETWORK_ICON_LABEL_ETHERNET},
    {"networkIconLabelVpn", IDS_NETWORK_ICON_LABEL_VPN},
    {"networkIconLabelOff", IDS_NETWORK_ICON_LABEL_NETWORK_OFF},
    {"networkIconLabelNoNetwork", IDS_NETWORK_ICON_LABEL_NO_NETWORK},
    {"networkIconLabelConnecting", IDS_NETWORK_ICON_LABEL_CONNECTING},
    {"networkIconLabelNotConnected", IDS_NETWORK_ICON_LABEL_NOT_CONNECTED},
    {"networkIconLabelSignalStrength", IDS_NETWORK_ICON_LABEL_SIGNAL_STRENGTH},
    {"networkListItemUpdatedCellularSimCardCarrierLocked",
     IDS_NETWORK_LIST_UPDATED_CELLULAR_SIM_CARD_CARRIER_LOCKED},
};

}  //  namespace

void AddLocalizedStrings(content::WebUIDataSource* html_source) {
  html_source->AddLocalizedStrings(kElementLocalizedStrings);

  html_source->AddLocalizedString(
      "OncTypeTether", ash::features::IsInstantHotspotRebrandEnabled()
                           ? IDS_NETWORK_TYPE_HOTSPOT
                           : IDS_NETWORK_TYPE_TETHER);
}

void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) {
  for (const auto& entry : kElementLocalizedStrings)
    builder->Add(entry.name, entry.id);

  builder->Add("OncTypeTether", ash::features::IsInstantHotspotRebrandEnabled()
                                    ? IDS_NETWORK_TYPE_HOTSPOT
                                    : IDS_NETWORK_TYPE_TETHER);
}

void AddOncLocalizedStrings(content::WebUIDataSource* html_source) {
  static constexpr webui::LocalizedString kLocalizedStrings[] = {
      // These strings are generated by prepending 'Onc' to the ONC property
      // name. Any '.' in the property name is replaced with '-'. Properties
      // with translatable enumerated values have the value appended after '_'.
      {"OncCellular-APN-AccessPointName",
       IDS_ONC_CELLULAR_APN_ACCESS_POINT_NAME},
      {"OncCellular-APN-AccessPointName_none",
       IDS_ONC_CELLULAR_APN_ACCESS_POINT_NAME_NONE},
      {"OncCellular-APN-Authentication", IDS_ONC_CELLULAR_APN_AUTHENTICATION},
      {"OncCellular-APN-Password", IDS_ONC_CELLULAR_APN_PASSWORD},
      {"OncCellular-APN-Username", IDS_ONC_CELLULAR_APN_USERNAME},
      {"OncCellular-APN-Attach", IDS_ONC_CELLULAR_APN_ATTACH},
      {"OncCellular-APN-Attach_TooltipText",
       IDS_ONC_CELLULAR_APN_ATTACH_TOOLTIP_TEXT},
      {"OncCellular-ActivationState", IDS_ONC_CELLULAR_ACTIVATION_STATE},
      {"OncCellular-ActivationState_Activated",
       IDS_ONC_CELLULAR_ACTIVATION_STATE_ACTIVATED},
      {"OncCellular-ActivationState_Activating",
       IDS_ONC_CELLULAR_ACTIVATION_STATE_ACTIVATING},
      {"OncCellular-ActivationState_NotActivated",
       IDS_ONC_CELLULAR_ACTIVATION_STATE_NOT_ACTIVATED},
      {"OncCellular-ActivationState_PartiallyActivated",
       IDS_ONC_CELLULAR_ACTIVATION_STATE_PARTIALLY_ACTIVATED},
      {"OncCellular-ActivationState_NoService",
       IDS_ONC_CELLULAR_ACTIVATION_STATE_NO_SERVICE},
      {"OncCellular-Family", IDS_ONC_CELLULAR_FAMILY},
      {"OncCellular-FirmwareRevision", IDS_ONC_CELLULAR_FIRMWARE_REVISION},
      {"OncCellular-HardwareRevision", IDS_ONC_CELLULAR_HARDWARE_REVISION},
      {"OncCellular-HomeProvider-Code", IDS_ONC_CELLULAR_HOME_PROVIDER_CODE},
      {"OncCellular-HomeProvider-Country",
       IDS_ONC_CELLULAR_HOME_PROVIDER_COUNTRY},
      {"OncCellular-HomeProvider-Name", IDS_ONC_CELLULAR_HOME_PROVIDER_NAME},
      {"OncCellular-ICCID", IDS_ONC_CELLULAR_ICCID},
      {"OncCellular-IMEI", IDS_ONC_CELLULAR_IMEI},
      {"OncCellular-Manufacturer", IDS_ONC_CELLULAR_MANUFACTURER},
      {"OncCellular-ModelID", IDS_ONC_CELLULAR_MODEL_ID},
      {"OncCellular-NetworkTechnology", IDS_ONC_CELLULAR_NETWORK_TECHNOLOGY},
      {"OncCellular-RoamingState", IDS_ONC_CELLULAR_ROAMING_STATE},
      {"OncCellular-RoamingState_Home", IDS_ONC_CELLULAR_ROAMING_STATE_HOME},
      {"OncCellular-RoamingState_Roaming",
       IDS_ONC_CELLULAR_ROAMING_STATE_ROAMING},
      {"OncCellular-ServingOperator-Code",
       IDS_ONC_CELLULAR_SERVING_OPERATOR_CODE},
      {"OncCellular-ServingOperator-Name",
       IDS_ONC_CELLULAR_SERVING_OPERATOR_NAME},
      {"OncConnected", IDS_ONC_CONNECTED},
      {"OncConnecting", IDS_ONC_CONNECTING},
      {"OncEAP-AnonymousIdentity", IDS_ONC_EAP_ANONYMOUS_IDENTITY},
      {"OncEAP-DomainSuffixMatch", IDS_ONC_EAP_DOMAIN_SUFFIX_MATCH},
      {"OncEAP-Identity", IDS_ONC_EAP_IDENTITY},
      {"OncEAP-Inner", IDS_ONC_EAP_INNER},
      {"OncEAP-Inner_Automatic", IDS_ONC_EAP_INNER_AUTOMATIC},
      {"OncEAP-Inner_CHAP", IDS_ONC_EAP_INNER_CHAP},
      {"OncEAP-Inner_GTC", IDS_ONC_EAP_INNER_GTC},
      {"OncEAP-Inner_MD5", IDS_ONC_EAP_INNER_MD5},
      {"OncEAP-Inner_MSCHAP", IDS_ONC_EAP_INNER_MSCHAP},
      {"OncEAP-Inner_MSCHAPv2", IDS_ONC_EAP_INNER_MSCHAPV2},
      {"OncEAP-Inner_PAP", IDS_ONC_EAP_INNER_PAP},
      {"OncEAP-Outer", IDS_ONC_EAP_OUTER},
      {"OncEAP-Outer_LEAP", IDS_ONC_EAP_OUTER_LEAP},
      {"OncEAP-Outer_PEAP", IDS_ONC_EAP_OUTER_PEAP},
      {"OncEAP-Outer_EAP-TLS", IDS_ONC_EAP_OUTER_TLS},
      {"OncEAP-Outer_EAP-TTLS", IDS_ONC_EAP_OUTER_TTLS},
      {"OncEAP-Password", IDS_ONC_WIFI_PASSWORD},
      {"OncEAP-ServerCA", IDS_ONC_EAP_SERVER_CA},
      {"OncEAP-SubjectAltNameMatch", IDS_ONC_EAP_SUBJECT_ALT_NAME_MATCH},
      {"OncEAP-SubjectMatch", IDS_ONC_EAP_SUBJECT_MATCH},
      {"OncEAP-UserCert", IDS_ONC_EAP_USER_CERT},
      {"OncMacAddress", IDS_ONC_MAC_ADDRESS},
      {"OncName", IDS_ONC_NAME},
      {"OncNotConnected", IDS_ONC_NOT_CONNECTED},
      {"OncPortalState", IDS_ONC_PORTAL_STATE},
      {"OncPortalState_NoInternet", IDS_ONC_PORTAL_STATE_NO_INTERNET},
      {"OncPortalState_Portal", IDS_ONC_PORTAL_STATE_PORTAL},
      {"OncPortalState_PortalSuspected", IDS_ONC_PORTAL_STATE_PORTAL_SUSPECTED},
      {"OncPortalState_ProxyAuthRequired", IDS_ONC_PORTAL_STATE_PROXY_AUTH},
      {"OncTether-BatteryPercentage", IDS_ONC_TETHER_BATTERY_PERCENTAGE},
      {"OncTether-BatteryPercentage_Value",
       IDS_ONC_TETHER_BATTERY_PERCENTAGE_VALUE},
      {"OncTether-SignalStrength", IDS_ONC_TETHER_SIGNAL_STRENGTH},
      {"OncTether-SignalStrength_None", IDS_ONC_TETHER_SIGNAL_STRENGTH_NONE},
      {"OncTether-SignalStrength_Low", IDS_ONC_TETHER_SIGNAL_STRENGTH_LOW},
      {"OncTether-SignalStrength_Medium",
       IDS_ONC_TETHER_SIGNAL_STRENGTH_MEDIUM},
      {"OncTether-SignalStrength_Strong",
       IDS_ONC_TETHER_SIGNAL_STRENGTH_STRONG},
      {"OncTether-Carrier", IDS_ONC_TETHER_CARRIER},
      {"OncTether-Carrier_Unknown", IDS_ONC_TETHER_CARRIER_UNKNOWN},
      {"OncVPN-Host", IDS_ONC_VPN_HOST},
      {"OncVPN-IPsec-AuthType", IDS_ONC_VPN_AUTH_TYPE},
      {"OncVPN-IPsec-AuthType_PSK", IDS_ONC_VPN_IPSEC_PSK},
      {"OncVPN-IPsec-AuthType_Cert", IDS_ONC_EAP_USER_CERT},
      {"OncVPN-IPsec-AuthType_EAP", IDS_ONC_VPN_AUTH_TYPE_USERNAME},
      {"OncVPN-IPsec-Group", IDS_ONC_VPN_IPSEC_GROUP},
      {"OncVPN-IPsec-LocalIdentity", IDS_ONC_VPN_IPSEC_LOCAL_IDENTITY},
      {"OncVPN-IPsec-Password", IDS_ONC_VPN_PASSWORD},
      {"OncVPN-IPsec-PSK", IDS_ONC_VPN_IPSEC_PSK},
      {"OncVPN-IPsec-RemoteIdentity", IDS_ONC_VPN_IPSEC_REMOTE_IDENTITY},
      {"OncVPN-IPsec-Username", IDS_ONC_VPN_USERNAME},
      {"OncVPN-L2TP-Password", IDS_ONC_VPN_PASSWORD},
      {"OncVPN-L2TP-Username", IDS_ONC_VPN_USERNAME},
      {"OncVPN-OpenVPN-Auth", IDS_ONC_VPN_OPENVPN_AUTH},
      {"OncVPN-OpenVPN-Cipher", IDS_ONC_VPN_OPENVPN_CIPHER},
      {"OncVPN-OpenVPN-CompressionAlgorithm",
       IDS_ONC_VPN_OPENVPN_COMPRESSION_ALGORITHM},
      {"OncVPN-OpenVPN-ExtraHosts", IDS_ONC_VPN_OPENVPN_EXTRA_HOSTS},
      {"OncVPN-OpenVPN-KeyDirection", IDS_ONC_VPN_OPENVPN_KEY_DIRECTION},
      {"OncVPN-OpenVPN-OTP", IDS_ONC_VPN_OPENVPN_OTP},
      {"OncVPN-OpenVPN-Password", IDS_ONC_VPN_PASSWORD},
      {"OncVPN-OpenVPN-TlsAuthContents", IDS_ONC_VPN_OPENVPN_TLS_AUTH_CONTENTS},
      {"OncVPN-OpenVPN-Username", IDS_ONC_VPN_USERNAME},
      {"OncVPN-ProviderName", IDS_ONC_VPN_THIRD_PARTY_VPN_PROVIDER_NAME},
      {"OncVPN-Type", IDS_ONC_VPN_TYPE},
      {"OncVPN-Type_IKEv2", IDS_ONC_VPN_TYPE_IKEV2},
      {"OncVPN-Type_L2TP_IPsec", IDS_ONC_VPN_TYPE_L2TP_IPSEC},
      {"OncVPN-Type_OpenVPN", IDS_ONC_VPN_TYPE_OPENVPN},
      {"OncVPN-Type_WireGuard", IDS_ONC_VPN_TYPE_WIREGUARD},
      {"OncVPN-Type_ARCVPN", IDS_ONC_VPN_TYPE_ARCVPN},
      {"OncVPN-WireGuard-IPAddress", IDS_ONC_VPN_WIREGUARD_IP_ADDRESS},
      {"OncVPN-WireGuard-MTU", IDS_ONC_VPN_WIREGUARD_MTU},
      {"OncVPN-WireGuard-DNS", IDS_ONC_VPN_WIREGUARD_DNS},
      {"OncVPN-WireGuard-PrivateKey", IDS_ONC_VPN_WIREGUARD_PRIVATE_KEY},
      {"OncVPN-WireGuard-PublicKey", IDS_ONC_VPN_WIREGUARD_PUBLIC_KEY},
      {"OncVPN-WireGuard-Peer", IDS_ONC_VPN_WIREGUARD_PEER},
      {"OncVPN-WireGuard-Peer-PublicKey", IDS_ONC_VPN_WIREGUARD_PUBLIC_KEY},
      {"OncVPN-WireGuard-Peer-PresharedKey",
       IDS_ONC_VPN_WIREGUARD_PRESHARED_KEY},
      {"OncVPN-WireGuard-Peer-PersistentKeepalive",
       IDS_ONC_VPN_WIREGUARD_PERSISTENT_KEEPALIVE},
      {"OncVPN-WireGuard-Peer-Endpoint", IDS_ONC_VPN_WIREGUARD_ENDPOINT},
      {"OncVPN-WireGuard-Peer-AllowedIP", IDS_ONC_VPN_WIREGUARD_ALLOWED_IP},
      {"OncVPN-WireGuard-Key", IDS_ONC_VPN_WIREGUARD_KEY},
      {"OncVPN-WireGuard-Key_UseCurrent",
       IDS_ONC_VPN_WIREGUARD_KEY_USE_CURRENT},
      {"OncVPN-WireGuard-Key_GenerateNew",
       IDS_ONC_VPN_WIREGUARD_KEY_GENERATE_NEW},
      {"OncVPN-WireGuard-Key_UserInput", IDS_ONC_VPN_WIREGUARD_KEY_USER_INPUT},
      {"OncWiFi-Frequency", IDS_ONC_WIFI_FREQUENCY},
      {"OncWiFi-Passphrase", IDS_ONC_WIFI_PASSWORD},
      {"OncWiFi-SSID", IDS_ONC_WIFI_SSID},
      {"OncWiFi-BSSID", IDS_ONC_WIFI_BSSID},
      {"OncWiFi-Security", IDS_ONC_WIFI_SECURITY},
      {"OncWiFi-Security_None", IDS_ONC_WIFI_SECURITY_NONE},
      {"OncWiFi-Security_WEP-PSK", IDS_ONC_WIFI_SECURITY_WEP},
      {"OncWiFi-Security_WPA-EAP", IDS_ONC_WIFI_SECURITY_EAP},
      {"OncWiFi-Security_WPA-PSK", IDS_ONC_WIFI_SECURITY_PSK},
      {"OncWiFi-Security_WEP-8021X", IDS_ONC_WIFI_SECURITY_EAP},
      {"OncWiFi-SignalStrength", IDS_ONC_WIFI_SIGNAL_STRENGTH},
      {"Oncipv4-Gateway", IDS_ONC_IPV4_GATEWAY},
      {"Oncipv4-IPAddress", IDS_ONC_IPV4_ADDRESS},
      // We use 'Netmask' in the UI instead of RoutingPrefix.
      {"Oncipv4-Netmask", IDS_ONC_IPV4_NETMASK},
      {"Oncipv6-IPAddress", IDS_ONC_IPV6_ADDRESS},
      {"OncHotspot-WiFi-Security_WPA2", IDS_ONC_HOTSPOT_WIFI_SECURITY_WPA2},
      {"OncHotspot-WiFi-Security_WPA3", IDS_ONC_HOTSPOT_WIFI_SECURITY_WPA3},
      {"OncHotspot-WiFi-Security_WPA2WPA3",
       IDS_ONC_HOTSPOT_WIFI_SECURITY_WPA2WPA3},
  };
  html_source->AddLocalizedStrings(kLocalizedStrings);
}

void AddDetailsLocalizedStrings(content::WebUIDataSource* html_source) {
  static constexpr webui::LocalizedString kLocalizedStrings[] = {
      {"internetApnPageTitle", IDS_SETTINGS_ACCESS_POINT_NAME_APN},
      {"apn", IDS_SETTINGS_APN_INPUT_LABEL},
      {"apnPageCreateNewApn", IDS_SETTINGS_CREATE_NEW_APN},
      {"apnPageDiscoverMoreApns", IDS_SETTINGS_DISCOVER_MORE_APNS},
      {"apnSettingsDescriptionNoLink", IDS_SETTINGS_APN_DESCRIPTION_NO_LINK},
      {"customApnLimitReached", IDS_SETTINGS_CUSTOM_APN_LIMIT_REACHED},
      {"apnSettingsZeroStateDescription",
       IDS_SETTINGS_APN_ZERO_STATE_DESCRIPTION},
      {"apnSettingsZeroStateDescriptionWithAddLink",
       IDS_SETTINGS_APN_ZERO_STATE_DESCRIPTION_WITH_ADD_LINK},
      {"apnSettingsDatabaseApnsErrorMessage",
       IDS_SETTINGS_APN_DATABASE_APNS_ERROR_MESSAGE},
      {"apnSettingsCustomApnsErrorMessage",
       IDS_SETTINGS_APN_CUSTOM_APNS_ERROR_MESSAGE},
      {"apnMenuDetails", IDS_SETTINGS_APN_MENU_DETAILS},
      {"apnMenuEdit", IDS_SETTINGS_APN_MENU_EDIT},
      {"apnMenuDisable", IDS_SETTINGS_APN_MENU_DISABLE},
      {"apnMenuEnable", IDS_SETTINGS_APN_MENU_ENABLE},
      {"apnMenuRemove", IDS_SETTINGS_APN_MENU_REMOVE},
      {"apnMoreActionsTitle", IDS_SETTINGS_APN_MORE_ACTIONS_TITLE},
      {"apnA11yName", IDS_SETTINGS_APN_A11Y_NAME},
      {"apnA11yUserFriendlyNameIndicator",
       IDS_SETTINGS_APN_A11Y_USER_FRIENDLY_NAME_INDICATOR},
      {"apnA11yAutoDetected", IDS_SETTINGS_APN_A11Y_AUTO_DETECTED},
      {"apnA11yConnected", IDS_SETTINGS_APN_A11Y_CONNECTED},
      {"apnA11yDisabled", IDS_SETTINGS_APN_A11Y_DISABLED},
      {"apnA11yEnabled", IDS_SETTINGS_APN_A11Y_ENABLED},
      {"apnDetailAddApnDialogTitle", IDS_SETTINGS_ADD_APN_DIALOG_TITLE},
      {"apnDetailViewApnDialogTitle", IDS_SETTINGS_VIEW_APN_DIALOG_TITLE},
      {"apnDetailEditApnDialogTitle", IDS_SETTINGS_EDIT_APN_DIALOG_TITLE},
      {"apnSelectionDialogTitle", IDS_SETTINGS_APN_SELECTION_DIALOG_TITLE},
      {"apnSelectionDialogDescription",
       IDS_SETTINGS_APN_SELECTION_DIALOG_DESCRIPTION},
      {"apnSelectionDialogUseApn",
       IDS_SETTINGS_APN_SELECTION_DIALOG_BUTTON_USE_APN},
      {"apnSelectionDialogA11yUseApnEnabled",
       IDS_SETTINGS_APN_SELECTION_DIALOG_A11Y_USE_APN_ENABLED},
      {"apnSelectionDialogA11yUseApnDisabled",
       IDS_SETTINGS_APN_SELECTION_DIALOG_A11Y_USE_APN_DISABLED},
      {"apnSelectionDialogListItemSelected",
       IDS_SETTINGS_APN_SELECTION_DIALOG_LIST_ITEM_SELECTED},
      {"apnDetailApnErrorMaxChars",
       IDS_SETTINGS_APN_INPUT_LABEL_ERROR_MAX_CHARS},
      {"apnDetailApnErrorInvalidChar",
       IDS_SETTINGS_APN_INPUT_LABEL_ERROR_INVALID_CHAR},
      {"apnDetailAdvancedSettings", IDS_SETTINGS_APN_DIALOG_ADVANCED_SETTING},
      {"apnDetailApnTypes", IDS_SETTINGS_APN_DIALOG_APN_TYPES},
      {"apnDetailApnTypeDefault",
       IDS_SETTINGS_APN_DIALOG_APN_TYPE_DEFAULT_CHECKBOX},
      {"apnDetailApnTypeAttach",
       IDS_SETTINGS_APN_DIALOG_APN_TYPE_ATTACH_CHECKBOX},
      {"apnA11yDefaultAndAttachApn",
       IDS_SETTINGS_APN_A11Y_DEFAULT_AND_ATTACH_APN},
      {"apnA11yDefaultApnOnly", IDS_SETTINGS_APN_A11Y_DEFAULT_APN_ONLY},
      {"apnA11yAttachApnOnly", IDS_SETTINGS_APN_A11Y_ATTACH_APN_ONLY},
      {"apnDetailDefaultApnRequired",
       IDS_SETTINGS_APN_DIALOG_DEFAULT_APN_REQUIRED},
      {"apnDetailIpType", IDS_SETTINGS_APN_DIALOG_IP_TYPE_LABEL},
      {"apnDetailAuthType", IDS_SETTINGS_APN_DIALOG_AUTH_TYPE_LABEL},
      {"apnDetailTypeAuto", IDS_SETTINGS_APN_DIALOG_AUTO},
      {"apnDetailAuthTypePAP", IDS_SETTINGS_APN_DIALOG_AUTH_TYPE_PAP},
      {"apnDetailAuthTypeCHAP", IDS_SETTINGS_APN_DIALOG_AUTH_TYPE_CHAP},
      {"apnDetailIpTypeIpv4", IDS_SETTINGS_APN_DIALOG_IP_TYPE_IPV4},
      {"apnDetailIpTypeIpv6", IDS_SETTINGS_APN_DIALOG_IP_TYPE_IPV6},
      {"apnDetailIpTypeIpv4_Ipv6", IDS_SETTINGS_APN_DIALOG_IP_TYPE_IPV4_IPV6},
      {"apnAutoDetected", IDS_SETTINGS_APN_AUTO_DETECTED},
      {"apnNameModem", IDS_SETTINGS_APN_NAME_MODEM},
      {"apnWarningPromptForDisableRemove",
       IDS_SETTINGS_APN_WARNING_PROMPT_FOR_DISABLE_REMOVE},
      {"apnWarningPromptForEnable", IDS_SETTINGS_APN_WARNING_PROMPT_FOR_ENABLE},
      {"apnDetailDialogAdd", IDS_SETTINGS_APN_DIALOG_ADD},
      {"apnDetailDialogSave", IDS_SETTINGS_APN_DIALOG_SAVE},
      {"apnDetailDialogA11yAddEnabled",
       IDS_SETTINGS_APN_DIALOG_A11Y_ADD_ENABLED},
      {"apnDetailDialogA11ySaveEnabled",
       IDS_SETTINGS_APN_DIALOG_A11Y_SAVE_ENABLED},
      {"apnDetailDialogA11yAddDisabled",
       IDS_SETTINGS_APN_DIALOG_A11Y_ADD_DISABLED},
      {"apnDetailDialogA11ySaveDisabled",
       IDS_SETTINGS_APN_DIALOG_A11Y_SAVE_DISABLED},
      {"apnDetailDialogCancel", IDS_SETTINGS_APN_DIALOG_CANCEL},
      {"apnDetailDialogDone", IDS_SETTINGS_APN_DIALOG_DONE},
      {"hidePassword", IDS_SETTINGS_PASSWORD_HIDE},
      {"showPassword", IDS_SETTINGS_PASSWORD_SHOW},
      {"networkProxy", IDS_SETTINGS_INTERNET_NETWORK_PROXY_PROXY},
      {"networkProxyAddException",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_ADD_EXCEPTION},
      {"networkProxyAllowShared",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_ALLOW_SHARED},
      {"networkProxyAllowSharedEnableWarningTitle",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_ALLOW_SHARED_ENABLE_WARNING_TITLE},
      {"networkProxyAllowSharedDisableWarningTitle",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_ALLOW_SHARED_DISABLE_WARNING_TITLE},
      {"networkProxyAllowSharedWarningMessage",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_ALLOW_SHARED_WARNING_MESSAGE},
      {"networkProxyAutoConfig",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_AUTO_CONFIG},
      {"networkProxyConnectionType",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_CONNECTION_TYPE},
      {"networkProxyEnforcedPolicy",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_ENFORCED_POLICY},
      {"networkProxyExceptionInputA11yLabel",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_EXCEPTION_INPUT_ACCESSIBILITY_LABEL},
      {"networkProxyExceptionList",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_EXCEPTION_LIST},
      {"networkProxyExceptionRemoveA11yLabel",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_EXCEPT_REMOVE_ACCESSIBILITY_LABEL},
      {"networkProxyFtp", IDS_SETTINGS_INTERNET_NETWORK_PROXY_FTP_PROXY},
      {"networkProxyHostInputA11yLabel",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_HOST_INPUT_ACCESSIBILITY_LABEL},
      {"networkProxyHttp", IDS_SETTINGS_INTERNET_NETWORK_PROXY_HTTP_PROXY},
      {"networkProxyPort", IDS_SETTINGS_INTERNET_NETWORK_PROXY_PORT},
      {"networkProxyPortInputA11yLabel",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_PORT_INPUT_ACCESSIBILITY_LABEL},
      {"networkProxyShttp", IDS_SETTINGS_INTERNET_NETWORK_PROXY_SHTTP_PROXY},
      {"networkProxySocks", IDS_SETTINGS_INTERNET_NETWORK_PROXY_SOCKS_HOST},
      {"networkProxyTypeDirect",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_TYPE_DIRECT},
      {"networkProxyTypeManual",
       IDS_SETTINGS_INTERNET_NETWORK_PROXY_TYPE_MANUAL},
      {"networkProxyTypePac", IDS_SETTINGS_INTERNET_NETWORK_PROXY_TYPE_PAC},
      {"networkProxyTypeWpad", IDS_SETTINGS_INTERNET_NETWORK_PROXY_TYPE_WPAD},
      {"networkProxyUseSame", IDS_SETTINGS_INTERNET_NETWORK_PROXY_USE_SAME},
      {"networkSimCardLocked", IDS_SETTINGS_INTERNET_NETWORK_SIM_CARD_LOCKED},
      {"networkSimCardMissing", IDS_SETTINGS_INTERNET_NETWORK_SIM_CARD_MISSING},
      {"networkSimChange", IDS_SETTINGS_INTERNET_NETWORK_SIM_BUTTON_CHANGE},
      {"networkSimChangePin", IDS_SETTINGS_INTERNET_NETWORK_SIM_CHANGE_PIN},
      {"networkSimChangePinTitle",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_CHANGE_PIN_TITLE},
      {"networkSimLockedTooltip",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCKED_TOOLTIP},
      {"networkSimEnter", IDS_SETTINGS_INTERNET_NETWORK_SIM_BUTTON_ENTER},
      {"networkSimEnterNewPin",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ENTER_NEW_PIN},
      {"networkSimEnterOldPin",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ENTER_OLD_PIN},
      {"networkSimEnterPin", IDS_SETTINGS_INTERNET_NETWORK_SIM_ENTER_PIN},
      {"networkSimEnterPinTitle",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ENTER_PIN_TITLE},
      {"networkSimEnterPinDescription",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ENTER_PIN_DESCRIPTION},
      {"networkSimEnterPinSubtext",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ENTER_PIN_DESCRIPTION_TEXT_LABEL},
      {"networkSimEnterPuk", IDS_SETTINGS_INTERNET_NETWORK_SIM_ENTER_PUK},
      {"networkSimLockEnable", IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCK_ENABLE},
      {"networkSimLockEnableSublabel",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCK_ENABLE_SUBLABEL},
      {"networkSimLockedTitle", IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCKED_TITLE},
      {"networkSimLockPolicyAdminSubtitle",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCK_POLICY_ADMIN_SUBTITLE},
      {"networkSimLockedPinSubtitle",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCKED_PIN_SUBTITLE},
      {"networkSimPukDialogSubtitle",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCKED_PUK_SUBTITLE},
      {"networkSimPukDialogManagedSubtitle",
       IDS_SETTINGS_INTERNET_NETWORK_MANAGED_SIM_LOCKED_PUK_SUBTITLE},
      {"networkSimPukDialogManagedWarningNoFailures",
       IDS_SETTINGS_INTERNET_NETWORK_MANAGED_SIM_LOCKED_PUK_WARNING_NO_FAILURES},
      {"networkSimPukDialogWarningNoFailures",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCKED_PUK_WARNING_NO_FAILURES},
      {"networkSimPukDialogWarningWithFailure",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCKED_PUK_WARNING_WITH_FAILURE},
      {"networkSimPukDialogWarningWithFailures",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCKED_PUK_WARNING_WITH_FAILURES},
      {"networkSimPukDialogManagedWarningWithFailure",
       IDS_SETTINGS_INTERNET_NETWORK_MANAGED_SIM_LOCKED_PUK_WARNING_WITH_FAILURE},
      {"networkSimPukDialogManagedWarningWithFailures",
       IDS_SETTINGS_INTERNET_NETWORK_MANAGED_SIM_LOCKED_PUK_WARNING_WITH_FAILURES},
      {"networkSimLockedWarning",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_LOCKED_WARNING},
      {"networkSimReEnterNewPin",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_RE_ENTER_NEW_PIN},
      {"networkSimReEnterNewPin",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_RE_ENTER_NEW_PIN},
      {"networkSimErrorIncorrectPin",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ERROR_INCORRECT_PIN},
      {"networkSimErrorIncorrectPinPlural",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ERROR_INCORRECT_PIN_PLURAL},
      {"networkSimErrorIncorrectPuk",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ERROR_INCORRECT_PUK},
      {"networkSimErrorInvalidPin",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ERROR_INVALID_PIN},
      {"networkSimErrorInvalidPinPlural",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ERROR_INVALID_PIN_PLURAL},
      {"networkSimErrorInvalidPuk",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ERROR_INVALID_PUK},
      {"networkSimErrorPinMismatch",
       IDS_SETTINGS_INTERNET_NETWORK_SIM_ERROR_PIN_MISMATCH},
      {"networkSimUnlock", IDS_SETTINGS_INTERNET_NETWORK_SIM_BUTTON_UNLOCK},
      {"networkAccessPoint", IDS_SETTINGS_INTERNET_NETWORK_ACCESS_POINT},
      {"networkChooseMobile", IDS_SETTINGS_INTERNET_NETWORK_CHOOSE_MOBILE},
      {"networkCellularScan", IDS_SETTINGS_INTERNET_NETWORK_CELLULAR_SCAN},
      {"networkCellularScanCompleted",
       IDS_SETTINGS_INTERNET_NETWORK_CELLULAR_SCAN_COMPLETED},
      {"networkCellularScanConnectedHelp",
       IDS_SETTINGS_INTERNET_NETWORK_CELLULAR_SCAN_CONNECTED_HELP},
      {"networkCellularScanning",
       IDS_SETTINGS_INTERNET_NETWORK_CELLULAR_SCANNING},
      {"networkCellularNoNetworks",
       IDS_SETTINGS_INTERNET_NETWORK_CELLULAR_NO_NETWORKS},
      {"networkNameservers", IDS_SETTINGS_INTERNET_NETWORK_NAMESERVERS},
      {"networkNameserversAutomatic",
       IDS_SETTINGS_INTERNET_NETWORK_NAMESERVERS_AUTOMATIC},
      {"networkNameserversCustom",
       IDS_SETTINGS_INTERNET_NETWORK_NAMESERVERS_CUSTOM},
      {"networkNameserversGoogle",
       IDS_SETTINGS_INTERNET_NETWORK_NAMESERVERS_GOOGLE},
      {"networkNameserversCustomInputA11yLabel",
       IDS_SETTINGS_INTERNET_NETWORK_NAMESERVERS_INPUT_ACCESSIBILITY_LABEL},
      {"networkProxyWpad", IDS_SETTINGS_INTERNET_NETWORK_PROXY_WPAD},
      {"networkProxyWpadNone", IDS_SETTINGS_INTERNET_NETWORK_PROXY_WPAD_NONE},
      {"remove", IDS_REMOVE},
      {"controlledSettingPolicy",
       IDS_SETTINGS_INTERNET_NETWORK_SETTING_MANAGED_BY_ADMIN_TOOLTIP},
  };
  html_source->AddLocalizedStrings(kLocalizedStrings);

  html_source->AddBoolean("isApnRevampEnabled",
                          ash::features::IsApnRevampEnabled());
  html_source->AddBoolean(
      "isApnRevampAndAllowApnModificationPolicyEnabled",
      ash::features::IsApnRevampAndAllowApnModificationPolicyEnabled());

  html_source->AddString("apnSettingsDescriptionWithLink",
                         l10n_util::GetStringFUTF16(
                             IDS_SETTINGS_APN_DESCRIPTION_WITH_LEARN_MORE_LINK,
                             chrome::kApnSettingsLearnMoreUrl));

  html_source->AddString(
      "apnSelectionDialogDescriptionWithLink",
      l10n_util::GetStringFUTF16(
          IDS_SETTINGS_APN_SELECTION_DIALOG_DESCRIPTION_WITH_LINK,
          chrome::kApnSettingsLearnMoreUrl));
}

void AddConfigLocalizedStrings(content::WebUIDataSource* html_source) {
  static constexpr webui::LocalizedString kLocalizedStrings[] = {
      {"networkCAUseDefault", IDS_SETTINGS_INTERNET_NETWORK_CA_USE_DEFAULT},
      {"networkCADoNotCheck", IDS_SETTINGS_INTERNET_NETWORK_CA_DO_NOT_CHECK},
      {"networkNoUserCert", IDS_SETTINGS_INTERNET_NETWORK_NO_USER_CERT},
      {"networkCertificateName",
       IDS_SETTINGS_INTERNET_NETWORK_CERTIFICATE_NAME},
      {"networkCertificateNameHardwareBacked",
       IDS_SETTINGS_INTERNET_NETWORK_CERTIFICATE_NAME_HARDWARE_BACKED},
      {"networkCertificateNoneInstalled",
       IDS_SETTINGS_INTERNET_NETWORK_CERTIFICATE_NONE_INSTALLED},
      {"networkConfigSaveCredentials",
       IDS_SETTINGS_INTERNET_CONFIG_SAVE_CREDENTIALS},
      {"networkConfigShare", IDS_SETTINGS_INTERNET_CONFIG_SHARE},
      {"networkAutoConnect", IDS_SETTINGS_INTERNET_NETWORK_AUTO_CONNECT},
      {"hiddenNetworkWarning", IDS_SETTINGS_HIDDEN_NETWORK_WARNING},
      {"hidePassword", IDS_SETTINGS_PASSWORD_HIDE},
      {"showPassword", IDS_SETTINGS_PASSWORD_SHOW},
  };
  html_source->AddLocalizedStrings(kLocalizedStrings);

  html_source->AddBoolean("eapGtcWifiAuthentication",
                          ash::features::IsEapGtcWifiAuthenticationEnabled());

  html_source->AddBoolean(
      "showHiddenNetworkWarning",
      base::FeatureList::IsEnabled(ash::features::kHiddenNetworkWarning));

  // Login screen and Managed Guest Session (MGS) users can only create shared
  // network configurations. Kiosk users default to shared network
  // configurations. Other users default to unshared network configurations.
  // NOTE: Guest users can only create unshared network configs.
  html_source->AddBoolean("shareNetworkDefault",
                          !ash::LoginState::Get()->UserHasNetworkProfile() ||
                              ash::LoginState::Get()->IsKioskSession());
  // Authenticated and Kiosk users can toggle the share state.
  html_source->AddBoolean("shareNetworkAllowEnable",
                          ash::LoginState::Get()->IsUserAuthenticated() ||
                              ash::LoginState::Get()->IsKioskSession());

  html_source->AddBoolean(
      "ephemeralNetworkPoliciesEnabled",
      ash::policy_util::AreEphemeralNetworkPoliciesEnabled());
}

void AddErrorLocalizedStrings(content::WebUIDataSource* html_source) {
  static constexpr webui::LocalizedString kLocalizedStrings[] = {
      {"Error.CannotChangeSharedConfig",
       IDS_NETWORK_ERROR_CANNOT_CHANGE_SHARED_CONFIG},
      {"Error.PolicyControlled", IDS_NETWORK_ERROR_POLICY_CONTROLLED},
      {"networkErrorNoUserCertificate", IDS_NETWORK_ERROR_NO_USER_CERT},
      {ash::NetworkConnectionHandler::kErrorPassphraseRequired,
       IDS_NETWORK_ERROR_PASSPHRASE_REQUIRED},
      {"networkErrorUnknown", IDS_NETWORK_ERROR_UNKNOWN},
      {"networkErrorNotAvailableForNetworkAuth",
       IDS_SETTINGS_INTERNET_NETWORK_NOT_AVAILABLE_FOR_NETWORK_AUTH},
  };
  html_source->AddLocalizedStrings(kLocalizedStrings);

  // Include Shill errors.
  const char* const shill_errors[] = {
      shill::kErrorOutOfRange,
      shill::kErrorPinMissing,
      shill::kErrorDhcpFailed,
      shill::kErrorConnectFailed,
      shill::kErrorBadPassphrase,
      shill::kErrorBadWEPKey,
      shill::kErrorActivationFailed,
      shill::kErrorNeedEvdo,
      shill::kErrorNeedHomeNetwork,
      shill::kErrorOtaspFailed,
      shill::kErrorAaaFailed,
      shill::kErrorInternal,
      shill::kErrorDNSLookupFailed,
      shill::kErrorHTTPGetFailed,
      shill::kErrorIpsecPskAuthFailed,
      shill::kErrorIpsecCertAuthFailed,
      shill::kErrorEapAuthenticationFailed,
      shill::kErrorEapLocalTlsFailed,
      shill::kErrorEapRemoteTlsFailed,
      shill::kErrorPppAuthFailed,
      shill::kErrorResultInvalidPassphrase,
  };
  for (const auto* error : shill_errors) {
    html_source->AddString(
        error,
        base::UTF16ToUTF8(ui::shill_error::GetShillErrorString(error, "")));
  }
}

}  // namespace network_element

}  // namespace ui