Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / google_apis / gcm / engine / gcm_store.h
index 8b9891d..2b35549 100644 (file)
@@ -6,6 +6,7 @@
 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_
 
 #include <map>
+#include <set>
 #include <string>
 #include <vector>
 
@@ -18,6 +19,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
 #include "google_apis/gcm/base/gcm_export.h"
+#include "google_apis/gcm/engine/account_mapping.h"
 #include "google_apis/gcm/engine/registration_info.h"
 
 namespace gcm {
@@ -32,11 +34,16 @@ class GCM_EXPORT GCMStore {
   typedef std::map<std::string, linked_ptr<google::protobuf::MessageLite> >
       OutgoingMessageMap;
 
+  // Map of account id to account info for account mappings.
+  typedef std::map<std::string, AccountMapping> AccountMappingMap;
+
   // Container for Load(..) results.
   struct GCM_EXPORT LoadResult {
     LoadResult();
     ~LoadResult();
 
+    void Reset();
+
     bool success;
     uint64 device_android_id;
     uint64 device_security_token;
@@ -46,6 +53,8 @@ class GCM_EXPORT GCMStore {
     std::map<std::string, std::string> gservices_settings;
     std::string gservices_digest;
     base::Time last_checkin_time;
+    std::set<std::string> last_checkin_accounts;
+    AccountMappingMap account_mappings;
   };
 
   typedef std::vector<std::string> PersistentIdList;
@@ -100,8 +109,9 @@ class GCM_EXPORT GCMStore {
   virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids,
                                       const UpdateCallback& callback) = 0;
 
-  // Sets last device's checkin time.
-  virtual void SetLastCheckinTime(const base::Time& last_checkin_time,
+  // Sets last device's checkin information.
+  virtual void SetLastCheckinInfo(const base::Time& time,
+                                  const std::set<std::string>& accounts,
                                   const UpdateCallback& callback) = 0;
 
   // G-service settings handling.
@@ -112,6 +122,12 @@ class GCM_EXPORT GCMStore {
       const std::string& settings_digest,
       const UpdateCallback& callback) = 0;
 
+  // Sets the account information related to device to account mapping.
+  virtual void AddAccountMapping(const AccountMapping& account_mapping,
+                                 const UpdateCallback& callback) = 0;
+  virtual void RemoveAccountMapping(const std::string& account_id,
+                                    const UpdateCallback& callback) = 0;
+
  private:
   DISALLOW_COPY_AND_ASSIGN(GCMStore);
 };