| 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 COMPONENTS_SYNC_MODEL_IMPL_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_IMPL_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
| 6 #define COMPONENTS_SYNC_MODEL_IMPL_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 6 #define COMPONENTS_SYNC_MODEL_IMPL_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/sequence_checker.h" |
| 15 #include "components/sync/engine/attachments/attachment_downloader.h" | 15 #include "components/sync/engine/attachments/attachment_downloader.h" |
| 16 #include "components/sync/engine/attachments/attachment_uploader.h" | 16 #include "components/sync/engine/attachments/attachment_uploader.h" |
| 17 #include "components/sync/model/attachments/attachment_service.h" | 17 #include "components/sync/model/attachments/attachment_service.h" |
| 18 #include "components/sync/model/attachments/attachment_service_proxy.h" | 18 #include "components/sync/model/attachments/attachment_service_proxy.h" |
| 19 #include "components/sync/model/attachments/attachment_store.h" | 19 #include "components/sync/model/attachments/attachment_store.h" |
| 20 #include "components/sync/model_impl/attachments/task_queue.h" | 20 #include "components/sync/model_impl/attachments/task_queue.h" |
| 21 #include "net/base/network_change_notifier.h" | 21 #include "net/base/network_change_notifier.h" |
| 22 | 22 |
| 23 namespace syncer { | 23 namespace syncer { |
| 24 | 24 |
| 25 // Implementation of AttachmentService. | 25 // Implementation of AttachmentService. |
| 26 class AttachmentServiceImpl | 26 class AttachmentServiceImpl |
| 27 : public AttachmentService, | 27 : public AttachmentService, |
| 28 public net::NetworkChangeNotifier::NetworkChangeObserver, | 28 public net::NetworkChangeNotifier::NetworkChangeObserver { |
| 29 public base::NonThreadSafe { | |
| 30 public: | 29 public: |
| 31 // |attachment_store| is required. UploadAttachments reads attachment data | 30 // |attachment_store| is required. UploadAttachments reads attachment data |
| 32 // from it. Downloaded attachments will be written into it. | 31 // from it. Downloaded attachments will be written into it. |
| 33 // | 32 // |
| 34 // |attachment_uploader| is optional. If null, attachments will never be | 33 // |attachment_uploader| is optional. If null, attachments will never be |
| 35 // uploaded to the sync server and |delegate|'s OnAttachmentUploaded will | 34 // uploaded to the sync server and |delegate|'s OnAttachmentUploaded will |
| 36 // never be invoked. | 35 // never be invoked. |
| 37 // | 36 // |
| 38 // |attachment_downloader| is optional. If null, attachments will never be | 37 // |attachment_downloader| is optional. If null, attachments will never be |
| 39 // downloaded. Only attachments in |attachment_store| will be returned from | 38 // downloaded. Only attachments in |attachment_store| will be returned from |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const std::unique_ptr<AttachmentUploader> attachment_uploader_; | 102 const std::unique_ptr<AttachmentUploader> attachment_uploader_; |
| 104 | 103 |
| 105 // May be null. | 104 // May be null. |
| 106 const std::unique_ptr<AttachmentDownloader> attachment_downloader_; | 105 const std::unique_ptr<AttachmentDownloader> attachment_downloader_; |
| 107 | 106 |
| 108 // May be null. | 107 // May be null. |
| 109 Delegate* delegate_; | 108 Delegate* delegate_; |
| 110 | 109 |
| 111 std::unique_ptr<TaskQueue<AttachmentId>> upload_task_queue_; | 110 std::unique_ptr<TaskQueue<AttachmentId>> upload_task_queue_; |
| 112 | 111 |
| 112 SEQUENCE_CHECKER(sequence_checker_); |
| 113 |
| 113 // Must be last data member. | 114 // Must be last data member. |
| 114 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; | 115 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; |
| 115 | 116 |
| 116 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); | 117 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 } // namespace syncer | 120 } // namespace syncer |
| 120 | 121 |
| 121 #endif // COMPONENTS_SYNC_MODEL_IMPL_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 122 #endif // COMPONENTS_SYNC_MODEL_IMPL_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
| OLD | NEW |