summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/options/cellular_config_view.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chromeos/options/cellular_config_view.cc')
-rw-r--r--chrome/browser/chromeos/options/cellular_config_view.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/chrome/browser/chromeos/options/cellular_config_view.cc b/chrome/browser/chromeos/options/cellular_config_view.cc
index 725efe8..be919e9 100644
--- a/chrome/browser/chromeos/options/cellular_config_view.cc
+++ b/chrome/browser/chromeos/options/cellular_config_view.cc
@@ -40,7 +40,7 @@ struct PlanDetails {
// TODO(xiyuan): Get real data from libcros when it's ready.
// Get plan details at the time being called.
-void GetPlanDetails(const chromeos::CellularNetwork& cellular,
+void GetPlanDetails(const chromeos::CellularNetwork* cellular,
PlanDetails* details) {
// Free 5M 30day plan.
details->last_purchase_type = UNKNOWN;
@@ -56,9 +56,9 @@ void GetPlanDetails(const chromeos::CellularNetwork& cellular,
namespace chromeos {
CellularConfigView::CellularConfigView(NetworkConfigView* parent,
- const CellularNetwork& cellular)
+ const CellularNetwork* cellular)
: parent_(parent),
- cellular_(cellular),
+ cellular_(new CellularNetwork(*cellular)),
purchase_info_(NULL),
purchase_more_button_(NULL),
remaining_data_info_(NULL),
@@ -69,6 +69,9 @@ CellularConfigView::CellularConfigView(NetworkConfigView* parent,
Init();
}
+CellularConfigView::~CellularConfigView() {
+}
+
void CellularConfigView::ButtonPressed(views::Button* button,
const views::Event& event) {
if (button == purchase_more_button_) {
@@ -85,9 +88,10 @@ void CellularConfigView::LinkActivated(views::Link* source, int event_flags) {
bool CellularConfigView::Save() {
// Save auto-connect here.
bool auto_connect = autoconnect_checkbox_->checked();
- if (auto_connect != cellular_.auto_connect()) {
- cellular_.set_auto_connect(auto_connect);
- CrosLibrary::Get()->GetNetworkLibrary()->SaveCellularNetwork(cellular_);
+ if (auto_connect != cellular_->auto_connect()) {
+ cellular_->set_auto_connect(auto_connect);
+ CrosLibrary::Get()->GetNetworkLibrary()->SaveCellularNetwork(
+ cellular_.get());
}
return true;
}
@@ -157,10 +161,10 @@ void CellularConfigView::Init() {
}
void CellularConfigView::Update() {
- autoconnect_checkbox_->SetChecked(cellular_.auto_connect());
+ autoconnect_checkbox_->SetChecked(cellular_->auto_connect());
PlanDetails details;
- GetPlanDetails(cellular_, &details);
+ GetPlanDetails(cellular_.get(), &details);
switch (details.last_purchase_type) {
case NO_PURCHASE: