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

Side by Side Diff: components/sync/api_impl/attachments/attachment_service_impl.h

Issue 2399953002: [Sync] Move attachments code out of core/. (Closed)
Patch Set: Address comments. Created 4 years, 2 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
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_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ 5 #ifndef COMPONENTS_SYNC_API_IMPL_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_
6 #define COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ 6 #define COMPONENTS_SYNC_API_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/threading/non_thread_safe.h"
15 #include "components/sync/api/attachments/attachment_service.h"
16 #include "components/sync/api/attachments/attachment_service_proxy.h"
15 #include "components/sync/api/attachments/attachment_store.h" 17 #include "components/sync/api/attachments/attachment_store.h"
16 #include "components/sync/core/attachments/attachment_downloader.h" 18 #include "components/sync/api_impl/attachments/task_queue.h"
17 #include "components/sync/core/attachments/attachment_service.h" 19 #include "components/sync/engine/attachments/attachment_downloader.h"
18 #include "components/sync/core/attachments/attachment_service_proxy.h" 20 #include "components/sync/engine/attachments/attachment_uploader.h"
19 #include "components/sync/core/attachments/attachment_uploader.h"
20 #include "components/sync/core/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 { 29 public base::NonThreadSafe {
30 public: 30 public:
(...skipping 23 matching lines...) Expand all
54 // off. 54 // off.
55 AttachmentServiceImpl( 55 AttachmentServiceImpl(
56 std::unique_ptr<AttachmentStoreForSync> attachment_store, 56 std::unique_ptr<AttachmentStoreForSync> attachment_store,
57 std::unique_ptr<AttachmentUploader> attachment_uploader, 57 std::unique_ptr<AttachmentUploader> attachment_uploader,
58 std::unique_ptr<AttachmentDownloader> attachment_downloader, 58 std::unique_ptr<AttachmentDownloader> attachment_downloader,
59 Delegate* delegate, 59 Delegate* delegate,
60 const base::TimeDelta& initial_backoff_delay, 60 const base::TimeDelta& initial_backoff_delay,
61 const base::TimeDelta& max_backoff_delay); 61 const base::TimeDelta& max_backoff_delay);
62 ~AttachmentServiceImpl() override; 62 ~AttachmentServiceImpl() override;
63 63
64 // Create an AttachmentServiceImpl suitable for use in tests.
65 static std::unique_ptr<AttachmentService> CreateForTest();
66
67 // AttachmentService implementation. 64 // AttachmentService implementation.
68 void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, 65 void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids,
69 const GetOrDownloadCallback& callback) override; 66 const GetOrDownloadCallback& callback) override;
70 void UploadAttachments(const AttachmentIdList& attachment_ids) override; 67 void UploadAttachments(const AttachmentIdList& attachment_ids) override;
71 68
72 // NetworkChangeObserver implementation. 69 // NetworkChangeObserver implementation.
73 void OnNetworkChanged( 70 void OnNetworkChanged(
74 net::NetworkChangeNotifier::ConnectionType type) override; 71 net::NetworkChangeNotifier::ConnectionType type) override;
75 72
76 // Use |timer| in the underlying TaskQueue. 73 // Use |timer| in the underlying TaskQueue.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 std::unique_ptr<TaskQueue<AttachmentId>> upload_task_queue_; 111 std::unique_ptr<TaskQueue<AttachmentId>> upload_task_queue_;
115 112
116 // Must be last data member. 113 // Must be last data member.
117 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; 114 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_;
118 115
119 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); 116 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl);
120 }; 117 };
121 118
122 } // namespace syncer 119 } // namespace syncer
123 120
124 #endif // COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ 121 #endif // COMPONENTS_SYNC_API_IMPL_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « components/sync/api_impl/attachments/DEPS ('k') | components/sync/api_impl/attachments/attachment_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698