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/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 188 matching lines...) Loading... |
199 } else if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID) { | 199 } else if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID) { |
200 result = DOWNLOAD_TRANSIENT_ERROR; | 200 result = DOWNLOAD_TRANSIENT_ERROR; |
201 } | 201 } |
202 ReportResult(download_state, result, attachment_data); | 202 ReportResult(download_state, result, attachment_data); |
203 state_map_.erase(iter); | 203 state_map_.erase(iter); |
204 } | 204 } |
205 | 205 |
206 scoped_ptr<net::URLFetcher> AttachmentDownloaderImpl::CreateFetcher( | 206 scoped_ptr<net::URLFetcher> AttachmentDownloaderImpl::CreateFetcher( |
207 const AttachmentUrl& url, | 207 const AttachmentUrl& url, |
208 const std::string& access_token) { | 208 const std::string& access_token) { |
209 scoped_ptr<net::URLFetcher> url_fetcher( | 209 scoped_ptr<net::URLFetcher> url_fetcher = |
210 net::URLFetcher::Create(GURL(url), net::URLFetcher::GET, this)); | 210 net::URLFetcher::Create(GURL(url), net::URLFetcher::GET, this); |
211 AttachmentUploaderImpl::ConfigureURLFetcherCommon( | 211 AttachmentUploaderImpl::ConfigureURLFetcherCommon( |
212 url_fetcher.get(), access_token, raw_store_birthday_, model_type_, | 212 url_fetcher.get(), access_token, raw_store_birthday_, model_type_, |
213 url_request_context_getter_.get()); | 213 url_request_context_getter_.get()); |
214 return url_fetcher.Pass(); | 214 return url_fetcher.Pass(); |
215 } | 215 } |
216 | 216 |
217 void AttachmentDownloaderImpl::RequestAccessToken( | 217 void AttachmentDownloaderImpl::RequestAccessToken( |
218 DownloadState* download_state) { | 218 DownloadState* download_state) { |
219 requests_waiting_for_access_token_.push_back(download_state); | 219 requests_waiting_for_access_token_.push_back(download_state); |
220 // Start access token request if there is no active one. | 220 // Start access token request if there is no active one. |
(...skipping 56 matching lines...) Loading... |
277 | 277 |
278 if (crc32c_raw.size() != sizeof(*crc32c)) | 278 if (crc32c_raw.size() != sizeof(*crc32c)) |
279 return false; | 279 return false; |
280 | 280 |
281 *crc32c = | 281 *crc32c = |
282 base::NetToHost32(*reinterpret_cast<const uint32_t*>(crc32c_raw.c_str())); | 282 base::NetToHost32(*reinterpret_cast<const uint32_t*>(crc32c_raw.c_str())); |
283 return true; | 283 return true; |
284 } | 284 } |
285 | 285 |
286 } // namespace syncer | 286 } // namespace syncer |
OLD | NEW |