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

Unified Diff: src/data_plan.h

Issue 3528016: Cashew: implement backend usage API (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git
Patch Set: Fix code review nits and remove hardcoded usage URLs Created 10 years, 2 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 | « src/cashew_server.cc ('k') | src/data_plan.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/data_plan.h
diff --git a/src/data_plan.h b/src/data_plan.h
index 47d2b2c082a465fba1aacdbfd75302293b2617d6..3bc037531c144a4919cf90cf231a4129ac134807 100644
--- a/src/data_plan.h
+++ b/src/data_plan.h
@@ -11,6 +11,7 @@
#include <base/basictypes.h> // NOLINT
#include <base/time.h> // NOLINT
+#include <base/values.h> // NOLINT
#include <dbus-c++/dbus.h> // NOLINT
namespace cashew {
@@ -69,6 +70,15 @@ class DataPlan {
// return a{sv} representation for D-Bus
virtual DBusDataPlan ToDBusFormat() const;
+ // construct DataPlan from DictionaryValue
+ static DataPlan* FromDictionaryValue(const DictionaryValue *value);
+
+ // convert ISO8601 time value in UTC to base::Time
+ // returns true on success and false on failure
+ // |time_out| must not be NULL and is set on a successful return
+ static bool TimeFromISO8601UTC(const std::string& time_8601_utc,
+ base::Time *time_out);
+
private:
// human-readable plan name
const std::string name_;
@@ -92,8 +102,14 @@ class DataPlan {
// bytes consumed so far during plan period
Bytes data_bytes_used_;
- // convert plan type enum value to string
- const char* TypeToString(Type) const;
+ // convert plan type enum value to string formatted for libcros
+ const char* TypeToLibcrosString(Type type) const;
+
+ // convert string formatted for Cros Usage API to plan type enum value
+ // returns true on success and false on failure
+ // |type_out| must not be NULL and is set on a successful return
+ static bool CrosUsageStringToType(const std::string& type_string,
+ Type *type_out);
DISALLOW_COPY_AND_ASSIGN(DataPlan);
};
« no previous file with comments | « src/cashew_server.cc ('k') | src/data_plan.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698