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 #include "components/sync/core/attachments/attachment_service_impl.h" | 5 #include "components/sync/core/attachments/attachment_service_impl.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); | 138 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); |
139 } | 139 } |
140 | 140 |
141 AttachmentServiceImpl::~AttachmentServiceImpl() { | 141 AttachmentServiceImpl::~AttachmentServiceImpl() { |
142 DCHECK(CalledOnValidThread()); | 142 DCHECK(CalledOnValidThread()); |
143 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); | 143 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); |
144 } | 144 } |
145 | 145 |
146 // Static. | 146 // Static. |
147 std::unique_ptr<syncer::AttachmentService> | 147 std::unique_ptr<AttachmentService> AttachmentServiceImpl::CreateForTest() { |
148 AttachmentServiceImpl::CreateForTest() { | 148 std::unique_ptr<AttachmentStore> attachment_store = |
149 std::unique_ptr<syncer::AttachmentStore> attachment_store = | |
150 AttachmentStore::CreateInMemoryStore(); | 149 AttachmentStore::CreateInMemoryStore(); |
151 std::unique_ptr<AttachmentUploader> attachment_uploader( | 150 std::unique_ptr<AttachmentUploader> attachment_uploader( |
152 new FakeAttachmentUploader); | 151 new FakeAttachmentUploader); |
153 std::unique_ptr<AttachmentDownloader> attachment_downloader( | 152 std::unique_ptr<AttachmentDownloader> attachment_downloader( |
154 new FakeAttachmentDownloader()); | 153 new FakeAttachmentDownloader()); |
155 std::unique_ptr<syncer::AttachmentService> attachment_service( | 154 std::unique_ptr<AttachmentService> attachment_service( |
156 new syncer::AttachmentServiceImpl( | 155 new AttachmentServiceImpl( |
157 attachment_store->CreateAttachmentStoreForSync(), | 156 attachment_store->CreateAttachmentStoreForSync(), |
158 std::move(attachment_uploader), std::move(attachment_downloader), | 157 std::move(attachment_uploader), std::move(attachment_downloader), |
159 NULL, base::TimeDelta(), base::TimeDelta())); | 158 NULL, base::TimeDelta(), base::TimeDelta())); |
160 return attachment_service; | 159 return attachment_service; |
161 } | 160 } |
162 | 161 |
163 void AttachmentServiceImpl::GetOrDownloadAttachments( | 162 void AttachmentServiceImpl::GetOrDownloadAttachments( |
164 const AttachmentIdList& attachment_ids, | 163 const AttachmentIdList& attachment_ids, |
165 const GetOrDownloadCallback& callback) { | 164 const GetOrDownloadCallback& callback) { |
166 DCHECK(CalledOnValidThread()); | 165 DCHECK(CalledOnValidThread()); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 weak_ptr_factory_.GetWeakPtr())); | 320 weak_ptr_factory_.GetWeakPtr())); |
322 } | 321 } |
323 } | 322 } |
324 | 323 |
325 void AttachmentServiceImpl::SetTimerForTest( | 324 void AttachmentServiceImpl::SetTimerForTest( |
326 std::unique_ptr<base::Timer> timer) { | 325 std::unique_ptr<base::Timer> timer) { |
327 upload_task_queue_->SetTimerForTest(std::move(timer)); | 326 upload_task_queue_->SetTimerForTest(std::move(timer)); |
328 } | 327 } |
329 | 328 |
330 } // namespace syncer | 329 } // namespace syncer |
OLD | NEW |