| 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 "sync/internal_api/public/attachments/attachment_downloader_impl.h" | 5 #include "sync/internal_api/public/attachments/attachment_downloader_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
| 10 #include "net/http/http_status_code.h" | 10 #include "net/http/http_status_code.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 const scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>& | 44 const scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>& |
| 45 token_service_provider) | 45 token_service_provider) |
| 46 : OAuth2TokenService::Consumer("attachment-downloader-impl"), | 46 : OAuth2TokenService::Consumer("attachment-downloader-impl"), |
| 47 sync_service_url_(sync_service_url), | 47 sync_service_url_(sync_service_url), |
| 48 url_request_context_getter_(url_request_context_getter), | 48 url_request_context_getter_(url_request_context_getter), |
| 49 account_id_(account_id), | 49 account_id_(account_id), |
| 50 oauth2_scopes_(scopes), | 50 oauth2_scopes_(scopes), |
| 51 token_service_provider_(token_service_provider) { | 51 token_service_provider_(token_service_provider) { |
| 52 DCHECK(!account_id.empty()); | 52 DCHECK(!account_id.empty()); |
| 53 DCHECK(!scopes.empty()); | 53 DCHECK(!scopes.empty()); |
| 54 DCHECK(token_service_provider_); | 54 DCHECK(token_service_provider_.get()); |
| 55 DCHECK(url_request_context_getter_); | 55 DCHECK(url_request_context_getter_.get()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 AttachmentDownloaderImpl::~AttachmentDownloaderImpl() { | 58 AttachmentDownloaderImpl::~AttachmentDownloaderImpl() { |
| 59 } | 59 } |
| 60 | 60 |
| 61 void AttachmentDownloaderImpl::DownloadAttachment( | 61 void AttachmentDownloaderImpl::DownloadAttachment( |
| 62 const AttachmentId& attachment_id, | 62 const AttachmentId& attachment_id, |
| 63 const DownloadCallback& callback) { | 63 const DownloadCallback& callback) { |
| 64 DCHECK(CalledOnValidThread()); | 64 DCHECK(CalledOnValidThread()); |
| 65 | 65 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 attachment.reset(new Attachment(Attachment::CreateWithId( | 193 attachment.reset(new Attachment(Attachment::CreateWithId( |
| 194 download_state.attachment_id, attachment_data))); | 194 download_state.attachment_id, attachment_data))); |
| 195 } | 195 } |
| 196 | 196 |
| 197 base::MessageLoop::current()->PostTask( | 197 base::MessageLoop::current()->PostTask( |
| 198 FROM_HERE, base::Bind(*iter, result, base::Passed(&attachment))); | 198 FROM_HERE, base::Bind(*iter, result, base::Passed(&attachment))); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace syncer | 202 } // namespace syncer |
| OLD | NEW |