| 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_IMPL_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ |
| 6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // WARNING: this will permanently destroy any pending outgoing messages | 39 // WARNING: this will permanently destroy any pending outgoing messages |
| 40 // and require the device to re-create credentials and serial number mapping | 40 // and require the device to re-create credentials and serial number mapping |
| 41 // tables. | 41 // tables. |
| 42 virtual void Destroy(const UpdateCallback& callback) OVERRIDE; | 42 virtual void Destroy(const UpdateCallback& callback) OVERRIDE; |
| 43 | 43 |
| 44 // Sets this device's messaging credentials. | 44 // Sets this device's messaging credentials. |
| 45 virtual void SetDeviceCredentials(uint64 device_android_id, | 45 virtual void SetDeviceCredentials(uint64 device_android_id, |
| 46 uint64 device_security_token, | 46 uint64 device_security_token, |
| 47 const UpdateCallback& callback) OVERRIDE; | 47 const UpdateCallback& callback) OVERRIDE; |
| 48 | 48 |
| 49 // Registration info. |
| 50 virtual void AddRegistration(const std::string& app_id, |
| 51 const RegistrationInfo& registration, |
| 52 const UpdateCallback& callback) OVERRIDE; |
| 53 virtual void RemoveRegistration(const std::string& app_id, |
| 54 const UpdateCallback& callback) OVERRIDE; |
| 55 |
| 49 // Unacknowledged incoming message handling. | 56 // Unacknowledged incoming message handling. |
| 50 virtual void AddIncomingMessage(const std::string& persistent_id, | 57 virtual void AddIncomingMessage(const std::string& persistent_id, |
| 51 const UpdateCallback& callback) OVERRIDE; | 58 const UpdateCallback& callback) OVERRIDE; |
| 52 virtual void RemoveIncomingMessage(const std::string& persistent_id, | 59 virtual void RemoveIncomingMessage(const std::string& persistent_id, |
| 53 const UpdateCallback& callback) OVERRIDE; | 60 const UpdateCallback& callback) OVERRIDE; |
| 54 virtual void RemoveIncomingMessages(const PersistentIdList& persistent_ids, | 61 virtual void RemoveIncomingMessages(const PersistentIdList& persistent_ids, |
| 55 const UpdateCallback& callback) OVERRIDE; | 62 const UpdateCallback& callback) OVERRIDE; |
| 56 | 63 |
| 57 // Unacknowledged outgoing messages handling. | 64 // Unacknowledged outgoing messages handling. |
| 58 virtual bool AddOutgoingMessage(const std::string& persistent_id, | 65 virtual bool AddOutgoingMessage(const std::string& persistent_id, |
| 59 const MCSMessage& message, | 66 const MCSMessage& message, |
| 60 const UpdateCallback& callback) OVERRIDE; | 67 const UpdateCallback& callback) OVERRIDE; |
| 61 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, | 68 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, |
| 62 const MCSMessage& message, | 69 const MCSMessage& message, |
| 63 const UpdateCallback& callback) | 70 const UpdateCallback& callback) |
| 64 OVERRIDE; | 71 OVERRIDE; |
| 65 virtual void RemoveOutgoingMessage(const std::string& persistent_id, | 72 virtual void RemoveOutgoingMessage(const std::string& persistent_id, |
| 66 const UpdateCallback& callback) OVERRIDE; | 73 const UpdateCallback& callback) OVERRIDE; |
| 67 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, | 74 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, |
| 68 const UpdateCallback& callback) OVERRIDE; | 75 const UpdateCallback& callback) OVERRIDE; |
| 69 | 76 |
| 70 // User serial number handling. | |
| 71 virtual void SetNextSerialNumber(int64 next_serial_number, | |
| 72 const UpdateCallback& callback) OVERRIDE; | |
| 73 virtual void AddUserSerialNumber(const std::string& username, | |
| 74 int64 serial_number, | |
| 75 const UpdateCallback& callback) OVERRIDE; | |
| 76 virtual void RemoveUserSerialNumber(const std::string& username, | |
| 77 const UpdateCallback& callback) OVERRIDE; | |
| 78 | |
| 79 private: | 77 private: |
| 80 typedef std::map<std::string, int> AppIdToMessageCountMap; | 78 typedef std::map<std::string, int> AppIdToMessageCountMap; |
| 81 | 79 |
| 82 // Continuation to update the per-app message counts after a load. | 80 // Continuation to update the per-app message counts after a load. |
| 83 void LoadContinuation(const LoadCallback& callback, | 81 void LoadContinuation(const LoadCallback& callback, |
| 84 scoped_ptr<LoadResult> result); | 82 scoped_ptr<LoadResult> result); |
| 85 | 83 |
| 86 // Continuation to update the per-app message counts when adding messages. | 84 // Continuation to update the per-app message counts when adding messages. |
| 87 // In particular, if a message fails to add, the message count is decremented. | 85 // In particular, if a message fails to add, the message count is decremented. |
| 88 void AddOutgoingMessageContinuation(const UpdateCallback& callback, | 86 void AddOutgoingMessageContinuation(const UpdateCallback& callback, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 107 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 105 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 108 | 106 |
| 109 base::WeakPtrFactory<GCMStoreImpl> weak_ptr_factory_; | 107 base::WeakPtrFactory<GCMStoreImpl> weak_ptr_factory_; |
| 110 | 108 |
| 111 DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl); | 109 DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl); |
| 112 }; | 110 }; |
| 113 | 111 |
| 114 } // namespace gcm | 112 } // namespace gcm |
| 115 | 113 |
| 116 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ | 114 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ |
| OLD | NEW |