| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | |
| 9 #include <string> | 8 #include <string> |
| 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/base64.h" | 12 #include "base/base64.h" |
| 13 #include "base/base64url.h" | 13 #include "base/base64url.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/metrics/sparse_histogram.h" | 18 #include "base/metrics/sparse_histogram.h" |
| 19 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 // It's stopped so we can't use it. Delete it. | 322 // It's stopped so we can't use it. Delete it. |
| 323 state_map_.erase(iter); | 323 state_map_.erase(iter); |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 | 326 |
| 327 const GURL url = GetURLForAttachmentId(sync_service_url_, attachment_id); | 327 const GURL url = GetURLForAttachmentId(sync_service_url_, attachment_id); |
| 328 scoped_ptr<UploadState> upload_state(new UploadState( | 328 scoped_ptr<UploadState> upload_state(new UploadState( |
| 329 url, url_request_context_getter_, attachment, callback, account_id_, | 329 url, url_request_context_getter_, attachment, callback, account_id_, |
| 330 scopes_, token_service_provider_.get(), raw_store_birthday_, | 330 scopes_, token_service_provider_.get(), raw_store_birthday_, |
| 331 weak_ptr_factory_.GetWeakPtr(), model_type_)); | 331 weak_ptr_factory_.GetWeakPtr(), model_type_)); |
| 332 state_map_.add(unique_id, upload_state.Pass()); | 332 state_map_.add(unique_id, std::move(upload_state)); |
| 333 } | 333 } |
| 334 | 334 |
| 335 // Static. | 335 // Static. |
| 336 GURL AttachmentUploaderImpl::GetURLForAttachmentId( | 336 GURL AttachmentUploaderImpl::GetURLForAttachmentId( |
| 337 const GURL& sync_service_url, | 337 const GURL& sync_service_url, |
| 338 const AttachmentId& attachment_id) { | 338 const AttachmentId& attachment_id) { |
| 339 std::string path = sync_service_url.path(); | 339 std::string path = sync_service_url.path(); |
| 340 if (path.empty() || *path.rbegin() != '/') { | 340 if (path.empty() || *path.rbegin() != '/') { |
| 341 path += '/'; | 341 path += '/'; |
| 342 } | 342 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 "%s: %s", kSyncStoreBirthday, encoded_store_birthday.c_str())); | 393 "%s: %s", kSyncStoreBirthday, encoded_store_birthday.c_str())); |
| 394 | 394 |
| 395 // Use field number to pass ModelType because it's stable and we have server | 395 // Use field number to pass ModelType because it's stable and we have server |
| 396 // code to decode it. | 396 // code to decode it. |
| 397 const int field_number = GetSpecificsFieldNumberFromModelType(model_type); | 397 const int field_number = GetSpecificsFieldNumberFromModelType(model_type); |
| 398 fetcher->AddExtraRequestHeader( | 398 fetcher->AddExtraRequestHeader( |
| 399 base::StringPrintf("%s: %d", kSyncDataTypeId, field_number)); | 399 base::StringPrintf("%s: %d", kSyncDataTypeId, field_number)); |
| 400 } | 400 } |
| 401 | 401 |
| 402 } // namespace syncer | 402 } // namespace syncer |
| OLD | NEW |