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

Unified Diff: chrome/browser/chromeos/network_message_observer.cc

Issue 6347044: Only show notification for low 3g data for the last data-based plan.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698