Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/data_plan.h" | 5 #include "src/data_plan.h" |
| 6 | 6 |
| 7 #include <time.h> | 7 #include <time.h> |
| 8 | 8 |
| 9 #include <glog/logging.h> | 9 #include <glog/logging.h> |
| 10 | 10 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 // convert from time_t to base::Time | 299 // convert from time_t to base::Time |
| 300 *time_out = base::Time::FromTimeT(tt); | 300 *time_out = base::Time::FromTimeT(tt); |
| 301 return true; | 301 return true; |
| 302 } | 302 } |
| 303 | 303 |
| 304 // static | 304 // static |
| 305 DataPlan* DataPlan::GetActivePlan(const DataPlanList& data_plans) { | 305 DataPlan* DataPlan::GetActivePlan(const DataPlanList& data_plans) { |
| 306 DataPlanList::const_iterator it; | 306 DataPlanList::const_iterator it; |
| 307 for (it = data_plans.begin(); it != data_plans.end(); ++it) { | 307 for (it = data_plans.begin(); it != data_plans.end(); ++it) { |
| 308 DataPlan *plan = *it; | 308 DataPlan *plan = *it; |
| 309 DCHECK(plan != NULL); | 309 DCHECK(plan != NULL); |
|
Daniel Kurtz
2010/12/14 04:38:44
CHECK_NOTNULL(plan)?
Vince Laviano
2010/12/14 18:48:22
I wanted this to be a debug-only check. The versio
| |
| 310 if (plan->IsActive()) { | 310 if (plan->IsActive()) { |
| 311 return plan; | 311 return plan; |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 return NULL; | 314 return NULL; |
| 315 } | 315 } |
| 316 | 316 |
| 317 // private methods | 317 // private methods |
| 318 | 318 |
| 319 const char* DataPlan::TypeToLibcrosString(DataPlan::Type type) const { | 319 const char* DataPlan::TypeToLibcrosString(DataPlan::Type type) const { |
| 320 switch (type) { | 320 switch (type) { |
| 321 case kTypeUnlimited: | 321 case kTypeUnlimited: |
| 322 return kCellularDataPlanTypeUnlimited; | 322 return kCellularDataPlanTypeUnlimited; |
| 323 case kTypeMeteredFree: | 323 case kTypeMeteredFree: |
| 324 return kCellularDataPlanTypeMeteredFree; | 324 return kCellularDataPlanTypeMeteredFree; |
| 325 case kTypeMeteredPaid: | 325 case kTypeMeteredPaid: |
| 326 return kCellularDataPlanTypeMeteredPaid; | 326 return kCellularDataPlanTypeMeteredPaid; |
| 327 default: | 327 default: |
| 328 DCHECK(false); | 328 CHECK(false); |
|
Daniel Kurtz
2010/12/14 04:38:44
Is it ok to not return anything here?
Vince Laviano
2010/12/14 18:48:22
Yes, if we're aborting unconditionally. The reason
| |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 // static | 332 // static |
| 333 bool DataPlan::CrosUsageStringToType(const std::string& type_string, | 333 bool DataPlan::CrosUsageStringToType(const std::string& type_string, |
| 334 DataPlan::Type *type_out) { | 334 DataPlan::Type *type_out) { |
| 335 CHECK_NOTNULL(type_out); | 335 CHECK_NOTNULL(type_out); |
| 336 if (type_string == kCrosUsageDataPlanTypeUnlimited) { | 336 if (type_string == kCrosUsageDataPlanTypeUnlimited) { |
| 337 *type_out = kTypeUnlimited; | 337 *type_out = kTypeUnlimited; |
| 338 } else if (type_string == kCrosUsageDataPlanTypeMeteredFree) { | 338 } else if (type_string == kCrosUsageDataPlanTypeMeteredFree) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 355 *out_value = generic_int_out; | 355 *out_value = generic_int_out; |
| 356 return true; | 356 return true; |
| 357 } | 357 } |
| 358 if (dict.GetInteger64(key, out_value)) { | 358 if (dict.GetInteger64(key, out_value)) { |
| 359 return true; | 359 return true; |
| 360 } | 360 } |
| 361 return false; | 361 return false; |
| 362 } | 362 } |
| 363 | 363 |
| 364 } // namespace cashew | 364 } // namespace cashew |
| OLD | NEW |