summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos
diff options
context:
space:
mode:
authordhg@chromium.org <dhg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-06 16:46:02 +0000
committerdhg@chromium.org <dhg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-06 16:46:02 +0000
commitab9fb2953e2744a74a5ce3b8e1c830a3bd692543 (patch)
treeccaca3f851dc8632c13b99d41991a6952a55123e /chrome/browser/chromeos
parentf46845a7751433e0e3a390b85f50a35c4230e22b (diff)
downloadchromium_src-ab9fb2953e2744a74a5ce3b8e1c830a3bd692543.zip
chromium_src-ab9fb2953e2744a74a5ce3b8e1c830a3bd692543.tar.gz
chromium_src-ab9fb2953e2744a74a5ce3b8e1c830a3bd692543.tar.bz2
Adding wifi enable/disable buttons
BUG=chromium-os:6590 TEST=none Review URL: http://codereview.chromium.org/3556012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r--chrome/browser/chromeos/dom_ui/internet_options_handler.cc62
-rw-r--r--chrome/browser/chromeos/dom_ui/internet_options_handler.h4
2 files changed, 66 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/dom_ui/internet_options_handler.cc b/chrome/browser/chromeos/dom_ui/internet_options_handler.cc
index daabe8c..608d3f6 100644
--- a/chrome/browser/chromeos/dom_ui/internet_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/internet_options_handler.cc
@@ -123,12 +123,39 @@ void InternetOptionsHandler::GetLocalizedValues(
localized_strings->SetString("inetConnect",
l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CONNECT_TITLE));
+
+ localized_strings->SetString("enableWifi",
+ l10n_util::GetStringFUTF16(
+ IDS_STATUSBAR_NETWORK_DEVICE_ENABLE,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI)));
+ localized_strings->SetString("disableWifi",
+ l10n_util::GetStringFUTF16(
+ IDS_STATUSBAR_NETWORK_DEVICE_DISABLE,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI)));
+ localized_strings->SetString("enableCellular",
+ l10n_util::GetStringFUTF16(
+ IDS_STATUSBAR_NETWORK_DEVICE_ENABLE,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR)));
+ localized_strings->SetString("disableCellular",
+ l10n_util::GetStringFUTF16(
+ IDS_STATUSBAR_NETWORK_DEVICE_DISABLE,
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR)));
+ localized_strings->SetString("generalNetworkingTitle",
+ l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_CONTROL_TITLE));
+
localized_strings->SetString("detailsInternetDismiss",
l10n_util::GetStringUTF16(IDS_CANCEL));
localized_strings->Set("wiredList", GetWiredList());
localized_strings->Set("wirelessList", GetWirelessList());
localized_strings->Set("rememberedList", GetRememberedList());
+
+ chromeos::NetworkLibrary* cros =
+ chromeos::CrosLibrary::Get()->GetNetworkLibrary();
+ localized_strings->SetBoolean("cellularAvailable",
+ cros->cellular_available());
+ localized_strings->SetBoolean("cellularEnabled", cros->cellular_enabled());
}
void InternetOptionsHandler::RegisterMessages() {
@@ -144,7 +171,38 @@ void InternetOptionsHandler::RegisterMessages() {
NewCallback(this, &InternetOptionsHandler::SetDetailsCallback));
dom_ui_->RegisterMessageCallback("loginToOtherNetwork",
NewCallback(this, &InternetOptionsHandler::LoginToOtherCallback));
+ dom_ui_->RegisterMessageCallback("enableWifi",
+ NewCallback(this, &InternetOptionsHandler::EnableWifiCallback));
+ dom_ui_->RegisterMessageCallback("disableWifi",
+ NewCallback(this, &InternetOptionsHandler::DisableWifiCallback));
+ dom_ui_->RegisterMessageCallback("enableCellular",
+ NewCallback(this, &InternetOptionsHandler::EnableCellularCallback));
+ dom_ui_->RegisterMessageCallback("disablCellular",
+ NewCallback(this, &InternetOptionsHandler::DisableCellularCallback));
+}
+
+void InternetOptionsHandler::EnableWifiCallback(const ListValue* args) {
+ chromeos::NetworkLibrary* cros =
+ chromeos::CrosLibrary::Get()->GetNetworkLibrary();
+ cros->EnableWifiNetworkDevice(true);
+}
+void InternetOptionsHandler::DisableWifiCallback(const ListValue* args) {
+ chromeos::NetworkLibrary* cros =
+ chromeos::CrosLibrary::Get()->GetNetworkLibrary();
+ cros->EnableWifiNetworkDevice(false);
+}
+
+void InternetOptionsHandler::EnableCellularCallback(const ListValue* args) {
+ chromeos::NetworkLibrary* cros =
+ chromeos::CrosLibrary::Get()->GetNetworkLibrary();
+ cros->EnableCellularNetworkDevice(true);
+}
+
+void InternetOptionsHandler::DisableCellularCallback(const ListValue* args) {
+ chromeos::NetworkLibrary* cros =
+ chromeos::CrosLibrary::Get()->GetNetworkLibrary();
+ cros->EnableCellularNetworkDevice(false);
}
void InternetOptionsHandler::NetworkChanged(chromeos::NetworkLibrary* cros) {
@@ -153,6 +211,10 @@ void InternetOptionsHandler::NetworkChanged(chromeos::NetworkLibrary* cros) {
dictionary.Set("wiredList", GetWiredList());
dictionary.Set("wirelessList", GetWirelessList());
dictionary.Set("rememberedList", GetRememberedList());
+ chromeos::NetworkLibrary* cros =
+ chromeos::CrosLibrary::Get()->GetNetworkLibrary();
+ dictionary.SetBoolean("cellularAvailable", cros->cellular_available());
+ dictionary.SetBoolean("cellularEnabled", cros->cellular_enabled());
dom_ui_->CallJavascriptFunction(
L"options.InternetOptions.refreshNetworkData", dictionary);
}
diff --git a/chrome/browser/chromeos/dom_ui/internet_options_handler.h b/chrome/browser/chromeos/dom_ui/internet_options_handler.h
index 5d4aa80..45f107b 100644
--- a/chrome/browser/chromeos/dom_ui/internet_options_handler.h
+++ b/chrome/browser/chromeos/dom_ui/internet_options_handler.h
@@ -41,6 +41,10 @@ class InternetOptionsHandler : public OptionsPageUIHandler,
void LoginCertCallback(const ListValue* args);
void LoginToOtherCallback(const ListValue* args);
void SetDetailsCallback(const ListValue* args);
+ void EnableWifiCallback(const ListValue* args);
+ void DisableWifiCallback(const ListValue* args);
+ void EnableCellularCallback(const ListValue* args);
+ void DisableCellularCallback(const ListValue* args);
bool is_certificate_in_pkcs11(const std::string& path);