| 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_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const base::TimeDelta& max_backoff_delay); | 55 const base::TimeDelta& max_backoff_delay); |
| 56 ~AttachmentServiceImpl() override; | 56 ~AttachmentServiceImpl() override; |
| 57 | 57 |
| 58 // Create an AttachmentServiceImpl suitable for use in tests. | 58 // Create an AttachmentServiceImpl suitable for use in tests. |
| 59 static scoped_ptr<syncer::AttachmentService> CreateForTest(); | 59 static scoped_ptr<syncer::AttachmentService> CreateForTest(); |
| 60 | 60 |
| 61 // AttachmentService implementation. | 61 // AttachmentService implementation. |
| 62 AttachmentStore* GetStore() override; | 62 AttachmentStore* GetStore() override; |
| 63 void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, | 63 void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, |
| 64 const GetOrDownloadCallback& callback) override; | 64 const GetOrDownloadCallback& callback) override; |
| 65 void DropAttachments(const AttachmentIdList& attachment_ids, | |
| 66 const DropCallback& callback) override; | |
| 67 void UploadAttachments(const AttachmentIdSet& attachment_ids) override; | 65 void UploadAttachments(const AttachmentIdSet& attachment_ids) override; |
| 68 | 66 |
| 69 // NetworkChangeObserver implementation. | 67 // NetworkChangeObserver implementation. |
| 70 void OnNetworkChanged( | 68 void OnNetworkChanged( |
| 71 net::NetworkChangeNotifier::ConnectionType type) override; | 69 net::NetworkChangeNotifier::ConnectionType type) override; |
| 72 | 70 |
| 73 // Use |timer| in the underlying TaskQueue. | 71 // Use |timer| in the underlying TaskQueue. |
| 74 // | 72 // |
| 75 // Used in tests. See also MockTimer. | 73 // Used in tests. See also MockTimer. |
| 76 void SetTimerForTest(scoped_ptr<base::Timer> timer); | 74 void SetTimerForTest(scoped_ptr<base::Timer> timer); |
| 77 | 75 |
| 78 private: | 76 private: |
| 79 class GetOrDownloadState; | 77 class GetOrDownloadState; |
| 80 | 78 |
| 81 void ReadDone(const scoped_refptr<GetOrDownloadState>& state, | 79 void ReadDone(const scoped_refptr<GetOrDownloadState>& state, |
| 82 const AttachmentStore::Result& result, | 80 const AttachmentStore::Result& result, |
| 83 scoped_ptr<AttachmentMap> attachments, | 81 scoped_ptr<AttachmentMap> attachments, |
| 84 scoped_ptr<AttachmentIdList> unavailable_attachment_ids); | 82 scoped_ptr<AttachmentIdList> unavailable_attachment_ids); |
| 85 void WriteDone(const scoped_refptr<GetOrDownloadState>& state, | 83 void WriteDone(const scoped_refptr<GetOrDownloadState>& state, |
| 86 const Attachment& attachment, | 84 const Attachment& attachment, |
| 87 const AttachmentStore::Result& result); | 85 const AttachmentStore::Result& result); |
| 88 void DropDone(const DropCallback& callback, | |
| 89 const AttachmentStore::Result& result); | |
| 90 void UploadDone(const AttachmentUploader::UploadResult& result, | 86 void UploadDone(const AttachmentUploader::UploadResult& result, |
| 91 const AttachmentId& attachment_id); | 87 const AttachmentId& attachment_id); |
| 92 void DownloadDone(const scoped_refptr<GetOrDownloadState>& state, | 88 void DownloadDone(const scoped_refptr<GetOrDownloadState>& state, |
| 93 const AttachmentId& attachment_id, | 89 const AttachmentId& attachment_id, |
| 94 const AttachmentDownloader::DownloadResult& result, | 90 const AttachmentDownloader::DownloadResult& result, |
| 95 scoped_ptr<Attachment> attachment); | 91 scoped_ptr<Attachment> attachment); |
| 96 void BeginUpload(const AttachmentId& attachment_id); | 92 void BeginUpload(const AttachmentId& attachment_id); |
| 97 void ReadDoneNowUpload( | 93 void ReadDoneNowUpload( |
| 98 const AttachmentStore::Result& result, | 94 const AttachmentStore::Result& result, |
| 99 scoped_ptr<AttachmentMap> attachments, | 95 scoped_ptr<AttachmentMap> attachments, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 114 | 110 |
| 115 // Must be last data member. | 111 // Must be last data member. |
| 116 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; | 112 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; |
| 117 | 113 |
| 118 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); | 114 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); |
| 119 }; | 115 }; |
| 120 | 116 |
| 121 } // namespace syncer | 117 } // namespace syncer |
| 122 | 118 |
| 123 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 119 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
| OLD | NEW |