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

Side by Side Diff: src/data_plan.cc

Issue 5696004: cashew: add cros-debug support (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: Address djkurtz review comments Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_NOTNULL(plan);
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);
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
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
OLDNEW
« no previous file with comments | « no previous file | src/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698