Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6759)

Unified Diff: chrome/browser/ui/webui/options2/chromeos/internet_options_handler.cc

Issue 10827283: This updates the StaticIP configuration UI to match new mocks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split out i18n strings from other tags Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/internet_options_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options2/chromeos/internet_options_handler.cc
diff --git a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler.cc
index 09dbe3900dea19e75536e99958eacc228c16238f..aaeb5eabd5c5a8f7d51bd38ae50c1beff889892b 100644
--- a/chrome/browser/ui/webui/options2/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/internet_options_handler.cc
@@ -18,6 +18,7 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/i18n/time_formatting.h"
+#include "base/json/json_writer.h"
#include "base/string16.h"
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
@@ -27,6 +28,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/choose_mobile_network_dialog.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/cros_network_functions.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/cros/onc_constants.h"
#include "chrome/browser/chromeos/enrollment_dialog_view.h"
@@ -54,6 +56,7 @@
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
@@ -67,7 +70,7 @@ namespace {
static const char kOtherNetworksFakePath[] = "?";
// Keys for the network description dictionary passed to the web ui. Make sure
-// to keep the strings in sync with what the Javascript side uses.
+// to keep the strings in sync with what the JavaScript side uses.
const char kNetworkInfoKeyActivationState[] = "activation_state";
const char kNetworkInfoKeyConnectable[] = "connectable";
const char kNetworkInfoKeyConnected[] = "connected";
@@ -81,6 +84,268 @@ const char kNetworkInfoKeyRemembered[] = "remembered";
const char kNetworkInfoKeyServicePath[] = "servicePath";
const char kNetworkInfoKeyPolicyManaged[] = "policyManaged";
+// These are keys for getting IP information from the web ui.
+const char kIpConfigAddress[] = "address";
+const char kIpConfigPrefixLength[] = "prefixLength";
+const char kIpConfigNetmask[] = "netmask";
+const char kIpConfigGateway[] = "gateway";
+const char kIpConfigNameServers[] = "nameServers";
+const char kIpConfigAutoConfig[] = "ipAutoConfig";
+
+// These are types of name server selections from the web ui.
+const char kNameServerTypeAutomatic[] = "automatic";
+const char kNameServerTypeGoogle[] = "google";
+const char kNameServerTypeUser[] = "user";
+
+// These are dictionary names used to send data to the web ui.
+const char kDictionaryIpConfig[] = "ipconfig";
+const char kDictionaryStaticIp[] = "staticIP";
+const char kDictionarySavedIp[] = "savedIP";
+
+// Google public name servers (DNS).
+const char kGoogleNameServers[] = "8.8.4.4,8.8.8.8";
+
+// Functions we call in JavaScript.
+const char kRefreshNetworkDataFunction[] =
+ "options.network.NetworkList.refreshNetworkData";
+const char kShowDetailedInfoFunction[] =
+ "options.internet.DetailsInternetPage.showDetailedInfo";
+const char kUpdateCellularPlansFunction[] =
+ "options.internet.DetailsInternetPage.updateCellularPlans";
+const char kUpdateSecurityTabFunction[] =
+ "options.internet.DetailsInternetPage.updateSecurityTab";
+
+// Internationalization tags used to lookup strings from JavaScript.
+const char kStrAccessLockedMsg[] = "accessLockedMsg";
+const char kStrAccessSecurityTabLink[] = "accessSecurityTabLink";
+const char kStrActivateButton[] = "activateButton";
+const char kStrActivateNetwork[] = "activateNetwork";
+const char kStrActivationState[] = "activationState";
+const char kStrAddConnectionTitle[] = "addConnectionTitle";
+const char kStrAddConnectionVPN[] = "addConnectionVPN";
+const char kStrAddConnectionWifi[] = "addConnectionWifi";
+const char kStrAirplaneModeLabel[] = "airplaneModeLabel";
+const char kStrAirplaneModeTitle[] = "airplaneModeTitle";
+const char kStrAutoconnectCellular[] = "autoconnectCellular";
+const char kStrAutomaticNameServers[] = "automaticNameServers";
+const char kStrBuyplanButton[] = "buyplanButton";
+const char kStrCellularApnCancel[] = "cellularApnCancel";
+const char kStrCellularApnLabel[] = "cellularApnLabel";
+const char kStrCellularApnOther[] = "cellularApnOther";
+const char kStrCellularApnPassword[] = "cellularApnPassword";
+const char kStrCellularApnSet[] = "cellularApnSet";
+const char kStrCellularApnUseDefault[] = "cellularApnUseDefault";
+const char kStrCellularApnUsername[] = "cellularApnUsername";
+const char kStrCellularConnTabLabel[] = "cellularConnTabLabel";
+const char kStrCellularDeviceTabLabel[] = "cellularDeviceTabLabel";
+const char kStrCellularPlanTabLabel[] = "cellularPlanTabLabel";
+const char kStrCellularTitle[] = "cellularTitle";
+const char kStrChangePinButton[] = "changePinButton";
+const char kStrChangeProxyButton[] = "changeProxyButton";
+const char kStrConnectButton[] = "connectButton";
+const char kStrConnectionState[] = "connectionState";
+const char kStrDataRemaining[] = "dataRemaining";
+const char kStrDataRoamingDisableToggleTooltip[] =
+ "dataRoamingDisableToggleTooltip";
+const char kStrDetailsInternetDismiss[] = "detailsInternetDismiss";
+const char kStrDisableDataRoaming[] = "disableDataRoaming";
+const char kStrDisconnectButton[] = "disconnectButton";
+const char kStrDisconnectNetwork[] = "disconnectNetwork";
+const char kStrEnableDataRoaming[] = "enableDataRoaming";
+const char kStrErrorState[] = "errorState";
+const char kStrEthernetTitle[] = "ethernetTitle";
+const char kStrFirmwareRevision[] = "firmwareRevision";
+const char kStrGoogleNameServers[] = "googleNameServers";
+const char kStrHardwareAddress[] = "hardwareAddress";
+const char kStrHardwareRevision[] = "hardwareRevision";
+const char kStrInetAddress[] = "inetAddress";
+const char kStrInetAutoConnectNetwork[] = "inetAutoConnectNetwork";
+const char kStrInetBssid[] = "inetBssid";
+const char kStrInetConnect[] = "inetConnect";
+const char kStrInetEncryption[] = "inetEncryption";
+const char kStrInetFrequency[] = "inetFrequency";
+const char kStrInetFrequencyFormat[] = "inetFrequencyFormat";
+const char kStrInetGateway[] = "inetGateway";
+const char kStrInetLogin[] = "inetLogin";
+const char kStrInetNameServers[] = "inetNameServers";
+const char kStrInetNetmask[] = "inetNetmask";
+const char kStrInetNetworkShared[] = "inetNetworkShared";
+const char kStrInetPassPrompt[] = "inetPassPrompt";
+const char kStrInetPassProtected[] = "inetPassProtected";
+const char kStrInetPreferredNetwork[] = "inetPreferredNetwork";
+const char kStrInetProviderType[] = "inetProviderType";
+const char kStrInetServerHostname[] = "inetServerHostname";
+const char kStrInetServiceName[] = "inetServiceName";
+const char kStrInetShowPass[] = "inetShowPass";
+const char kStrInetSignalStrength[] = "inetSignalStrength";
+const char kStrInetSignalStrengthFormat[] = "inetSignalStrengthFormat";
+const char kStrInetSsid[] = "inetSsid";
+const char kStrInetSsidPrompt[] = "inetSsidPrompt";
+const char kStrInetStatus[] = "inetStatus";
+const char kStrInetUsername[] = "inetUsername";
+const char kStrIpAutomaticConfiguration[] = "ipAutomaticConfiguration";
+const char kStrJoinOtherNetwork[] = "joinOtherNetwork";
+const char kStrLockSimCard[] = "lockSimCard";
+const char kStrManagedNetwork[] = "managedNetwork";
+const char kStrManufacturer[] = "manufacturer";
+const char kStrModelId[] = "modelId";
+const char kStrNetworkConnected[] = "networkConnected";
+const char kStrNetworkData[] = "networkData";
+const char kStrNetworkDisabled[] = "networkDisabled";
+const char kStrNetworkNotConnected[] = "networkNotConnected";
+const char kStrNetworkOffline[] = "networkOffline";
+const char kStrNetworkOnline[] = "networkOnline";
+const char kStrNetworkOptions[] = "networkOptions";
+const char kStrNetworkTabLabel[] = "networkTabLabel";
+const char kStrNetworkTechnology[] = "networkTechnology";
+const char kStrNoPlansFound[] = "noPlansFound";
+const char kStrOperatorCode[] = "operatorCode";
+const char kStrOperatorName[] = "operatorName";
+const char kStrOwnerUserId[] = "ownerUserId";
+const char kStrPlanExpires[] = "planExpires";
+const char kStrPlanLoading[] = "planLoading";
+const char kStrPlanName[] = "planName";
+const char kStrPreferredNetworks[] = "preferredNetworks";
+const char kStrPreferredNetworksPage[] = "preferredNetworksPage";
+const char kStrPrlVersion[] = "prlVersion";
+const char kStrProxyTabLabel[] = "proxyTabLabel";
+const char kStrPurchaseMore[] = "purchaseMore";
+const char kStrRestrictedPool[] = "restrictedPool";
+const char kStrRoamingState[] = "roamingState";
+const char kStrSecurityTabLabel[] = "securityTabLabel";
+const char kStrServiceName[] = "serviceName";
+const char kStrShowPlanNotifications[] = "showPlanNotifications";
+const char kStrTurnOffCellular[] = "turnOffCellular";
+const char kStrTurnOffWifi[] = "turnOffWifi";
+const char kStrUserNameServer1[] = "userNameServer1";
+const char kStrUserNameServer2[] = "userNameServer2";
+const char kStrUserNameServer3[] = "userNameServer3";
+const char kStrUserNameServer4[] = "userNameServer4";
+const char kStrUserNameServers[] = "userNameServers";
+const char kStrUseSharedProxies[] = "useSharedProxies";
+const char kStrViewAccountButton[] = "viewAccountButton";
+const char kStrVpnTabLabel[] = "vpnTabLabel";
+const char kStrVpnTitle[] = "vpnTitle";
+const char kStrWifiNetworkTabLabel[] = "wifiNetworkTabLabel";
+const char kStrWifiTitle[] = "wifiTitle";
+const char kStrWimaxConnTabLabel[] = "wimaxConnTabLabel";
+const char kStrWimaxTitle[] = "wimaxTitle";
stevenjb 2012/08/14 17:50:01 Since these are all just used once in a table, I'm
+
+// These are other strings used to communicate with JavaScript.
+const char kTagAccessLocked[] = "accessLocked";
+const char kTagActivate[] = "activate";
+const char kTagActivated[] = "activated";
+const char kTagActivationState[] = "activationState";
+const char kTagAirplaneMode[] = "airplaneMode";
+const char kTagApn[] = "apn";
+const char kTagAutoConnect[] = "autoConnect";
+const char kTagBssid[] = "bssid";
+const char kTagBuyDataPlan[] = "buyDataPlan";
+const char kTagCarrierUrl[] = "carrierUrl";
+const char kTagCellularAvailable[] = "cellularAvailable";
+const char kTagCellularBusy[] = "cellularBusy";
+const char kTagCellularEnabled[] = "cellularEnabled";
+const char kTagChangePin[] = "changePin";
+const char kTagConnect[] = "connect";
+const char kTagConnected[] = "connected";
+const char kTagConnecting[] = "connecting";
+const char kTagConnectionState[] = "connectionState";
+const char kTagControlledBy[] = "controlledBy";
+const char kTagDataRemaining[] = "dataRemaining";
+const char kTagDefault[] = "default";
+const char kTagDeviceConnected[] = "deviceConnected";
+const char kTagDisableCellular[] = "disableCellular";
+const char kTagDisableWifi[] = "disableWifi";
+const char kTagDisableWimax[] = "disableWimax";
+const char kTagDisconnect[] = "disconnect";
+const char kTagEnableCellular[] = "enableCellular";
+const char kTagEnableWifi[] = "enableWifi";
+const char kTagEnableWimax[] = "enableWimax";
+const char kTagEncryption[] = "encryption";
+const char kTagErrorState[] = "errorState";
+const char kTagEsn[] = "esn";
+const char kTagFirmwareRevision[] = "firmwareRevision";
+const char kTagForget[] = "forget";
+const char kTagFrequency[] = "frequency";
+const char kTagGsm[] = "gsm";
+const char kTagHardwareAddress[] = "hardwareAddress";
+const char kTagHardwareRevision[] = "hardwareRevision";
+const char kTagIdentity[] = "identity";
+const char kTagImei[] = "imei";
+const char kTagImsi[] = "imsi";
+const char kTagLanguage[] = "language";
+const char kTagLastGoodApn[] = "lastGoodApn";
+const char kTagLocalizedName[] = "localizedName";
+const char kTagManufacturer[] = "manufacturer";
+const char kTagMdn[] = "mdn";
+const char kTagMeid[] = "meid";
+const char kTagMin[] = "min";
+const char kTagModelId[] = "modelId";
+const char kTagName[] = "name";
+const char kTagNameServersGoogle[] = "nameServersGoogle";
+const char kTagNameServerType[] = "nameServerType";
+const char kTagNeedsPlan[] = "needsPlan";
+const char kTagNetworkCommand[] = "networkCommand";
+const char kTagNetworkId[] = "networkId";
+const char kTagNetworkName[] = "networkName";
+const char kTagNetworkTechnology[] = "networkTechnology";
+const char kTagOperatorCode[] = "operatorCode";
+const char kTagOperatorName[] = "operatorName";
+const char kTagOptions[] = "options";
+const char kTagPassword[] = "password";
+const char kTagPlanExpires[] = "planExpires";
+const char kTagPlans[] = "plans";
+const char kTagPlanSummary[] = "planSummary";
+const char kTagPlanType[] = "planType";
+const char kTagPolicy[] = "policy";
+const char kTagPreferred[] = "preferred";
+const char kTagPrlVersion[] = "prlVersion";
+const char kTagProvider_type[] = "provider_type";
+const char kTagProviderApnList[] = "providerApnList";
+const char kTagRecommended[] = "recommended";
+const char kTagRefreshCellularPlan[] = "refreshCellularPlan";
+const char kTagRefreshNetworks[] = "refreshNetworks";
+const char kTagRemembered[] = "remembered";
+const char kTagRememberedList[] = "rememberedList";
+const char kTagRestrictedPool[] = "restrictedPool";
+const char kTagRoamingState[] = "roamingState";
+const char kTagServer_hostname[] = "server_hostname";
+const char kTagService_name[] = "service_name";
+const char kTagServiceName[] = "serviceName";
+const char kTagServicePath[] = "servicePath";
+const char kTagSetApn[] = "setApn";
+const char kTagSetAutoConnect[] = "setAutoConnect";
+const char kTagSetIPConfig[] = "setIPConfig";
+const char kTagSetPreferNetwork[] = "setPreferNetwork";
+const char kTagSetSimCardLock[] = "setSimCardLock";
+const char kTagShared[] = "shared";
+const char kTagShowActivateButton[] = "showActivateButton";
+const char kTagShowBuyButton[] = "showBuyButton";
+const char kTagShowMorePlanInfo[] = "showMorePlanInfo";
+const char kTagShowPreferred[] = "showPreferred";
+const char kTagShowProxy[] = "showProxy";
+const char kTagShowStaticIPConfig[] = "showStaticIPConfig";
+const char kTagShowViewAccountButton[] = "showViewAccountButton";
+const char kTagSimCardLockEnabled[] = "simCardLockEnabled";
+const char kTagSsid[] = "ssid";
+const char kTagStrength[] = "strength";
+const char kTagSupportUrl[] = "supportUrl";
+const char kTagToggleAirplaneMode[] = "toggleAirplaneMode";
+const char kTagTrue[] = "true";
+const char kTagType[] = "type";
+const char kTagUsername[] = "username";
+const char kTagValue[] = "value";
+const char kTagVpnList[] = "vpnList";
+const char kTagWarning[] = "warning";
+const char kTagWifiAvailable[] = "wifiAvailable";
+const char kTagWifiBusy[] = "wifiBusy";
+const char kTagWifiEnabled[] = "wifiEnabled";
+const char kTagWimaxAvailable[] = "wimaxAvailable";
+const char kTagWimaxBusy[] = "wimaxBusy";
+const char kTagWimaxEnabled[] = "wimaxEnabled";
+const char kTagWiredList[] = "wiredList";
+const char kTagWirelessList[] = "wirelessList";
+
// A helper class for building network information dictionaries to be sent to
// the webui code.
class NetworkInfoDictionary {
@@ -260,6 +525,68 @@ DictionaryValue* NetworkInfoDictionary::BuildDictionary() {
return network_info.release();
}
+// Pulls IP information out of a shill service properties dictionary. If
+// |static_ip| is true, then it fetches "StaticIP.*" properties. If not, then it
+// fetches "SavedIP.*" properties. Caller must take ownership of returned
+// dictionary. If non-NULL, |ip_parameters_set| returns a count of the number
+// of IP routing parameters that get set.
+DictionaryValue* BuildIPInfoDictionary(const DictionaryValue& shill_properties,
+ bool static_ip,
+ int* routing_parameters_set) {
+ std::string address_key;
+ std::string prefix_len_key;
+ std::string gateway_key;
+ std::string name_servers_key;
+ if (static_ip) {
+ address_key = shill::kStaticIPAddressProperty;
+ prefix_len_key = shill::kStaticIPPrefixlenProperty;
+ gateway_key = shill::kStaticIPGatewayProperty;
+ name_servers_key = shill::kStaticIPNameServersProperty;
+ } else {
+ address_key = shill::kSavedIPAddressProperty;
+ prefix_len_key = shill::kSavedIPPrefixlenProperty;
+ gateway_key = shill::kSavedIPGatewayProperty;
+ name_servers_key = shill::kSavedIPNameServersProperty;
+ }
+
+ scoped_ptr<DictionaryValue> ip_info_dict(new DictionaryValue);
+ std::string address;
+ int routing_parameters = 0;
+ if (shill_properties.GetStringWithoutPathExpansion(address_key, &address)) {
+ ip_info_dict->SetString(kIpConfigAddress, address);
+ VLOG(2) << "Found " << address_key << ": " << address;
+ routing_parameters++;
+ }
+ int prefix_len = -1;
+ if (shill_properties.GetIntegerWithoutPathExpansion(
+ prefix_len_key, &prefix_len)) {
+ ip_info_dict->SetInteger(kIpConfigPrefixLength, prefix_len);
+ ip_info_dict->SetString(kIpConfigNetmask,
+ chromeos::CrosPrefixLengthToNetmask(prefix_len));
+ VLOG(2) << "Found " << prefix_len_key << ": "
+ << prefix_len
+ << " (" << chromeos::CrosPrefixLengthToNetmask(prefix_len) << ")";
+ routing_parameters++;
+ }
+ std::string gateway;
+ if (shill_properties.GetStringWithoutPathExpansion(gateway_key, &gateway)) {
+ ip_info_dict->SetString(kIpConfigGateway, gateway);
+ VLOG(2) << "Found " << gateway_key << ": " << gateway;
+ routing_parameters++;
+ }
+ if (routing_parameters_set)
+ *routing_parameters_set = routing_parameters;
+
+ std::string name_servers;
+ if (shill_properties.GetStringWithoutPathExpansion(
+ name_servers_key, &name_servers)) {
+ ip_info_dict->SetString(kIpConfigNameServers, name_servers);
+ VLOG(2) << "Found " << name_servers_key << ": " << name_servers;
+ }
+
+ return ip_info_dict.release();
+}
+
} // namespace
namespace options2 {
@@ -294,159 +621,169 @@ void InternetOptionsHandler::GetLocalizedValues(
// Main settings page.
- { "ethernetTitle", IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET },
- { "wifiTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIFI_NETWORK },
+ { kStrEthernetTitle, IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET },
+ { kStrWifiTitle, IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIFI_NETWORK },
// TODO(zelidrag): Change details title to Wimax once we get strings.
- { "wimaxTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_CELLULAR_NETWORK },
- { "cellularTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_CELLULAR_NETWORK },
- { "vpnTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_PRIVATE_NETWORK },
- { "airplaneModeTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_AIRPLANE_MODE },
- { "airplaneModeLabel", IDS_OPTIONS_SETTINGS_NETWORK_AIRPLANE_MODE_LABEL },
- { "networkNotConnected", IDS_OPTIONS_SETTINGS_NETWORK_NOT_CONNECTED },
- { "networkConnected", IDS_CHROMEOS_NETWORK_STATE_READY },
- { "joinOtherNetwork", IDS_OPTIONS_SETTINGS_NETWORK_OTHER },
- { "networkOffline", IDS_OPTIONS_SETTINGS_NETWORK_OFFLINE },
- { "networkDisabled", IDS_OPTIONS_SETTINGS_NETWORK_DISABLED },
- { "networkOnline", IDS_OPTIONS_SETTINGS_NETWORK_ONLINE },
- { "networkOptions", IDS_OPTIONS_SETTINGS_NETWORK_OPTIONS },
- { "turnOffWifi", IDS_OPTIONS_SETTINGS_NETWORK_DISABLE_WIFI },
- { "turnOffCellular", IDS_OPTIONS_SETTINGS_NETWORK_DISABLE_CELLULAR },
- { "disconnectNetwork", IDS_OPTIONS_SETTINGS_DISCONNECT },
- { "preferredNetworks", IDS_OPTIONS_SETTINGS_PREFERRED_NETWORKS_LABEL },
- { "preferredNetworksPage", IDS_OPTIONS_SETTINGS_PREFERRED_NETWORKS_TITLE },
- { "useSharedProxies", IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES },
- { "addConnectionTitle",
+ { kStrWimaxTitle, IDS_OPTIONS_SETTINGS_SECTION_TITLE_CELLULAR_NETWORK },
+ { kStrCellularTitle, IDS_OPTIONS_SETTINGS_SECTION_TITLE_CELLULAR_NETWORK },
+ { kStrVpnTitle, IDS_OPTIONS_SETTINGS_SECTION_TITLE_PRIVATE_NETWORK },
+ { kStrAirplaneModeTitle, IDS_OPTIONS_SETTINGS_SECTION_TITLE_AIRPLANE_MODE },
+ { kStrAirplaneModeLabel, IDS_OPTIONS_SETTINGS_NETWORK_AIRPLANE_MODE_LABEL },
+ { kStrNetworkNotConnected, IDS_OPTIONS_SETTINGS_NETWORK_NOT_CONNECTED },
+ { kStrNetworkConnected, IDS_CHROMEOS_NETWORK_STATE_READY },
+ { kStrJoinOtherNetwork, IDS_OPTIONS_SETTINGS_NETWORK_OTHER },
+ { kStrNetworkOffline, IDS_OPTIONS_SETTINGS_NETWORK_OFFLINE },
+ { kStrNetworkDisabled, IDS_OPTIONS_SETTINGS_NETWORK_DISABLED },
+ { kStrNetworkOnline, IDS_OPTIONS_SETTINGS_NETWORK_ONLINE },
+ { kStrNetworkOptions, IDS_OPTIONS_SETTINGS_NETWORK_OPTIONS },
+ { kStrTurnOffWifi, IDS_OPTIONS_SETTINGS_NETWORK_DISABLE_WIFI },
+ { kStrTurnOffCellular, IDS_OPTIONS_SETTINGS_NETWORK_DISABLE_CELLULAR },
+ { kStrDisconnectNetwork, IDS_OPTIONS_SETTINGS_DISCONNECT },
+ { kStrPreferredNetworks, IDS_OPTIONS_SETTINGS_PREFERRED_NETWORKS_LABEL },
+ { kStrPreferredNetworksPage,
+ IDS_OPTIONS_SETTINGS_PREFERRED_NETWORKS_TITLE },
+ { kStrUseSharedProxies, IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES },
+ { kStrAddConnectionTitle,
IDS_OPTIONS_SETTINGS_SECTION_TITLE_ADD_CONNECTION },
- { "addConnectionWifi", IDS_OPTIONS_SETTINGS_ADD_CONNECTION_WIFI },
- { "addConnectionVPN", IDS_STATUSBAR_NETWORK_ADD_VPN },
- { "enableDataRoaming", IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING },
- { "disableDataRoaming", IDS_OPTIONS_SETTINGS_DISABLE_DATA_ROAMING },
- { "dataRoamingDisableToggleTooltip",
+ { kStrAddConnectionWifi, IDS_OPTIONS_SETTINGS_ADD_CONNECTION_WIFI },
+ { kStrAddConnectionVPN, IDS_STATUSBAR_NETWORK_ADD_VPN },
+ { kStrEnableDataRoaming, IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING },
+ { kStrDisableDataRoaming, IDS_OPTIONS_SETTINGS_DISABLE_DATA_ROAMING },
+ { kStrDataRoamingDisableToggleTooltip,
IDS_OPTIONS_SETTINGS_TOGGLE_DATA_ROAMING_RESTRICTION },
- { "activateNetwork", IDS_STATUSBAR_NETWORK_DEVICE_ACTIVATE },
+ { kStrActivateNetwork, IDS_STATUSBAR_NETWORK_DEVICE_ACTIVATE },
// Internet details dialog.
- { "changeProxyButton",
+ { kStrChangeProxyButton,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CHANGE_PROXY_BUTTON },
- { "managedNetwork", IDS_OPTIONS_SETTINGS_MANAGED_NETWORK },
- { "wifiNetworkTabLabel", IDS_OPTIONS_SETTINGS_INTERNET_TAB_CONNECTION },
- { "vpnTabLabel", IDS_OPTIONS_SETTINGS_INTERNET_TAB_VPN },
- { "cellularPlanTabLabel", IDS_OPTIONS_SETTINGS_INTERNET_TAB_PLAN },
- { "cellularConnTabLabel", IDS_OPTIONS_SETTINGS_INTERNET_TAB_CONNECTION },
- { "cellularDeviceTabLabel", IDS_OPTIONS_SETTINGS_INTERNET_TAB_DEVICE },
- { "networkTabLabel", IDS_OPTIONS_SETTINGS_INTERNET_TAB_NETWORK },
- { "securityTabLabel", IDS_OPTIONS_SETTINGS_INTERNET_TAB_SECURITY },
- { "proxyTabLabel", IDS_OPTIONS_SETTINGS_INTERNET_TAB_PROXY },
- { "useDHCP", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USE_DHCP },
- { "useStaticIP", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USE_STATIC_IP },
- { "connectionState", IDS_OPTIONS_SETTINGS_INTERNET_CONNECTION_STATE },
- { "inetAddress", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_ADDRESS },
- { "inetSubnetAddress", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SUBNETMASK },
- { "inetGateway", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_GATEWAY },
- { "inetDns", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_DNSSERVER },
- { "hardwareAddress",
+ { kStrManagedNetwork, IDS_OPTIONS_SETTINGS_MANAGED_NETWORK },
+ { kStrWifiNetworkTabLabel, IDS_OPTIONS_SETTINGS_INTERNET_TAB_CONNECTION },
+ { kStrVpnTabLabel, IDS_OPTIONS_SETTINGS_INTERNET_TAB_VPN },
+ { kStrCellularPlanTabLabel, IDS_OPTIONS_SETTINGS_INTERNET_TAB_PLAN },
+ { kStrCellularConnTabLabel, IDS_OPTIONS_SETTINGS_INTERNET_TAB_CONNECTION },
+ { kStrCellularDeviceTabLabel, IDS_OPTIONS_SETTINGS_INTERNET_TAB_DEVICE },
+ { kStrNetworkTabLabel, IDS_OPTIONS_SETTINGS_INTERNET_TAB_NETWORK },
+ { kStrSecurityTabLabel, IDS_OPTIONS_SETTINGS_INTERNET_TAB_SECURITY },
+ { kStrProxyTabLabel, IDS_OPTIONS_SETTINGS_INTERNET_TAB_PROXY },
+ { kStrConnectionState, IDS_OPTIONS_SETTINGS_INTERNET_CONNECTION_STATE },
+ { kStrInetAddress, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_ADDRESS },
+ { kStrInetNetmask, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SUBNETMASK },
+ { kStrInetGateway, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_GATEWAY },
+ { kStrInetNameServers, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_DNSSERVER },
+ { kStrIpAutomaticConfiguration,
+ IDS_OPTIONS_SETTINGS_INTERNET_IP_AUTOMATIC_CONFIGURATION },
+ { kStrAutomaticNameServers,
+ IDS_OPTIONS_SETTINGS_INTERNET_AUTOMATIC_NAME_SERVERS },
+ { kStrUserNameServer1, IDS_OPTIONS_SETTINGS_INTERNET_USER_NAME_SERVER_1 },
+ { kStrUserNameServer2, IDS_OPTIONS_SETTINGS_INTERNET_USER_NAME_SERVER_2 },
+ { kStrUserNameServer3, IDS_OPTIONS_SETTINGS_INTERNET_USER_NAME_SERVER_3 },
+ { kStrUserNameServer4, IDS_OPTIONS_SETTINGS_INTERNET_USER_NAME_SERVER_4 },
+ { kStrGoogleNameServers,
+ IDS_OPTIONS_SETTINGS_INTERNET_GOOGLE_NAME_SERVERS },
+ { kStrUserNameServers, IDS_OPTIONS_SETTINGS_INTERNET_USER_NAME_SERVERS },
+ { kStrHardwareAddress,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_HARDWARE_ADDRESS },
- { "detailsInternetDismiss", IDS_CLOSE },
- { "activateButton", IDS_OPTIONS_SETTINGS_ACTIVATE },
- { "buyplanButton", IDS_OPTIONS_SETTINGS_BUY_PLAN },
- { "connectButton", IDS_OPTIONS_SETTINGS_CONNECT },
- { "disconnectButton", IDS_OPTIONS_SETTINGS_DISCONNECT },
- { "viewAccountButton", IDS_STATUSBAR_NETWORK_VIEW_ACCOUNT },
+ { kStrDetailsInternetDismiss, IDS_CLOSE },
+ { kStrActivateButton, IDS_OPTIONS_SETTINGS_ACTIVATE },
+ { kStrBuyplanButton, IDS_OPTIONS_SETTINGS_BUY_PLAN },
+ { kStrConnectButton, IDS_OPTIONS_SETTINGS_CONNECT },
+ { kStrDisconnectButton, IDS_OPTIONS_SETTINGS_DISCONNECT },
+ { kStrViewAccountButton, IDS_STATUSBAR_NETWORK_VIEW_ACCOUNT },
// TODO(zelidrag): Change details title to Wimax once we get strings.
- { "wimaxConnTabLabel", IDS_OPTIONS_SETTINGS_INTERNET_TAB_CONNECTION },
+ { kStrWimaxConnTabLabel, IDS_OPTIONS_SETTINGS_INTERNET_TAB_CONNECTION },
// Wifi Tab.
- { "accessLockedMsg", IDS_STATUSBAR_NETWORK_LOCKED },
- { "inetSsid", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID },
- { "inetBssid", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_BSSID },
- { "inetEncryption",
+ { kStrAccessLockedMsg, IDS_STATUSBAR_NETWORK_LOCKED },
+ { kStrInetSsid, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID },
+ { kStrInetBssid, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_BSSID },
+ { kStrInetEncryption,
IDS_OPTIONS_SETTIGNS_INTERNET_OPTIONS_NETWORK_ENCRYPTION },
- { "inetFrequency",
+ { kStrInetFrequency,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_FREQUENCY },
- { "inetFrequencyFormat",
+ { kStrInetFrequencyFormat,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_FREQUENCY_MHZ },
- { "inetSignalStrength",
+ { kStrInetSignalStrength,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_STRENGTH },
- { "inetSignalStrengthFormat",
+ { kStrInetSignalStrengthFormat,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_STRENGTH_PERCENTAGE },
- { "inetPassProtected",
+ { kStrInetPassProtected,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NET_PROTECTED },
- { "inetNetworkShared",
+ { kStrInetNetworkShared,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_SHARED },
- { "inetPreferredNetwork",
+ { kStrInetPreferredNetwork,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PREFER_NETWORK },
- { "inetAutoConnectNetwork",
+ { kStrInetAutoConnectNetwork,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_AUTO_CONNECT },
- { "inetLogin", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_LOGIN },
- { "inetShowPass", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SHOWPASSWORD },
- { "inetPassPrompt", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSWORD },
- { "inetSsidPrompt", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SSID },
- { "inetStatus", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_STATUS_TITLE },
- { "inetConnect", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CONNECT_TITLE },
+ { kStrInetLogin, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_LOGIN },
+ { kStrInetShowPass, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SHOWPASSWORD },
+ { kStrInetPassPrompt, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSWORD },
+ { kStrInetSsidPrompt, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SSID },
+ { kStrInetStatus, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_STATUS_TITLE },
+ { kStrInetConnect, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CONNECT_TITLE },
// VPN Tab.
- { "inetServiceName",
+ { kStrInetServiceName,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME },
- { "inetServerHostname",
+ { kStrInetServerHostname,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME },
- { "inetProviderType",
+ { kStrInetProviderType,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE },
- { "inetUsername", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USERNAME },
+ { kStrInetUsername, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USERNAME },
// Cellular Tab.
- { "serviceName", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_SERVICE_NAME },
- { "networkTechnology",
+ { kStrServiceName, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_SERVICE_NAME },
+ { kStrNetworkTechnology,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_NETWORK_TECHNOLOGY },
- { "operatorName", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_OPERATOR },
- { "operatorCode", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_OPERATOR_CODE },
- { "activationState",
+ { kStrOperatorName, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_OPERATOR },
+ { kStrOperatorCode, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_OPERATOR_CODE },
+ { kStrActivationState,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_ACTIVATION_STATE },
- { "roamingState", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_ROAMING_STATE },
- { "restrictedPool",
+ { kStrRoamingState, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_ROAMING_STATE },
+ { kStrRestrictedPool,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_RESTRICTED_POOL },
- { "errorState", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_ERROR_STATE },
- { "manufacturer", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_MANUFACTURER },
- { "modelId", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_MODEL_ID },
- { "firmwareRevision",
+ { kStrErrorState, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_ERROR_STATE },
+ { kStrManufacturer, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_MANUFACTURER },
+ { kStrModelId, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_MODEL_ID },
+ { kStrFirmwareRevision,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_FIRMWARE_REVISION },
- { "hardwareRevision",
+ { kStrHardwareRevision,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_HARDWARE_REVISION },
- { "prlVersion", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_PRL_VERSION },
- { "cellularApnLabel", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN },
- { "cellularApnOther", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN_OTHER },
- { "cellularApnUsername",
+ { kStrPrlVersion, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_PRL_VERSION },
+ { kStrCellularApnLabel, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN },
+ { kStrCellularApnOther, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN_OTHER },
+ { kStrCellularApnUsername,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN_USERNAME },
- { "cellularApnPassword",
+ { kStrCellularApnPassword,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN_PASSWORD },
- { "cellularApnUseDefault",
+ { kStrCellularApnUseDefault,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN_CLEAR },
- { "cellularApnSet", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN_SET },
- { "cellularApnCancel", IDS_CANCEL },
+ { kStrCellularApnSet, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_APN_SET },
+ { kStrCellularApnCancel, IDS_CANCEL },
// Security Tab.
- { "accessSecurityTabLink",
+ { kStrAccessSecurityTabLink,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_ACCESS_SECURITY_TAB },
- { "lockSimCard", IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_LOCK_SIM_CARD },
- { "changePinButton",
+ { kStrLockSimCard, IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_LOCK_SIM_CARD },
+ { kStrChangePinButton,
IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_CHANGE_PIN_BUTTON },
// Plan Tab.
- { "planName", IDS_OPTIONS_SETTINGS_INTERNET_CELL_PLAN_NAME },
- { "planLoading", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_LOADING_PLAN },
- { "noPlansFound", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NO_PLANS_FOUND },
- { "purchaseMore", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PURCHASE_MORE },
- { "dataRemaining", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_DATA_REMAINING },
- { "planExpires", IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EXPIRES },
- { "showPlanNotifications",
+ { kStrPlanName, IDS_OPTIONS_SETTINGS_INTERNET_CELL_PLAN_NAME },
+ { kStrPlanLoading, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_LOADING_PLAN },
+ { kStrNoPlansFound, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NO_PLANS_FOUND },
+ { kStrPurchaseMore, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PURCHASE_MORE },
+ { kStrDataRemaining, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_DATA_REMAINING },
+ { kStrPlanExpires, IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EXPIRES },
+ { kStrShowPlanNotifications,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SHOW_MOBILE_NOTIFICATION },
- { "autoconnectCellular",
+ { kStrAutoconnectCellular,
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_AUTO_CONNECT }
};
@@ -454,11 +791,11 @@ void InternetOptionsHandler::GetLocalizedValues(
std::string owner;
chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner);
- localized_strings->SetString("ownerUserId", UTF8ToUTF16(owner));
+ localized_strings->SetString(kStrOwnerUserId, UTF8ToUTF16(owner));
DictionaryValue* network_dictionary = new DictionaryValue;
FillNetworkInfo(network_dictionary);
- localized_strings->Set("networkData", network_dictionary);
+ localized_strings->Set(kStrNetworkData, network_dictionary);
}
void InternetOptionsHandler::InitializePage() {
@@ -467,58 +804,58 @@ void InternetOptionsHandler::InitializePage() {
void InternetOptionsHandler::RegisterMessages() {
// Setup handlers specific to this panel.
- web_ui()->RegisterMessageCallback("networkCommand",
+ web_ui()->RegisterMessageCallback(kTagNetworkCommand,
base::Bind(&InternetOptionsHandler::NetworkCommandCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("refreshNetworks",
+ web_ui()->RegisterMessageCallback(kTagRefreshNetworks,
base::Bind(&InternetOptionsHandler::RefreshNetworksCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("refreshCellularPlan",
+ web_ui()->RegisterMessageCallback(kTagRefreshCellularPlan,
base::Bind(&InternetOptionsHandler::RefreshCellularPlanCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("setPreferNetwork",
+ web_ui()->RegisterMessageCallback(kTagSetPreferNetwork,
base::Bind(&InternetOptionsHandler::SetPreferNetworkCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("setAutoConnect",
+ web_ui()->RegisterMessageCallback(kTagSetAutoConnect,
base::Bind(&InternetOptionsHandler::SetAutoConnectCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("setIPConfig",
+ web_ui()->RegisterMessageCallback(kTagSetIPConfig,
base::Bind(&InternetOptionsHandler::SetIPConfigCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("enableWifi",
+ web_ui()->RegisterMessageCallback(kTagEnableWifi,
base::Bind(&InternetOptionsHandler::EnableWifiCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("disableWifi",
+ web_ui()->RegisterMessageCallback(kTagDisableWifi,
base::Bind(&InternetOptionsHandler::DisableWifiCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("enableCellular",
+ web_ui()->RegisterMessageCallback(kTagEnableCellular,
base::Bind(&InternetOptionsHandler::EnableCellularCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("disableCellular",
+ web_ui()->RegisterMessageCallback(kTagDisableCellular,
base::Bind(&InternetOptionsHandler::DisableCellularCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("enableWimax",
+ web_ui()->RegisterMessageCallback(kTagEnableWimax,
base::Bind(&InternetOptionsHandler::EnableWimaxCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("disableWimax",
+ web_ui()->RegisterMessageCallback(kTagDisableWimax,
base::Bind(&InternetOptionsHandler::DisableWimaxCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("buyDataPlan",
+ web_ui()->RegisterMessageCallback(kTagBuyDataPlan,
base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("showMorePlanInfo",
+ web_ui()->RegisterMessageCallback(kTagShowMorePlanInfo,
base::Bind(&InternetOptionsHandler::ShowMorePlanInfoCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("setApn",
+ web_ui()->RegisterMessageCallback(kTagSetApn,
base::Bind(&InternetOptionsHandler::SetApnCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("setSimCardLock",
+ web_ui()->RegisterMessageCallback(kTagSetSimCardLock,
base::Bind(&InternetOptionsHandler::SetSimCardLockCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("changePin",
+ web_ui()->RegisterMessageCallback(kTagChangePin,
base::Bind(&InternetOptionsHandler::ChangePinCallback,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("toggleAirplaneMode",
+ web_ui()->RegisterMessageCallback(kTagToggleAirplaneMode,
base::Bind(&InternetOptionsHandler::ToggleAirplaneModeCallback,
base::Unretained(this)));
stevenjb 2012/08/14 17:50:01 Same with these tags - presumably they are used ju
}
@@ -653,7 +990,7 @@ void InternetOptionsHandler::RefreshNetworkData() {
DictionaryValue dictionary;
FillNetworkInfo(&dictionary);
web_ui()->CallJavascriptFunction(
- "options.network.NetworkList.refreshNetworkData", dictionary);
+ kRefreshNetworkDataFunction, dictionary);
}
void InternetOptionsHandler::OnNetworkManagerChanged(
@@ -722,16 +1059,16 @@ void InternetOptionsHandler::OnCellularDataPlanChanged(
plan_list->Append(CellularDataPlanToDictionary(*iter));
}
}
- connection_plans.SetString("servicePath", cellular->service_path());
- connection_plans.SetBoolean("needsPlan", cellular->needs_new_plan());
- connection_plans.SetBoolean("activated",
+ connection_plans.SetString(kTagServicePath, cellular->service_path());
+ connection_plans.SetBoolean(kTagNeedsPlan, cellular->needs_new_plan());
+ connection_plans.SetBoolean(kTagActivated,
cellular->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATED);
- connection_plans.Set("plans", plan_list);
+ connection_plans.Set(kTagPlans, plan_list);
SetActivationButtonVisibility(cellular,
&connection_plans,
cros_->GetCellularHomeCarrierId());
web_ui()->CallJavascriptFunction(
- "options.internet.DetailsInternetPage.updateCellularPlans",
+ kUpdateCellularPlansFunction,
connection_plans);
}
@@ -744,7 +1081,7 @@ void InternetOptionsHandler::Observe(
if (type == chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED) {
base::FundamentalValue require_pin(*content::Details<bool>(details).ptr());
web_ui()->CallJavascriptFunction(
- "options.internet.DetailsInternetPage.updateSecurityTab", require_pin);
+ kUpdateSecurityTabFunction, require_pin);
} else if (type == chrome::NOTIFICATION_ENTER_PIN_ENDED) {
// We make an assumption (which is valid for now) that the SIM
// unlock dialog is put up only when the user is trying to enable
@@ -760,12 +1097,12 @@ void InternetOptionsHandler::Observe(
DictionaryValue* InternetOptionsHandler::CellularDataPlanToDictionary(
const chromeos::CellularDataPlan* plan) {
DictionaryValue* plan_dict = new DictionaryValue();
- plan_dict->SetInteger("planType", plan->plan_type);
- plan_dict->SetString("name", plan->plan_name);
- plan_dict->SetString("planSummary", plan->GetPlanDesciption());
- plan_dict->SetString("dataRemaining", plan->GetDataRemainingDesciption());
- plan_dict->SetString("planExpires", plan->GetPlanExpiration());
- plan_dict->SetString("warning", plan->GetRemainingWarning());
+ plan_dict->SetInteger(kTagPlanType, plan->plan_type);
+ plan_dict->SetString(kTagName, plan->plan_name);
+ plan_dict->SetString(kTagPlanSummary, plan->GetPlanDesciption());
+ plan_dict->SetString(kTagDataRemaining, plan->GetDataRemainingDesciption());
+ plan_dict->SetString(kTagPlanExpires, plan->GetPlanExpiration());
+ plan_dict->SetString(kTagWarning, plan->GetRemainingWarning());
return plan_dict;
}
@@ -784,7 +1121,7 @@ void InternetOptionsHandler::SetPreferNetworkCallback(const ListValue* args) {
if (!network)
return;
- bool prefer_network = prefer_network_str == "true";
+ bool prefer_network = prefer_network_str == kTagTrue;
if (prefer_network != network->preferred())
network->SetPreferred(prefer_network);
}
@@ -804,44 +1141,77 @@ void InternetOptionsHandler::SetAutoConnectCallback(const ListValue* args) {
if (!network)
return;
- bool auto_connect = auto_connect_str == "true";
+ bool auto_connect = auto_connect_str == kTagTrue;
if (auto_connect != network->auto_connect())
network->SetAutoConnect(auto_connect);
}
void InternetOptionsHandler::SetIPConfigCallback(const ListValue* args) {
std::string service_path;
- std::string dhcp_str;
+ bool dhcp_for_ip;
std::string address;
std::string netmask;
std::string gateway;
+ std::string name_server_type;
std::string name_servers;
- if (args->GetSize() < 6 ||
+ if (args->GetSize() < 7 ||
!args->GetString(0, &service_path) ||
- !args->GetString(1, &dhcp_str) ||
+ !args->GetBoolean(1, &dhcp_for_ip) ||
!args->GetString(2, &address) ||
!args->GetString(3, &netmask) ||
!args->GetString(4, &gateway) ||
- !args->GetString(5, &name_servers)) {
+ !args->GetString(5, &name_server_type) ||
+ !args->GetString(6, &name_servers)) {
NOTREACHED();
return;
}
- chromeos::Network* network = cros_->FindNetworkByPath(service_path);
- if (!network)
- return;
+ int dhcp_usage_mask = 0;
+ if (dhcp_for_ip) {
+ dhcp_usage_mask = (chromeos::NetworkLibrary::USE_DHCP_ADDRESS |
+ chromeos::NetworkLibrary::USE_DHCP_NETMASK |
+ chromeos::NetworkLibrary::USE_DHCP_GATEWAY);
+ }
+ if (name_server_type == kNameServerTypeAutomatic) {
+ dhcp_usage_mask |= chromeos::NetworkLibrary::USE_DHCP_NAME_SERVERS;
+ name_servers.clear();
+ } else if (name_server_type == kNameServerTypeGoogle) {
+ name_servers = kGoogleNameServers;
+ }
- cros_->SetIPConfig(chromeos::NetworkIPConfig(network->device_path(),
- dhcp_str == "true" ? chromeos::IPCONFIG_TYPE_DHCP :
- chromeos::IPCONFIG_TYPE_IPV4,
- address, netmask, gateway, name_servers));
+ cros_->SetIPParameters(service_path,
+ address,
+ netmask,
+ gateway,
+ name_servers,
+ dhcp_usage_mask);
}
void InternetOptionsHandler::PopulateDictionaryDetails(
const chromeos::Network* network) {
DCHECK(network);
+ // Send off an asynchronous request to Shill to get the service properties
+ // and continue in the callback.
+ chromeos::CrosRequestNetworkServiceProperties(
+ network->service_path(),
+ base::Bind(&InternetOptionsHandler::PopulateDictionaryDetailsCallback,
+ weak_factory_.GetWeakPtr(), network));
+}
+
+void InternetOptionsHandler::PopulateDictionaryDetailsCallback(
+ const chromeos::Network* network,
+ const std::string& service_path,
+ const base::DictionaryValue* shill_properties) {
+ if (VLOG_IS_ON(2)) {
+ std::string properties_json;
+ base::JSONWriter::WriteWithOptions(shill_properties,
+ base::JSONWriter::OPTIONS_PRETTY_PRINT,
+ &properties_json);
+ VLOG(2) << "Shill Properties: " << std::endl << properties_json;
+ }
+
if (web_ui()) {
Profile::FromWebUI(web_ui())->GetProxyConfigTracker()->UISetCurrentNetwork(
network->service_path());
@@ -851,65 +1221,98 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
const base::DictionaryValue* onc =
cros_->FindOncForNetwork(network->unique_id());
- DictionaryValue dictionary;
+ base::DictionaryValue dictionary;
std::string hardware_address;
chromeos::NetworkIPConfigVector ipconfigs = cros_->GetIPConfigs(
network->device_path(), &hardware_address,
chromeos::NetworkLibrary::FORMAT_COLON_SEPARATED_HEX);
if (!hardware_address.empty())
- dictionary.SetString("hardwareAddress", hardware_address);
+ dictionary.SetString(kTagHardwareAddress, hardware_address);
- scoped_ptr<DictionaryValue> ipconfig_dhcp;
- scoped_ptr<DictionaryValue> ipconfig_static;
+ // The DHCP IPConfig contains the values that are actually in use at the
+ // moment, even if some are overridden by static IP values.
+ scoped_ptr<DictionaryValue> ipconfig_dhcp(new DictionaryValue);
+ std::string ipconfig_name_servers;
for (chromeos::NetworkIPConfigVector::const_iterator it = ipconfigs.begin();
it != ipconfigs.end(); ++it) {
const chromeos::NetworkIPConfig& ipconfig = *it;
- scoped_ptr<DictionaryValue> ipconfig_dict(new DictionaryValue());
- ipconfig_dict->SetString("address", ipconfig.address);
- ipconfig_dict->SetString("subnetAddress", ipconfig.netmask);
- ipconfig_dict->SetString("gateway", ipconfig.gateway);
- ipconfig_dict->SetString("dns", ipconfig.name_servers);
- if (ipconfig.type == chromeos::IPCONFIG_TYPE_DHCP)
- ipconfig_dhcp.reset(ipconfig_dict.release());
- else if (ipconfig.type == chromeos::IPCONFIG_TYPE_IPV4)
- ipconfig_static.reset(ipconfig_dict.release());
+ if (ipconfig.type == chromeos::IPCONFIG_TYPE_DHCP) {
+ ipconfig_dhcp->SetString(kIpConfigAddress, ipconfig.address);
+ VLOG(2) << "Found DHCP Address: " << ipconfig.address;
+ ipconfig_dhcp->SetString(kIpConfigNetmask, ipconfig.netmask);
+ VLOG(2) << "Found DHCP Netmask: " << ipconfig.netmask;
+ ipconfig_dhcp->SetString(kIpConfigGateway, ipconfig.gateway);
+ VLOG(2) << "Found DHCP Gateway: " << ipconfig.gateway;
+ ipconfig_dhcp->SetString(kIpConfigNameServers, ipconfig.name_servers);
+ ipconfig_name_servers = ipconfig.name_servers; // save for later
+ VLOG(2) << "Found DHCP Name Servers: " << ipconfig.name_servers;
+ break;
+ }
}
chromeos::NetworkPropertyUIData ipconfig_dhcp_ui_data(ui_data);
- SetValueDictionary(&dictionary, "ipconfigDHCP", ipconfig_dhcp.release(),
+
+ chromeos::NetworkPropertyUIData static_ip_ui_data(ui_data);
+ int automatic_ip_config;
+ scoped_ptr<DictionaryValue> static_ip_dict(
+ BuildIPInfoDictionary(*shill_properties, true, &automatic_ip_config));
+ dictionary.SetBoolean(kIpConfigAutoConfig, automatic_ip_config == 0);
+ DCHECK(automatic_ip_config == 3 || automatic_ip_config == 0)
+ << "UI doesn't support automatic specification of individual "
+ << "static ip parameters.";
+ scoped_ptr<DictionaryValue> saved_ip_dict(
+ BuildIPInfoDictionary(*shill_properties, false, NULL));
+ dictionary.Set(kDictionarySavedIp, saved_ip_dict.release());
+
+ // Determine what kind of name server setting we have by comparing the
+ // StaticIP and Google values with the ipconfig values.
+ std::string name_server_type = kNameServerTypeAutomatic;
+ std::string static_ip_nameservers;
+ static_ip_dict->GetString(kIpConfigNameServers, &static_ip_nameservers);
+ if (!static_ip_nameservers.empty() &&
+ static_ip_nameservers == ipconfig_name_servers) {
+ name_server_type = kNameServerTypeUser;
+ }
+ if (ipconfig_name_servers == kGoogleNameServers) {
+ name_server_type = kNameServerTypeGoogle;
+ }
+
+ SetValueDictionary(&dictionary, kDictionaryIpConfig, ipconfig_dhcp.release(),
ipconfig_dhcp_ui_data);
- chromeos::NetworkPropertyUIData ipconfig_static_ui_data(ui_data);
- SetValueDictionary(&dictionary, "ipconfigStatic", ipconfig_static.release(),
- ipconfig_static_ui_data);
+ SetValueDictionary(&dictionary, kDictionaryStaticIp, static_ip_dict.release(),
+ static_ip_ui_data);
chromeos::ConnectionType type = network->type();
- dictionary.SetInteger("type", type);
- dictionary.SetString("servicePath", network->service_path());
- dictionary.SetBoolean("connecting", network->connecting());
- dictionary.SetBoolean("connected", network->connected());
- dictionary.SetString("connectionState", network->GetStateString());
- dictionary.SetString("networkName", network->name());
+ dictionary.SetInteger(kTagType, type);
+ dictionary.SetString(kTagServicePath, network->service_path());
+ dictionary.SetBoolean(kTagConnecting, network->connecting());
+ dictionary.SetBoolean(kTagConnected, network->connected());
+ dictionary.SetString(kTagConnectionState, network->GetStateString());
+ dictionary.SetString(kTagNetworkName, network->name());
+ dictionary.SetString(kTagNameServerType, name_server_type);
+ dictionary.SetString(kTagNameServersGoogle, kGoogleNameServers);
// Only show proxy for remembered networks.
chromeos::NetworkProfileType network_profile = network->profile_type();
- dictionary.SetBoolean("showProxy", network_profile != chromeos::PROFILE_NONE);
+ dictionary.SetBoolean(kTagShowProxy,
+ network_profile != chromeos::PROFILE_NONE);
// Enable static ip config for ethernet. For wifi, enable if flag is set.
bool staticIPConfig = type == chromeos::TYPE_ETHERNET ||
(type == chromeos::TYPE_WIFI &&
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableStaticIPConfig));
- dictionary.SetBoolean("showStaticIPConfig", staticIPConfig);
+ dictionary.SetBoolean(kTagShowStaticIPConfig, staticIPConfig);
chromeos::NetworkPropertyUIData preferred_ui_data(ui_data);
if (network_profile == chromeos::PROFILE_USER) {
- dictionary.SetBoolean("showPreferred", true);
- SetValueDictionary(&dictionary, "preferred",
+ dictionary.SetBoolean(kTagShowPreferred, true);
+ SetValueDictionary(&dictionary, kTagPreferred,
Value::CreateBooleanValue(network->preferred()),
preferred_ui_data);
} else {
- dictionary.SetBoolean("showPreferred", false);
- SetValueDictionary(&dictionary, "preferred",
+ dictionary.SetBoolean(kTagShowPreferred, false);
+ SetValueDictionary(&dictionary, kTagPreferred,
Value::CreateBooleanValue(network->preferred()),
preferred_ui_data);
}
@@ -921,12 +1324,12 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
chromeos::onc::kWiFi,
chromeos::onc::wifi::kAutoConnect));
}
- SetValueDictionary(&dictionary, "autoConnect",
+ SetValueDictionary(&dictionary, kTagAutoConnect,
Value::CreateBooleanValue(network->auto_connect()),
auto_connect_ui_data);
if (type == chromeos::TYPE_WIFI) {
- dictionary.SetBoolean("deviceConnected", cros_->wifi_connected());
+ dictionary.SetBoolean(kTagDeviceConnected, cros_->wifi_connected());
const chromeos::WifiNetwork* wifi =
cros_->FindWifiNetworkByPath(network->service_path());
if (!wifi) {
@@ -935,7 +1338,7 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
PopulateWifiDetails(wifi, &dictionary);
}
} else if (type == chromeos::TYPE_WIMAX) {
- dictionary.SetBoolean("deviceConnected", cros_->wimax_connected());
+ dictionary.SetBoolean(kTagDeviceConnected, cros_->wimax_connected());
const chromeos::WimaxNetwork* wimax =
cros_->FindWimaxNetworkByPath(network->service_path());
if (!wimax) {
@@ -944,7 +1347,7 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
PopulateWimaxDetails(wimax, &dictionary);
}
} else if (type == chromeos::TYPE_CELLULAR) {
- dictionary.SetBoolean("deviceConnected", cros_->cellular_connected());
+ dictionary.SetBoolean(kTagDeviceConnected, cros_->cellular_connected());
const chromeos::CellularNetwork* cellular =
cros_->FindCellularNetworkByPath(network->service_path());
if (!cellular) {
@@ -953,7 +1356,7 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
PopulateCellularDetails(cellular, &dictionary);
}
} else if (type == chromeos::TYPE_VPN) {
- dictionary.SetBoolean("deviceConnected",
+ dictionary.SetBoolean(kTagDeviceConnected,
cros_->virtual_network_connected());
const chromeos::VirtualNetwork* vpn =
cros_->FindVirtualNetworkByPath(network->service_path());
@@ -963,50 +1366,50 @@ void InternetOptionsHandler::PopulateDictionaryDetails(
PopulateVPNDetails(vpn, &dictionary);
}
} else if (type == chromeos::TYPE_ETHERNET) {
- dictionary.SetBoolean("deviceConnected", cros_->ethernet_connected());
+ dictionary.SetBoolean(kTagDeviceConnected, cros_->ethernet_connected());
}
web_ui()->CallJavascriptFunction(
- "options.internet.DetailsInternetPage.showDetailedInfo", dictionary);
+ kShowDetailedInfoFunction, dictionary);
}
void InternetOptionsHandler::PopulateWifiDetails(
const chromeos::WifiNetwork* wifi,
DictionaryValue* dictionary) {
- dictionary->SetString("ssid", wifi->name());
+ dictionary->SetString(kTagSsid, wifi->name());
bool remembered = (wifi->profile_type() != chromeos::PROFILE_NONE);
- dictionary->SetBoolean("remembered", remembered);
+ dictionary->SetBoolean(kTagRemembered, remembered);
bool shared = wifi->profile_type() == chromeos::PROFILE_SHARED;
- dictionary->SetBoolean("shared", shared);
- dictionary->SetString("encryption", wifi->GetEncryptionString());
- dictionary->SetString("bssid", wifi->bssid());
- dictionary->SetInteger("frequency", wifi->frequency());
- dictionary->SetInteger("strength", wifi->strength());
+ dictionary->SetBoolean(kTagShared, shared);
+ dictionary->SetString(kTagEncryption, wifi->GetEncryptionString());
+ dictionary->SetString(kTagBssid, wifi->bssid());
+ dictionary->SetInteger(kTagFrequency, wifi->frequency());
+ dictionary->SetInteger(kTagStrength, wifi->strength());
}
void InternetOptionsHandler::PopulateWimaxDetails(
const chromeos::WimaxNetwork* wimax,
DictionaryValue* dictionary) {
bool remembered = (wimax->profile_type() != chromeos::PROFILE_NONE);
- dictionary->SetBoolean("remembered", remembered);
+ dictionary->SetBoolean(kTagRemembered, remembered);
bool shared = wimax->profile_type() == chromeos::PROFILE_SHARED;
- dictionary->SetBoolean("shared", shared);
+ dictionary->SetBoolean(kTagShared, shared);
if (wimax->passphrase_required())
- dictionary->SetString("identity", wimax->eap_identity());
+ dictionary->SetString(kTagIdentity, wimax->eap_identity());
- dictionary->SetInteger("strength", wimax->strength());
+ dictionary->SetInteger(kTagStrength, wimax->strength());
}
DictionaryValue* InternetOptionsHandler::CreateDictionaryFromCellularApn(
const chromeos::CellularApn& apn) {
DictionaryValue* dictionary = new DictionaryValue();
- dictionary->SetString("apn", apn.apn);
- dictionary->SetString("networkId", apn.network_id);
- dictionary->SetString("username", apn.username);
- dictionary->SetString("password", apn.password);
- dictionary->SetString("name", apn.name);
- dictionary->SetString("localizedName", apn.localized_name);
- dictionary->SetString("language", apn.language);
+ dictionary->SetString(kTagApn, apn.apn);
+ dictionary->SetString(kTagNetworkId, apn.network_id);
+ dictionary->SetString(kTagUsername, apn.username);
+ dictionary->SetString(kTagPassword, apn.password);
+ dictionary->SetString(kTagName, apn.name);
+ dictionary->SetString(kTagLocalizedName, apn.localized_name);
+ dictionary->SetString(kTagLanguage, apn.language);
return dictionary;
}
@@ -1014,27 +1417,27 @@ void InternetOptionsHandler::PopulateCellularDetails(
const chromeos::CellularNetwork* cellular,
DictionaryValue* dictionary) {
// Cellular network / connection settings.
- dictionary->SetString("serviceName", cellular->name());
- dictionary->SetString("networkTechnology",
+ dictionary->SetString(kTagServiceName, cellular->name());
+ dictionary->SetString(kTagNetworkTechnology,
cellular->GetNetworkTechnologyString());
- dictionary->SetString("operatorName", cellular->operator_name());
- dictionary->SetString("operatorCode", cellular->operator_code());
- dictionary->SetString("activationState",
+ dictionary->SetString(kTagOperatorName, cellular->operator_name());
+ dictionary->SetString(kTagOperatorCode, cellular->operator_code());
+ dictionary->SetString(kTagActivationState,
cellular->GetActivationStateString());
- dictionary->SetString("roamingState",
+ dictionary->SetString(kTagRoamingState,
cellular->GetRoamingStateString());
- dictionary->SetString("restrictedPool",
+ dictionary->SetString(kTagRestrictedPool,
cellular->restricted_pool() ?
l10n_util::GetStringUTF8(
IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL) :
l10n_util::GetStringUTF8(
IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL));
- dictionary->SetString("errorState", cellular->GetErrorString());
- dictionary->SetString("supportUrl", cellular->payment_url());
- dictionary->SetBoolean("needsPlan", cellular->needs_new_plan());
+ dictionary->SetString(kTagErrorState, cellular->GetErrorString());
+ dictionary->SetString(kTagSupportUrl, cellular->payment_url());
+ dictionary->SetBoolean(kTagNeedsPlan, cellular->needs_new_plan());
- dictionary->Set("apn", CreateDictionaryFromCellularApn(cellular->apn()));
- dictionary->Set("lastGoodApn",
+ dictionary->Set(kTagApn, CreateDictionaryFromCellularApn(cellular->apn()));
+ dictionary->Set(kTagLastGoodApn,
CreateDictionaryFromCellularApn(cellular->last_good_apn()));
// Device settings.
@@ -1043,22 +1446,22 @@ void InternetOptionsHandler::PopulateCellularDetails(
if (device) {
chromeos::NetworkPropertyUIData cellular_propety_ui_data(
cellular->ui_data());
- dictionary->SetString("manufacturer", device->manufacturer());
- dictionary->SetString("modelId", device->model_id());
- dictionary->SetString("firmwareRevision", device->firmware_revision());
- dictionary->SetString("hardwareRevision", device->hardware_revision());
- dictionary->SetString("prlVersion",
+ dictionary->SetString(kTagManufacturer, device->manufacturer());
+ dictionary->SetString(kTagModelId, device->model_id());
+ dictionary->SetString(kTagFirmwareRevision, device->firmware_revision());
+ dictionary->SetString(kTagHardwareRevision, device->hardware_revision());
+ dictionary->SetString(kTagPrlVersion,
base::StringPrintf("%u", device->prl_version()));
- dictionary->SetString("meid", device->meid());
- dictionary->SetString("imei", device->imei());
- dictionary->SetString("mdn", device->mdn());
- dictionary->SetString("imsi", device->imsi());
- dictionary->SetString("esn", device->esn());
- dictionary->SetString("min", device->min());
- dictionary->SetBoolean("gsm",
+ dictionary->SetString(kTagMeid, device->meid());
+ dictionary->SetString(kTagImei, device->imei());
+ dictionary->SetString(kTagMdn, device->mdn());
+ dictionary->SetString(kTagImsi, device->imsi());
+ dictionary->SetString(kTagEsn, device->esn());
+ dictionary->SetString(kTagMin, device->min());
+ dictionary->SetBoolean(kTagGsm,
device->technology_family() == chromeos::TECHNOLOGY_FAMILY_GSM);
SetValueDictionary(
- dictionary, "simCardLockEnabled",
+ dictionary, kTagSimCardLockEnabled,
Value::CreateBooleanValue(
device->sim_pin_required() == chromeos::SIM_PIN_REQUIRED),
cellular_propety_ui_data);
@@ -1069,7 +1472,7 @@ void InternetOptionsHandler::PopulateCellularDetails(
const chromeos::MobileConfig::Carrier* carrier =
config->GetCarrier(carrier_id);
if (carrier && !carrier->top_up_url().empty())
- dictionary->SetString("carrierUrl", carrier->top_up_url());
+ dictionary->SetString(kTagCarrierUrl, carrier->top_up_url());
}
const chromeos::CellularApnList& apn_list = device->provider_apn_list();
@@ -1078,7 +1481,7 @@ void InternetOptionsHandler::PopulateCellularDetails(
it != apn_list.end(); ++it) {
apn_list_value->Append(CreateDictionaryFromCellularApn(*it));
}
- SetValueDictionary(dictionary, "providerApnList", apn_list_value,
+ SetValueDictionary(dictionary, kTagProviderApnList, apn_list_value,
cellular_propety_ui_data);
}
@@ -1090,12 +1493,12 @@ void InternetOptionsHandler::PopulateCellularDetails(
void InternetOptionsHandler::PopulateVPNDetails(
const chromeos::VirtualNetwork* vpn,
DictionaryValue* dictionary) {
- dictionary->SetString("service_name", vpn->name());
+ dictionary->SetString(kTagService_name, vpn->name());
bool remembered = (vpn->profile_type() != chromeos::PROFILE_NONE);
- dictionary->SetBoolean("remembered", remembered);
- dictionary->SetString("server_hostname", vpn->server_hostname());
- dictionary->SetString("provider_type", vpn->GetProviderTypeString());
- dictionary->SetString("username", vpn->username());
+ dictionary->SetBoolean(kTagRemembered, remembered);
+ dictionary->SetString(kTagServer_hostname, vpn->server_hostname());
+ dictionary->SetString(kTagProvider_type, vpn->GetProviderTypeString());
+ dictionary->SetString(kTagUsername, vpn->username());
}
void InternetOptionsHandler::SetActivationButtonVisibility(
@@ -1103,19 +1506,19 @@ void InternetOptionsHandler::SetActivationButtonVisibility(
DictionaryValue* dictionary,
const std::string& carrier_id) {
if (cellular->needs_new_plan()) {
- dictionary->SetBoolean("showBuyButton", true);
+ dictionary->SetBoolean(kTagShowBuyButton, true);
} else if (cellular->activation_state() !=
chromeos::ACTIVATION_STATE_ACTIVATING &&
cellular->activation_state() !=
chromeos::ACTIVATION_STATE_ACTIVATED) {
- dictionary->SetBoolean("showActivateButton", true);
+ dictionary->SetBoolean(kTagShowActivateButton, true);
} else {
const chromeos::MobileConfig::Carrier* carrier =
chromeos::MobileConfig::GetInstance()->GetCarrier(carrier_id);
if (carrier && carrier->show_portal_button()) {
// This will trigger BuyDataPlanCallback() so that
// chrome://mobilesetup/ will open carrier specific portal.
- dictionary->SetBoolean("showViewAccountButton", true);
+ dictionary->SetBoolean(kTagShowViewAccountButton, true);
}
}
}
@@ -1173,23 +1576,23 @@ void InternetOptionsHandler::HandleWifiButtonClick(
const std::string& service_path,
const std::string& command) {
chromeos::WifiNetwork* wifi = NULL;
- if (command == "forget") {
+ if (command == kTagForget) {
cros_->ForgetNetwork(service_path);
} else if (service_path == kOtherNetworksFakePath) {
// Other wifi networks.
chromeos::NetworkConfigView::ShowForType(
chromeos::TYPE_WIFI, GetNativeWindow());
} else if ((wifi = cros_->FindWifiNetworkByPath(service_path))) {
- if (command == "connect") {
+ if (command == kTagConnect) {
wifi->SetEnrollmentDelegate(
chromeos::CreateEnrollmentDelegate(GetNativeWindow(), wifi->name(),
ProfileManager::GetLastUsedProfile()));
wifi->AttemptConnection(base::Bind(&InternetOptionsHandler::DoConnect,
weak_factory_.GetWeakPtr(),
wifi));
- } else if (command == "disconnect") {
+ } else if (command == kTagDisconnect) {
cros_->DisconnectFromNetwork(wifi);
- } else if (command == "options") {
+ } else if (command == kTagOptions) {
PopulateDictionaryDetails(wifi);
}
}
@@ -1199,19 +1602,19 @@ void InternetOptionsHandler::HandleWimaxButtonClick(
const std::string& service_path,
const std::string& command) {
chromeos::WimaxNetwork* wimax = NULL;
- if (command == "forget") {
+ if (command == kTagForget) {
cros_->ForgetNetwork(service_path);
} else if ((wimax = cros_->FindWimaxNetworkByPath(service_path))) {
- if (command == "connect") {
+ if (command == kTagConnect) {
wimax->SetEnrollmentDelegate(
chromeos::CreateEnrollmentDelegate(GetNativeWindow(), wimax->name(),
ProfileManager::GetLastUsedProfile()));
wimax->AttemptConnection(base::Bind(&InternetOptionsHandler::DoConnect,
weak_factory_.GetWeakPtr(),
wimax));
- } else if (command == "disconnect") {
+ } else if (command == kTagDisconnect) {
cros_->DisconnectFromNetwork(wimax);
- } else if (command == "options") {
+ } else if (command == kTagOptions) {
PopulateDictionaryDetails(wimax);
}
}
@@ -1224,13 +1627,13 @@ void InternetOptionsHandler::HandleCellularButtonClick(
if (service_path == kOtherNetworksFakePath) {
chromeos::ChooseMobileNetworkDialog::ShowDialog(GetNativeWindow());
} else if ((cellular = cros_->FindCellularNetworkByPath(service_path))) {
- if (command == "connect") {
+ if (command == kTagConnect) {
cros_->ConnectToCellularNetwork(cellular);
- } else if (command == "disconnect") {
+ } else if (command == kTagDisconnect) {
cros_->DisconnectFromNetwork(cellular);
- } else if (command == "activate") {
+ } else if (command == kTagActivate) {
ash::Shell::GetInstance()->delegate()->OpenMobileSetup(service_path);
- } else if (command == "options") {
+ } else if (command == kTagOptions) {
PopulateDictionaryDetails(cellular);
}
}
@@ -1240,7 +1643,7 @@ void InternetOptionsHandler::HandleVPNButtonClick(
const std::string& service_path,
const std::string& command) {
chromeos::VirtualNetwork* network = NULL;
- if (command == "forget") {
+ if (command == kTagForget) {
cros_->ForgetNetwork(service_path);
} else if (service_path == kOtherNetworksFakePath) {
// TODO(altimofeev): verify if service_path in condition is correct.
@@ -1248,7 +1651,7 @@ void InternetOptionsHandler::HandleVPNButtonClick(
chromeos::NetworkConfigView::ShowForType(
chromeos::TYPE_VPN, GetNativeWindow());
} else if ((network = cros_->FindVirtualNetworkByPath(service_path))) {
- if (command == "connect") {
+ if (command == kTagConnect) {
network->SetEnrollmentDelegate(
chromeos::CreateEnrollmentDelegate(
GetNativeWindow(),
@@ -1257,9 +1660,9 @@ void InternetOptionsHandler::HandleVPNButtonClick(
network->AttemptConnection(base::Bind(&InternetOptionsHandler::DoConnect,
weak_factory_.GetWeakPtr(),
network));
- } else if (command == "disconnect") {
+ } else if (command == kTagDisconnect) {
cros_->DisconnectFromNetwork(network);
- } else if (command == "options") {
+ } else if (command == kTagOptions) {
PopulateDictionaryDetails(network);
}
}
@@ -1432,23 +1835,23 @@ ListValue* InternetOptionsHandler::GetRememberedList() {
}
void InternetOptionsHandler::FillNetworkInfo(DictionaryValue* dictionary) {
- dictionary->SetBoolean("accessLocked", cros_->IsLocked());
- dictionary->Set("wiredList", GetWiredList());
- dictionary->Set("wirelessList", GetWirelessList());
- dictionary->Set("vpnList", GetVPNList());
- dictionary->Set("rememberedList", GetRememberedList());
- dictionary->SetBoolean("wifiAvailable", cros_->wifi_available());
- dictionary->SetBoolean("wifiBusy", cros_->wifi_busy());
- dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled());
- dictionary->SetBoolean("cellularAvailable", cros_->cellular_available());
- dictionary->SetBoolean("cellularBusy", cros_->cellular_busy());
- dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled());
- dictionary->SetBoolean("wimaxEnabled", cros_->wimax_enabled());
- dictionary->SetBoolean("wimaxAvailable", cros_->wimax_available());
- dictionary->SetBoolean("wimaxBusy", cros_->wimax_busy());
+ dictionary->SetBoolean(kTagAccessLocked, cros_->IsLocked());
+ dictionary->Set(kTagWiredList, GetWiredList());
+ dictionary->Set(kTagWirelessList, GetWirelessList());
+ dictionary->Set(kTagVpnList, GetVPNList());
+ dictionary->Set(kTagRememberedList, GetRememberedList());
+ dictionary->SetBoolean(kTagWifiAvailable, cros_->wifi_available());
+ dictionary->SetBoolean(kTagWifiBusy, cros_->wifi_busy());
+ dictionary->SetBoolean(kTagWifiEnabled, cros_->wifi_enabled());
+ dictionary->SetBoolean(kTagCellularAvailable, cros_->cellular_available());
+ dictionary->SetBoolean(kTagCellularBusy, cros_->cellular_busy());
+ dictionary->SetBoolean(kTagCellularEnabled, cros_->cellular_enabled());
+ dictionary->SetBoolean(kTagWimaxEnabled, cros_->wimax_enabled());
+ dictionary->SetBoolean(kTagWimaxAvailable, cros_->wimax_available());
+ dictionary->SetBoolean(kTagWimaxBusy, cros_->wimax_busy());
// TODO(kevers): The use of 'offline_mode' is not quite correct. Update once
// we have proper back-end support.
- dictionary->SetBoolean("airplaneMode", cros_->offline_mode());
+ dictionary->SetBoolean(kTagAirplaneMode, cros_->offline_mode());
}
void InternetOptionsHandler::SetValueDictionary(
@@ -1459,14 +1862,14 @@ void InternetOptionsHandler::SetValueDictionary(
DictionaryValue* value_dict = new DictionaryValue();
// DictionaryValue::Set() takes ownership of |value|.
if (value)
- value_dict->Set("value", value);
+ value_dict->Set(kTagValue, value);
const base::Value* default_value = ui_data.default_value();
if (default_value)
- value_dict->Set("default", default_value->DeepCopy());
+ value_dict->Set(kTagDefault, default_value->DeepCopy());
if (ui_data.managed())
- value_dict->SetString("controlledBy", "policy");
+ value_dict->SetString(kTagControlledBy, kTagPolicy);
else if (ui_data.recommended())
- value_dict->SetString("controlledBy", "recommended");
+ value_dict->SetString(kTagControlledBy, kTagRecommended);
settings->Set(key, value_dict);
}
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/internet_options_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698