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_uploader_impl.h" | 5 #include "sync/internal_api/public/attachments/attachment_uploader_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 "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
10 #include "google_apis/gaia/gaia_constants.h" | 10 #include "google_apis/gaia/gaia_constants.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 : OAuth2TokenService::Consumer("attachment-uploader-impl"), | 101 : OAuth2TokenService::Consumer("attachment-uploader-impl"), |
102 upload_url_(upload_url), | 102 upload_url_(upload_url), |
103 url_request_context_getter_(url_request_context_getter), | 103 url_request_context_getter_(url_request_context_getter), |
104 attachment_(attachment), | 104 attachment_(attachment), |
105 user_callbacks_(1, user_callback), | 105 user_callbacks_(1, user_callback), |
106 account_id_(account_id), | 106 account_id_(account_id), |
107 scopes_(scopes), | 107 scopes_(scopes), |
108 token_service_provider_(token_service_provider), | 108 token_service_provider_(token_service_provider), |
109 owner_(owner) { | 109 owner_(owner) { |
110 DCHECK(upload_url_.is_valid()); | 110 DCHECK(upload_url_.is_valid()); |
111 DCHECK(url_request_context_getter_); | 111 DCHECK(url_request_context_getter_.get()); |
112 DCHECK(!account_id_.empty()); | 112 DCHECK(!account_id_.empty()); |
113 DCHECK(!scopes_.empty()); | 113 DCHECK(!scopes_.empty()); |
114 DCHECK(token_service_provider_); | 114 DCHECK(token_service_provider_); |
115 DCHECK(owner_); | 115 DCHECK(owner_); |
116 GetToken(); | 116 GetToken(); |
117 } | 117 } |
118 | 118 |
119 AttachmentUploaderImpl::UploadState::~UploadState() { | 119 AttachmentUploaderImpl::UploadState::~UploadState() { |
120 } | 120 } |
121 | 121 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 const scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>& | 215 const scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>& |
216 token_service_provider) | 216 token_service_provider) |
217 : sync_service_url_(sync_service_url), | 217 : sync_service_url_(sync_service_url), |
218 url_request_context_getter_(url_request_context_getter), | 218 url_request_context_getter_(url_request_context_getter), |
219 account_id_(account_id), | 219 account_id_(account_id), |
220 scopes_(scopes), | 220 scopes_(scopes), |
221 token_service_provider_(token_service_provider) { | 221 token_service_provider_(token_service_provider) { |
222 DCHECK(CalledOnValidThread()); | 222 DCHECK(CalledOnValidThread()); |
223 DCHECK(!account_id.empty()); | 223 DCHECK(!account_id.empty()); |
224 DCHECK(!scopes.empty()); | 224 DCHECK(!scopes.empty()); |
225 DCHECK(token_service_provider_); | 225 DCHECK(token_service_provider_.get()); |
226 } | 226 } |
227 | 227 |
228 AttachmentUploaderImpl::~AttachmentUploaderImpl() { | 228 AttachmentUploaderImpl::~AttachmentUploaderImpl() { |
229 DCHECK(CalledOnValidThread()); | 229 DCHECK(CalledOnValidThread()); |
230 } | 230 } |
231 | 231 |
232 void AttachmentUploaderImpl::UploadAttachment(const Attachment& attachment, | 232 void AttachmentUploaderImpl::UploadAttachment(const Attachment& attachment, |
233 const UploadCallback& callback) { | 233 const UploadCallback& callback) { |
234 DCHECK(CalledOnValidThread()); | 234 DCHECK(CalledOnValidThread()); |
235 const AttachmentId attachment_id = attachment.GetId(); | 235 const AttachmentId attachment_id = attachment.GetId(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 GURL::Replacements replacements; | 269 GURL::Replacements replacements; |
270 replacements.SetPathStr(path); | 270 replacements.SetPathStr(path); |
271 return sync_service_url.ReplaceComponents(replacements); | 271 return sync_service_url.ReplaceComponents(replacements); |
272 } | 272 } |
273 | 273 |
274 void AttachmentUploaderImpl::DeleteUploadStateFor(const UniqueId& unique_id) { | 274 void AttachmentUploaderImpl::DeleteUploadStateFor(const UniqueId& unique_id) { |
275 state_map_.erase(unique_id); | 275 state_map_.erase(unique_id); |
276 } | 276 } |
277 | 277 |
278 } // namespace syncer | 278 } // namespace syncer |
OLD | NEW |