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> gservices_settings; | |
52 std::string gservices_digest; | |
53 base::Time last_checkin_time; | |
50 }; | 54 }; |
51 | 55 |
52 typedef std::vector<std::string> PersistentIdList; | 56 typedef std::vector<std::string> PersistentIdList; |
53 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback; | 57 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback; |
54 typedef base::Callback<void(bool success)> UpdateCallback; | 58 typedef base::Callback<void(bool success)> UpdateCallback; |
55 | 59 |
56 GCMStore(); | 60 GCMStore(); |
57 virtual ~GCMStore(); | 61 virtual ~GCMStore(); |
58 | 62 |
59 // Load the data from persistent store and pass the initial state back to | 63 // 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, | 98 const MCSMessage& message, |
95 const UpdateCallback& callback) = 0; | 99 const UpdateCallback& callback) = 0; |
96 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, | 100 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, |
97 const MCSMessage& message, | 101 const MCSMessage& message, |
98 const UpdateCallback& callback) = 0; | 102 const UpdateCallback& callback) = 0; |
99 virtual void RemoveOutgoingMessage(const std::string& persistent_id, | 103 virtual void RemoveOutgoingMessage(const std::string& persistent_id, |
100 const UpdateCallback& callback) = 0; | 104 const UpdateCallback& callback) = 0; |
101 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, | 105 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, |
102 const UpdateCallback& callback) = 0; | 106 const UpdateCallback& callback) = 0; |
103 | 107 |
108 // GService Settings handling. | |
109 // |settings_to_remove| and |settings_to_add| don't need to be mutually | |
jianli
2014/04/01 20:17:17
nit: update the comment
fgorski
2014/04/01 20:47:54
Done.
| |
110 // exclusive. This will happen when the whole settings map is replaced. | |
111 virtual void UpdateGServicesSettings( | |
112 const std::map<std::string, std::string>& settings_to_add, | |
jianli
2014/04/01 20:17:17
|settings_to_add| means something new to add. Prob
fgorski
2014/04/01 20:47:54
Done.
| |
113 const std::string& settings_digest, | |
114 const base::Time& last_checkin_time, | |
115 const UpdateCallback& callback) = 0; | |
116 | |
104 private: | 117 private: |
105 DISALLOW_COPY_AND_ASSIGN(GCMStore); | 118 DISALLOW_COPY_AND_ASSIGN(GCMStore); |
106 }; | 119 }; |
107 | 120 |
108 } // namespace gcm | 121 } // namespace gcm |
109 | 122 |
110 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 123 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
OLD | NEW |