Chromium Code Reviews| Index: chrome/browser/chromeos/network_message_observer.cc |
| =================================================================== |
| --- chrome/browser/chromeos/network_message_observer.cc (revision 72888) |
| +++ chrome/browser/chromeos/network_message_observer.cc (working copy) |
| @@ -152,7 +152,29 @@ |
| const CellularNetwork* cellular = obj->cellular_network(); |
| if (!cellular) |
| return; |
| - const CellularDataPlan* plan = cellular->GetSignificantDataPlan(); |
| + |
| + // Check to see if the active plan is time-based or data-based. |
| + // If data-based, then only do notification if there's 1 data-based plan left. |
| + const CellularDataPlan* plan = NULL; |
| + const CellularDataPlanVector& plans = cellular->GetDataPlans(); |
| + for (CellularDataPlanVector::const_iterator iter = plans.begin(); |
| + iter != plans.end(); |
| + ++iter) { |
| + if (plan == NULL) { // Looking at first active plan |
| + plan = *iter; |
| + // If time-based, then no need to look further. |
| + if (plan->plan_type == CELLULAR_DATA_PLAN_UNLIMITED) |
| + break; |
| + } else { |
| + // If we find any other data-based plan, then no need for notification. |
| + if ((*iter)->plan_type == CELLULAR_DATA_PLAN_METERED_PAID || |
| + (*iter)->plan_type == CELLULAR_DATA_PLAN_METERED_BASE) { |
|
Vince Laviano
2011/02/02 21:47:43
This logic assumes that the data-based plan that w
Charlie Lee
2011/02/08 02:09:16
Done.
|
| + plan = NULL; |
| + break; |
| + } |
| + } |
| + } |
| + |
|
Vince Laviano
2011/02/02 21:47:43
It looks like |plan| is set to non-NULL if there i
Charlie Lee
2011/02/08 02:09:16
Done.
|
| std::string new_plan_name = plan ? plan->plan_name : ""; |
| CellularDataPlanType new_plan_type = plan ? plan->plan_type : |
| CELLULAR_DATA_PLAN_UNKNOWN; |
|
Vince Laviano
2011/02/02 21:47:43
I think that we could eliminate these two vars and
Charlie Lee
2011/02/08 02:09:16
Done.
|