| 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 base::Time last_checkin_time; |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 typedef std::vector<std::string> PersistentIdList; | 54 typedef std::vector<std::string> PersistentIdList; |
| 53 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback; | 55 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback; |
| 54 typedef base::Callback<void(bool success)> UpdateCallback; | 56 typedef base::Callback<void(bool success)> UpdateCallback; |
| 55 | 57 |
| 56 GCMStore(); | 58 GCMStore(); |
| 57 virtual ~GCMStore(); | 59 virtual ~GCMStore(); |
| 58 | 60 |
| 59 // Load the data from persistent store and pass the initial state back to | 61 // 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, | 96 const MCSMessage& message, |
| 95 const UpdateCallback& callback) = 0; | 97 const UpdateCallback& callback) = 0; |
| 96 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, | 98 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, |
| 97 const MCSMessage& message, | 99 const MCSMessage& message, |
| 98 const UpdateCallback& callback) = 0; | 100 const UpdateCallback& callback) = 0; |
| 99 virtual void RemoveOutgoingMessage(const std::string& persistent_id, | 101 virtual void RemoveOutgoingMessage(const std::string& persistent_id, |
| 100 const UpdateCallback& callback) = 0; | 102 const UpdateCallback& callback) = 0; |
| 101 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, | 103 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, |
| 102 const UpdateCallback& callback) = 0; | 104 const UpdateCallback& callback) = 0; |
| 103 | 105 |
| 106 // Sets last device's checkin time. |
| 107 virtual void SetLastCheckinTime(const base::Time& last_checkin_time, |
| 108 const UpdateCallback& callback) = 0; |
| 109 |
| 104 private: | 110 private: |
| 105 DISALLOW_COPY_AND_ASSIGN(GCMStore); | 111 DISALLOW_COPY_AND_ASSIGN(GCMStore); |
| 106 }; | 112 }; |
| 107 | 113 |
| 108 } // namespace gcm | 114 } // namespace gcm |
| 109 | 115 |
| 110 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ | 116 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ |
| OLD | NEW |