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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/time/time.h" | |
17 #include "google_apis/gcm/base/gcm_export.h" | 18 #include "google_apis/gcm/base/gcm_export.h" |
18 #include "google_apis/gcm/engine/registration_info.h" | 19 #include "google_apis/gcm/engine/registration_info.h" |
19 #include "google_apis/gcm/protocol/mcs.pb.h" | 20 #include "google_apis/gcm/protocol/mcs.pb.h" |
20 | 21 |
21 namespace google { | 22 namespace google { |
22 namespace protobuf { | 23 namespace protobuf { |
23 class MessageLite; | 24 class MessageLite; |
24 } // namespace protobuf | 25 } // namespace protobuf |
25 } // namespace google | 26 } // namespace google |
26 | 27 |
(...skipping 13 matching lines...) Expand all Loading... | |
40 struct GCM_EXPORT LoadResult { | 41 struct GCM_EXPORT LoadResult { |
41 LoadResult(); | 42 LoadResult(); |
42 ~LoadResult(); | 43 ~LoadResult(); |
43 | 44 |
44 bool success; | 45 bool success; |
45 uint64 device_android_id; | 46 uint64 device_android_id; |
46 uint64 device_security_token; | 47 uint64 device_security_token; |
47 RegistrationInfoMap registrations; | 48 RegistrationInfoMap registrations; |
48 std::vector<std::string> incoming_messages; | 49 std::vector<std::string> incoming_messages; |
49 OutgoingMessageMap outgoing_messages; | 50 OutgoingMessageMap outgoing_messages; |
51 std::map<std::string, std::string> g_services_settings; | |
52 base::Time last_checkin_time; | |
50 }; | 53 }; |
51 | 54 |
52 typedef std::vector<std::string> PersistentIdList; | 55 typedef std::vector<std::string> PersistentIdList; |
53 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback; | 56 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback; |
54 typedef base::Callback<void(bool success)> UpdateCallback; | 57 typedef base::Callback<void(bool success)> UpdateCallback; |
55 | 58 |
56 GCMStore(); | 59 GCMStore(); |
57 virtual ~GCMStore(); | 60 virtual ~GCMStore(); |
58 | 61 |
59 // Load the data from persistent store and pass the initial state back to | 62 // Load the data from persistent store and pass the initial state back to |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 const MCSMessage& message, | 97 const MCSMessage& message, |
95 const UpdateCallback& callback) = 0; | 98 const UpdateCallback& callback) = 0; |
96 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, | 99 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, |
97 const MCSMessage& message, | 100 const MCSMessage& message, |
98 const UpdateCallback& callback) = 0; | 101 const UpdateCallback& callback) = 0; |
99 virtual void RemoveOutgoingMessage(const std::string& persistent_id, | 102 virtual void RemoveOutgoingMessage(const std::string& persistent_id, |
100 const UpdateCallback& callback) = 0; | 103 const UpdateCallback& callback) = 0; |
101 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, | 104 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, |
102 const UpdateCallback& callback) = 0; | 105 const UpdateCallback& callback) = 0; |
103 | 106 |
107 // GService Settings handling. | |
Nicolas Zea
2014/03/28 18:31:38
Comment whether it's assumed settings_to_remove an
fgorski
2014/03/29 01:09:32
Done.
| |
108 virtual void UpdateGServicesSettings( | |
fgorski
2014/03/28 14:30:51
we should pass last_checkin_time in to ensure we t
Nicolas Zea
2014/03/28 18:31:38
Yeah, that should be persisted in a separate call
fgorski
2014/03/29 01:09:32
No it should not. The settings will be updated onl
fgorski
2014/03/29 01:09:32
Done.
| |
109 const std::vector<std::string>& settings_to_remove, | |
110 const std::map<std::string, std::string>& settings_to_add, | |
111 const UpdateCallback& callback) = 0; | |
112 | |
104 private: | 113 private: |
105 DISALLOW_COPY_AND_ASSIGN(GCMStore); | 114 DISALLOW_COPY_AND_ASSIGN(GCMStore); |
106 }; | 115 }; |
107 | 116 |
108 } // namespace gcm | 117 } // namespace gcm |
109 | 118 |
110 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 119 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
OLD | NEW |