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

Side by Side Diff: sync/api/attachments/fake_attachment_service.h

Issue 187303006: Update sync API to support attachments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attachmentapi
Patch Set: Add AttachmentServiceBase allowing us to drop AsWeakPtr and RefCountedThreadSafe from AttachmentServiceProxy. Created 6 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_
6 #define SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "base/threading/non_thread_safe.h"
10 #include "sync/api/attachments/attachment_service.h"
11 #include "sync/api/attachments/attachment_service_base.h"
12 #include "sync/api/attachments/attachment_service_proxy.h"
13 #include "sync/api/attachments/attachment_store.h"
14
15 namespace syncer {
16
17 // A fake implementation of AttachmentService.
18 class SYNC_EXPORT FakeAttachmentService : public AttachmentServiceBase,
19 public base::NonThreadSafe {
20 public:
21 explicit FakeAttachmentService(scoped_ptr<AttachmentStore> attachment_store);
22 virtual ~FakeAttachmentService();
23
24 // Create a FakeAttachmentService suitable for use in tests.
25 static scoped_ptr<syncer::AttachmentServiceBase> CreateForTest();
26
27 // AttachmentService implementation.
28 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids,
29 const GetOrDownloadCallback& callback)
30 OVERRIDE;
31 virtual void DropAttachments(const AttachmentIdList& attachment_ids,
32 const DropCallback& callback) OVERRIDE;
33 virtual void OnSyncDataAdd(const SyncData& sync_data) OVERRIDE;
34 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE;
35 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids,
36 const SyncData& updated_sync_data) OVERRIDE;
37
38 // AttachmentServiceBase implementation.
39 virtual base::WeakPtr<AttachmentServiceBase> AsWeakPtr() OVERRIDE;
40
41 private:
42 const scoped_ptr<AttachmentStore> attachment_store_;
43
44 // Must be last data member.
45 base::WeakPtrFactory<AttachmentServiceBase> weak_ptr_factory_;
46
47 DISALLOW_COPY_AND_ASSIGN(FakeAttachmentService);
48 };
49
50 } // namespace syncer
51
52 #endif // SYNC_API_ATTACHMENTS_FAKE_ATTACHMENT_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698