| 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 <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 #include <stdint.h> |
| 14 | 15 |
| 15 #include "base/basictypes.h" | |
| 16 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
| 17 #include "base/macros.h" |
| 17 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
| 18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 21 #include "google_apis/gcm/base/gcm_export.h" | 22 #include "google_apis/gcm/base/gcm_export.h" |
| 22 #include "google_apis/gcm/engine/account_mapping.h" | 23 #include "google_apis/gcm/engine/account_mapping.h" |
| 23 | 24 |
| 24 namespace gcm { | 25 namespace gcm { |
| 25 | 26 |
| 26 class MCSMessage; | 27 class MCSMessage; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 // Container for Load(..) results. | 45 // Container for Load(..) results. |
| 45 struct GCM_EXPORT LoadResult { | 46 struct GCM_EXPORT LoadResult { |
| 46 LoadResult(); | 47 LoadResult(); |
| 47 ~LoadResult(); | 48 ~LoadResult(); |
| 48 | 49 |
| 49 void Reset(); | 50 void Reset(); |
| 50 | 51 |
| 51 bool success; | 52 bool success; |
| 52 bool store_does_not_exist; | 53 bool store_does_not_exist; |
| 53 uint64 device_android_id; | 54 uint64_t device_android_id; |
| 54 uint64 device_security_token; | 55 uint64_t device_security_token; |
| 55 std::map<std::string, std::string> registrations; | 56 std::map<std::string, std::string> registrations; |
| 56 std::vector<std::string> incoming_messages; | 57 std::vector<std::string> incoming_messages; |
| 57 OutgoingMessageMap outgoing_messages; | 58 OutgoingMessageMap outgoing_messages; |
| 58 std::map<std::string, std::string> gservices_settings; | 59 std::map<std::string, std::string> gservices_settings; |
| 59 std::string gservices_digest; | 60 std::string gservices_digest; |
| 60 base::Time last_checkin_time; | 61 base::Time last_checkin_time; |
| 61 std::set<std::string> last_checkin_accounts; | 62 std::set<std::string> last_checkin_accounts; |
| 62 AccountMappings account_mappings; | 63 AccountMappings account_mappings; |
| 63 base::Time last_token_fetch_time; | 64 base::Time last_token_fetch_time; |
| 64 std::map<std::string, int> heartbeat_intervals; | 65 std::map<std::string, int> heartbeat_intervals; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 // caller. | 77 // caller. |
| 77 virtual void Load(StoreOpenMode open_mode, const LoadCallback& callback) = 0; | 78 virtual void Load(StoreOpenMode open_mode, const LoadCallback& callback) = 0; |
| 78 | 79 |
| 79 // Close the persistent store. | 80 // Close the persistent store. |
| 80 virtual void Close() = 0; | 81 virtual void Close() = 0; |
| 81 | 82 |
| 82 // Clears the GCM store of all data. | 83 // Clears the GCM store of all data. |
| 83 virtual void Destroy(const UpdateCallback& callback) = 0; | 84 virtual void Destroy(const UpdateCallback& callback) = 0; |
| 84 | 85 |
| 85 // Sets this device's messaging credentials. | 86 // Sets this device's messaging credentials. |
| 86 virtual void SetDeviceCredentials(uint64 device_android_id, | 87 virtual void SetDeviceCredentials(uint64_t device_android_id, |
| 87 uint64 device_security_token, | 88 uint64_t device_security_token, |
| 88 const UpdateCallback& callback) = 0; | 89 const UpdateCallback& callback) = 0; |
| 89 | 90 |
| 90 // Registration info for both GCM registrations and InstanceID tokens. | 91 // Registration info for both GCM registrations and InstanceID tokens. |
| 91 // For GCM, |serialized_key| is app_id and |serialized_value| is | 92 // For GCM, |serialized_key| is app_id and |serialized_value| is |
| 92 // serialization of (senders, registration_id). For InstanceID, | 93 // serialization of (senders, registration_id). For InstanceID, |
| 93 // |serialized_key| is serialization of (app_id, authorized_entity, scope) | 94 // |serialized_key| is serialization of (app_id, authorized_entity, scope) |
| 94 // and |serialized_value| is token. | 95 // and |serialized_value| is token. |
| 95 virtual void AddRegistration(const std::string& serialized_key, | 96 virtual void AddRegistration(const std::string& serialized_key, |
| 96 const std::string& serialized_value, | 97 const std::string& serialized_value, |
| 97 const UpdateCallback& callback) = 0; | 98 const UpdateCallback& callback) = 0; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 virtual void RemoveInstanceIDData(const std::string& app_id, | 159 virtual void RemoveInstanceIDData(const std::string& app_id, |
| 159 const UpdateCallback& callback) = 0; | 160 const UpdateCallback& callback) = 0; |
| 160 | 161 |
| 161 private: | 162 private: |
| 162 DISALLOW_COPY_AND_ASSIGN(GCMStore); | 163 DISALLOW_COPY_AND_ASSIGN(GCMStore); |
| 163 }; | 164 }; |
| 164 | 165 |
| 165 } // namespace gcm | 166 } // namespace gcm |
| 166 | 167 |
| 167 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 168 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
| OLD | NEW |