summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/cros/cellular_data_plan.h
blob: 57117097de4a2197241ac4f0905847e9304a7ac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_CROS_CELLULAR_DATA_PLAN_H_
#define CHROME_BROWSER_CHROMEOS_CROS_CELLULAR_DATA_PLAN_H_

#include <string>

#include "base/memory/scoped_vector.h"
#include "base/string16.h"
#include "base/time.h"

namespace chromeos {

// Enum to describe type of a plan.
enum CellularDataPlanType {
  CELLULAR_DATA_PLAN_UNKNOWN = 0,
  CELLULAR_DATA_PLAN_UNLIMITED = 1,
  CELLULAR_DATA_PLAN_METERED_PAID = 2,
  CELLULAR_DATA_PLAN_METERED_BASE = 3
};

// Cellular network is considered low data when less than 60 minues.
extern const int kCellularDataLowSecs;

// Cellular network is considered low data when less than 30 minues.
extern const int kCellularDataVeryLowSecs;

// Cellular network is considered low data when less than 100MB.
extern const int kCellularDataLowBytes;

// Cellular network is considered very low data when less than 50MB.
extern const int kCellularDataVeryLowBytes;

class CellularDataPlan {
 public:
  CellularDataPlan();
  ~CellularDataPlan();

  // Formats cellular plan description.
  string16 GetPlanDesciption() const;
  // Evaluates cellular plans status and returns warning string if it is near
  // expiration.
  string16 GetRemainingWarning() const;
  // Formats remaining plan data description.
  string16 GetDataRemainingDesciption() const;
  // Formats plan expiration description.
  string16 GetPlanExpiration() const;
  // Formats plan usage info.
  string16 GetUsageInfo() const;
  // Returns a unique string for this plan that can be used for comparisons.
  std::string GetUniqueIdentifier() const;
  base::TimeDelta remaining_time() const;
  int64 remaining_minutes() const;
  // Returns plan data remaining in bytes.
  int64 remaining_data() const;
  // TODO(stevenjb): Make these private with accessors and properly named.
  std::string plan_name;
  CellularDataPlanType plan_type;
  base::Time update_time;
  base::Time plan_start_time;
  base::Time plan_end_time;
  int64 plan_data_bytes;
  int64 data_bytes_used;
};

typedef ScopedVector<CellularDataPlan> CellularDataPlanVector;

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_CROS_CELLULAR_DATA_PLAN_H_