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; |