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

Side by Side Diff: google_apis/gcm/engine/gcm_store.h

Issue 1137463003: Support getting and deleting token for Instance ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new files Created 5 years, 7 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 unified diff | Download patch
OLDNEW
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 <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include <google/protobuf/message_lite.h> 13 #include <google/protobuf/message_lite.h>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/callback_forward.h" 16 #include "base/callback_forward.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "google_apis/gcm/base/gcm_export.h" 21 #include "google_apis/gcm/base/gcm_export.h"
22 #include "google_apis/gcm/engine/account_mapping.h" 22 #include "google_apis/gcm/engine/account_mapping.h"
23 #include "google_apis/gcm/engine/registration_info.h"
24 23
25 namespace gcm { 24 namespace gcm {
26 25
27 class MCSMessage; 26 class MCSMessage;
28 27
29 // A GCM data store interface. GCM Store will handle persistence portion of RMQ, 28 // A GCM data store interface. GCM Store will handle persistence portion of RMQ,
30 // as well as store device and user checkin information. 29 // as well as store device and user checkin information.
31 class GCM_EXPORT GCMStore { 30 class GCM_EXPORT GCMStore {
32 public: 31 public:
33 // Map of message id to message data for outgoing messages. 32 // Map of message id to message data for outgoing messages.
34 typedef std::map<std::string, linked_ptr<google::protobuf::MessageLite> > 33 typedef std::map<std::string, linked_ptr<google::protobuf::MessageLite> >
35 OutgoingMessageMap; 34 OutgoingMessageMap;
36 35
37 // List of account mappings. 36 // List of account mappings.
38 typedef std::vector<AccountMapping> AccountMappings; 37 typedef std::vector<AccountMapping> AccountMappings;
39 38
40 // Container for Load(..) results. 39 // Container for Load(..) results.
41 struct GCM_EXPORT LoadResult { 40 struct GCM_EXPORT LoadResult {
42 LoadResult(); 41 LoadResult();
43 ~LoadResult(); 42 ~LoadResult();
44 43
45 void Reset(); 44 void Reset();
46 45
47 bool success; 46 bool success;
48 uint64 device_android_id; 47 uint64 device_android_id;
49 uint64 device_security_token; 48 uint64 device_security_token;
50 RegistrationInfoMap registrations; 49 std::map<std::string, std::string> registrations;
51 std::vector<std::string> incoming_messages; 50 std::vector<std::string> incoming_messages;
52 OutgoingMessageMap outgoing_messages; 51 OutgoingMessageMap outgoing_messages;
53 std::map<std::string, std::string> gservices_settings; 52 std::map<std::string, std::string> gservices_settings;
54 std::string gservices_digest; 53 std::string gservices_digest;
55 base::Time last_checkin_time; 54 base::Time last_checkin_time;
56 std::set<std::string> last_checkin_accounts; 55 std::set<std::string> last_checkin_accounts;
57 AccountMappings account_mappings; 56 AccountMappings account_mappings;
58 base::Time last_token_fetch_time; 57 base::Time last_token_fetch_time;
59 std::map<std::string, int> heartbeat_intervals; 58 std::map<std::string, int> heartbeat_intervals;
60 std::map<std::string, std::string> instance_id_data; 59 std::map<std::string, std::string> instance_id_data;
(...skipping 15 matching lines...) Expand all
76 75
77 // Clears the GCM store of all data. 76 // Clears the GCM store of all data.
78 virtual void Destroy(const UpdateCallback& callback) = 0; 77 virtual void Destroy(const UpdateCallback& callback) = 0;
79 78
80 // Sets this device's messaging credentials. 79 // Sets this device's messaging credentials.
81 virtual void SetDeviceCredentials(uint64 device_android_id, 80 virtual void SetDeviceCredentials(uint64 device_android_id,
82 uint64 device_security_token, 81 uint64 device_security_token,
83 const UpdateCallback& callback) = 0; 82 const UpdateCallback& callback) = 0;
84 83
85 // Registration info. 84 // Registration info.
86 virtual void AddRegistration(const std::string& app_id, 85 virtual void AddRegistration(const std::string& serialized_key,
87 const linked_ptr<RegistrationInfo>& registration, 86 const std::string& serialized_value,
88 const UpdateCallback& callback) = 0; 87 const UpdateCallback& callback) = 0;
89 virtual void RemoveRegistration(const std::string& app_id, 88 virtual void RemoveRegistration(const std::string& serialized_key,
90 const UpdateCallback& callback) = 0; 89 const UpdateCallback& callback) = 0;
91 90
92 // Unacknowledged incoming message handling. 91 // Unacknowledged incoming message handling.
93 virtual void AddIncomingMessage(const std::string& persistent_id, 92 virtual void AddIncomingMessage(const std::string& persistent_id,
94 const UpdateCallback& callback) = 0; 93 const UpdateCallback& callback) = 0;
95 virtual void RemoveIncomingMessage(const std::string& persistent_id, 94 virtual void RemoveIncomingMessage(const std::string& persistent_id,
96 const UpdateCallback& callback) = 0; 95 const UpdateCallback& callback) = 0;
97 virtual void RemoveIncomingMessages(const PersistentIdList& persistent_ids, 96 virtual void RemoveIncomingMessages(const PersistentIdList& persistent_ids,
98 const UpdateCallback& callback) = 0; 97 const UpdateCallback& callback) = 0;
99 98
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 virtual void RemoveInstanceIDData(const std::string& app_id, 148 virtual void RemoveInstanceIDData(const std::string& app_id,
150 const UpdateCallback& callback) = 0; 149 const UpdateCallback& callback) = 0;
151 150
152 private: 151 private:
153 DISALLOW_COPY_AND_ASSIGN(GCMStore); 152 DISALLOW_COPY_AND_ASSIGN(GCMStore);
154 }; 153 };
155 154
156 } // namespace gcm 155 } // namespace gcm
157 156
158 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ 157 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698