OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium 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 #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include <google/protobuf/message_lite.h> | 13 #include <google/protobuf/message_lite.h> |
13 | 14 |
14 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
15 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
16 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
18 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
(...skipping 20 matching lines...) Expand all Loading... |
39 | 40 |
40 bool success; | 41 bool success; |
41 uint64 device_android_id; | 42 uint64 device_android_id; |
42 uint64 device_security_token; | 43 uint64 device_security_token; |
43 RegistrationInfoMap registrations; | 44 RegistrationInfoMap registrations; |
44 std::vector<std::string> incoming_messages; | 45 std::vector<std::string> incoming_messages; |
45 OutgoingMessageMap outgoing_messages; | 46 OutgoingMessageMap outgoing_messages; |
46 std::map<std::string, std::string> gservices_settings; | 47 std::map<std::string, std::string> gservices_settings; |
47 std::string gservices_digest; | 48 std::string gservices_digest; |
48 base::Time last_checkin_time; | 49 base::Time last_checkin_time; |
| 50 std::set<std::string> last_checkin_accounts; |
49 }; | 51 }; |
50 | 52 |
51 typedef std::vector<std::string> PersistentIdList; | 53 typedef std::vector<std::string> PersistentIdList; |
52 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback; | 54 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback; |
53 typedef base::Callback<void(bool success)> UpdateCallback; | 55 typedef base::Callback<void(bool success)> UpdateCallback; |
54 | 56 |
55 GCMStore(); | 57 GCMStore(); |
56 virtual ~GCMStore(); | 58 virtual ~GCMStore(); |
57 | 59 |
58 // Load the data from persistent store and pass the initial state back to | 60 // Load the data from persistent store and pass the initial state back to |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 const UpdateCallback& callback) = 0; | 96 const UpdateCallback& callback) = 0; |
95 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, | 97 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, |
96 const MCSMessage& message, | 98 const MCSMessage& message, |
97 const UpdateCallback& callback) = 0; | 99 const UpdateCallback& callback) = 0; |
98 virtual void RemoveOutgoingMessage(const std::string& persistent_id, | 100 virtual void RemoveOutgoingMessage(const std::string& persistent_id, |
99 const UpdateCallback& callback) = 0; | 101 const UpdateCallback& callback) = 0; |
100 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, | 102 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, |
101 const UpdateCallback& callback) = 0; | 103 const UpdateCallback& callback) = 0; |
102 | 104 |
103 // Sets last device's checkin time. | 105 // Sets last device's checkin time. |
104 virtual void SetLastCheckinTime(const base::Time& last_checkin_time, | 106 virtual void SetLastCheckinInfo(const base::Time& time, |
| 107 const std::set<std::string>& accounts, |
105 const UpdateCallback& callback) = 0; | 108 const UpdateCallback& callback) = 0; |
106 | 109 |
107 // G-service settings handling. | 110 // G-service settings handling. |
108 // Persists |settings| and |settings_digest|. It completely replaces the | 111 // Persists |settings| and |settings_digest|. It completely replaces the |
109 // existing data. | 112 // existing data. |
110 virtual void SetGServicesSettings( | 113 virtual void SetGServicesSettings( |
111 const std::map<std::string, std::string>& settings, | 114 const std::map<std::string, std::string>& settings, |
112 const std::string& settings_digest, | 115 const std::string& settings_digest, |
113 const UpdateCallback& callback) = 0; | 116 const UpdateCallback& callback) = 0; |
114 | 117 |
115 private: | 118 private: |
116 DISALLOW_COPY_AND_ASSIGN(GCMStore); | 119 DISALLOW_COPY_AND_ASSIGN(GCMStore); |
117 }; | 120 }; |
118 | 121 |
119 } // namespace gcm | 122 } // namespace gcm |
120 | 123 |
121 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 124 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
OLD | NEW |