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<AttachmentService> AttachmentServiceImpl::CreateForTest() { | 147 std::unique_ptr<syncer::AttachmentService> |
148 std::unique_ptr<AttachmentStore> attachment_store = | 148 AttachmentServiceImpl::CreateForTest() { |
| 149 std::unique_ptr<syncer::AttachmentStore> attachment_store = |
149 AttachmentStore::CreateInMemoryStore(); | 150 AttachmentStore::CreateInMemoryStore(); |
150 std::unique_ptr<AttachmentUploader> attachment_uploader( | 151 std::unique_ptr<AttachmentUploader> attachment_uploader( |
151 new FakeAttachmentUploader); | 152 new FakeAttachmentUploader); |
152 std::unique_ptr<AttachmentDownloader> attachment_downloader( | 153 std::unique_ptr<AttachmentDownloader> attachment_downloader( |
153 new FakeAttachmentDownloader()); | 154 new FakeAttachmentDownloader()); |
154 std::unique_ptr<AttachmentService> attachment_service( | 155 std::unique_ptr<syncer::AttachmentService> attachment_service( |
155 new AttachmentServiceImpl( | 156 new syncer::AttachmentServiceImpl( |
156 attachment_store->CreateAttachmentStoreForSync(), | 157 attachment_store->CreateAttachmentStoreForSync(), |
157 std::move(attachment_uploader), std::move(attachment_downloader), | 158 std::move(attachment_uploader), std::move(attachment_downloader), |
158 NULL, base::TimeDelta(), base::TimeDelta())); | 159 NULL, base::TimeDelta(), base::TimeDelta())); |
159 return attachment_service; | 160 return attachment_service; |
160 } | 161 } |
161 | 162 |
162 void AttachmentServiceImpl::GetOrDownloadAttachments( | 163 void AttachmentServiceImpl::GetOrDownloadAttachments( |
163 const AttachmentIdList& attachment_ids, | 164 const AttachmentIdList& attachment_ids, |
164 const GetOrDownloadCallback& callback) { | 165 const GetOrDownloadCallback& callback) { |
165 DCHECK(CalledOnValidThread()); | 166 DCHECK(CalledOnValidThread()); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 weak_ptr_factory_.GetWeakPtr())); | 321 weak_ptr_factory_.GetWeakPtr())); |
321 } | 322 } |
322 } | 323 } |
323 | 324 |
324 void AttachmentServiceImpl::SetTimerForTest( | 325 void AttachmentServiceImpl::SetTimerForTest( |
325 std::unique_ptr<base::Timer> timer) { | 326 std::unique_ptr<base::Timer> timer) { |
326 upload_task_queue_->SetTimerForTest(std::move(timer)); | 327 upload_task_queue_->SetTimerForTest(std::move(timer)); |
327 } | 328 } |
328 | 329 |
329 } // namespace syncer | 330 } // namespace syncer |
OLD | NEW |