| 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 SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ | 5 #ifndef SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ |
| 6 #define SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ | 6 #define SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "sync/api/attachments/attachment_service.h" | 10 #include "sync/api/attachments/attachment_service.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // Create a FakeAttachmentService suitable for use in tests. | 23 // Create a FakeAttachmentService suitable for use in tests. |
| 24 static scoped_ptr<syncer::AttachmentService> CreateForTest(); | 24 static scoped_ptr<syncer::AttachmentService> CreateForTest(); |
| 25 | 25 |
| 26 // AttachmentService implementation. | 26 // AttachmentService implementation. |
| 27 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, | 27 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, |
| 28 const GetOrDownloadCallback& callback) | 28 const GetOrDownloadCallback& callback) |
| 29 OVERRIDE; | 29 OVERRIDE; |
| 30 virtual void DropAttachments(const AttachmentIdList& attachment_ids, | 30 virtual void DropAttachments(const AttachmentIdList& attachment_ids, |
| 31 const DropCallback& callback) OVERRIDE; | 31 const DropCallback& callback) OVERRIDE; |
| 32 virtual void OnSyncDataAdd(const SyncData& sync_data) OVERRIDE; | 32 virtual void StoreAttachments(const AttachmentList& attachments, |
| 33 const StoreCallback& callback) OVERRIDE; |
| 33 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE; | 34 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE; |
| 34 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids, | 35 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids, |
| 35 const SyncData& updated_sync_data) OVERRIDE; | 36 const SyncData& updated_sync_data) OVERRIDE; |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 void ReadDone(const GetOrDownloadCallback& callback, | 39 void ReadDone(const GetOrDownloadCallback& callback, |
| 39 const AttachmentStore::Result& result, | 40 const AttachmentStore::Result& result, |
| 40 scoped_ptr<AttachmentMap> attachments); | 41 scoped_ptr<AttachmentMap> attachments); |
| 41 void DropDone(const DropCallback& callback, | 42 void DropDone(const DropCallback& callback, |
| 42 const AttachmentStore::Result& result); | 43 const AttachmentStore::Result& result); |
| 44 void WriteDone(const StoreCallback& callback, |
| 45 const AttachmentStore::Result& result); |
| 43 | 46 |
| 44 const scoped_ptr<AttachmentStore> attachment_store_; | 47 const scoped_ptr<AttachmentStore> attachment_store_; |
| 45 // Must be last data member. | 48 // Must be last data member. |
| 46 base::WeakPtrFactory<FakeAttachmentService> weak_ptr_factory_; | 49 base::WeakPtrFactory<FakeAttachmentService> weak_ptr_factory_; |
| 47 | 50 |
| 48 DISALLOW_COPY_AND_ASSIGN(FakeAttachmentService); | 51 DISALLOW_COPY_AND_ASSIGN(FakeAttachmentService); |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 } // namespace syncer | 54 } // namespace syncer |
| 52 | 55 |
| 53 #endif // SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ | 56 #endif // SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_ |
| OLD | NEW |