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

Unified Diff: chrome/browser/chromeos/dom_ui/internet_options_handler.cc

Issue 6516019: Made activate/buy button show consistently on network list and details pages.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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
Index: chrome/browser/chromeos/dom_ui/internet_options_handler.cc
===================================================================
--- chrome/browser/chromeos/dom_ui/internet_options_handler.cc (revision 74823)
+++ chrome/browser/chromeos/dom_ui/internet_options_handler.cc (working copy)
@@ -432,6 +432,7 @@
connection_plans.SetBoolean("activated",
cellular->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATED);
connection_plans.Set("plans", plan_list);
+ SetActivationButtonVisibility(cellular, &connection_plans);
dom_ui_->CallJavascriptFunction(
L"options.InternetOptions.updateCellularPlans", connection_plans);
}
@@ -556,7 +557,7 @@
if (!wifi) {
LOG(WARNING) << "Cannot find network " << net->service_path();
} else {
- PopulateWifiDetails(&dictionary, wifi);
+ PopulateWifiDetails(wifi, &dictionary);
}
} else if (type == chromeos::TYPE_CELLULAR) {
chromeos::CellularNetwork* cellular =
@@ -564,7 +565,7 @@
if (!cellular) {
LOG(WARNING) << "Cannot find network " << net->service_path();
} else {
- PopulateCellularDetails(&dictionary, cellular);
+ PopulateCellularDetails(cellular, &dictionary);
}
}
@@ -573,8 +574,8 @@
}
void InternetOptionsHandler::PopulateWifiDetails(
- DictionaryValue* dictionary,
- const chromeos::WifiNetwork* wifi) {
+ const chromeos::WifiNetwork* wifi,
+ DictionaryValue* dictionary) {
dictionary->SetString("ssid", wifi->name());
dictionary->SetBoolean("autoConnect", wifi->auto_connect());
if (wifi->encrypted()) {
@@ -600,8 +601,8 @@
}
void InternetOptionsHandler::PopulateCellularDetails(
- DictionaryValue* dictionary,
- const chromeos::CellularNetwork* cellular) {
+ const chromeos::CellularNetwork* cellular,
+ DictionaryValue* dictionary) {
// Cellular network / connection settings.
dictionary->SetString("serviceName", cellular->service_name());
dictionary->SetString("networkTechnology",
@@ -620,6 +621,7 @@
IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL));
dictionary->SetString("errorState", cellular->GetErrorString());
dictionary->SetString("supportUrl", cellular->payment_url());
+ dictionary->SetBoolean("needsPlan", cellular->needs_new_plan());
// Device settings.
dictionary->SetString("manufacturer", cellular->manufacturer());
@@ -637,8 +639,25 @@
dictionary->SetString("min", cellular->min());
dictionary->SetBoolean("gsm", cellular->is_gsm());
+
+ SetActivationButtonVisibility(cellular, dictionary);
}
+void InternetOptionsHandler::SetActivationButtonVisibility(
+ const chromeos::CellularNetwork* cellular,
+ DictionaryValue* dictionary) {
+ bool show_activate =
+ cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATING &&
+ cellular->activation_state() != chromeos::ACTIVATION_STATE_ACTIVATED;
+ if (show_activate || cellular->needs_new_plan()) {
Charlie Lee 2011/02/14 20:50:32 I think this logic should be changed to: if (need
zel 2011/02/17 00:56:05 Done.
+ if (cellular->needs_new_plan())
+ dictionary->SetBoolean('showBuyButton', true);
Charlie Lee 2011/02/14 20:50:32 use double quotes so it's consistent
zel 2011/02/17 00:56:05 Done.
+ else
+ dictionary->SetBoolean('showActivateButton', true);
Charlie Lee 2011/02/14 20:50:32 use double quotes so it's consistent
zel 2011/02/17 00:56:05 Done.
+ }
+}
+
+
void InternetOptionsHandler::LoginCallback(const ListValue* args) {
std::string service_path;
std::string password;

Powered by Google App Engine
This is Rietveld 408576698