| 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/engine_impl/attachments/attachment_uploader_impl.h" | 5 #include "components/sync/engine_impl/attachments/attachment_uploader_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 url, url_request_context_getter_, attachment, callback, account_id_, | 325 url, url_request_context_getter_, attachment, callback, account_id_, |
| 326 scopes_, token_service_provider_.get(), raw_store_birthday_, | 326 scopes_, token_service_provider_.get(), raw_store_birthday_, |
| 327 weak_ptr_factory_.GetWeakPtr(), model_type_)); | 327 weak_ptr_factory_.GetWeakPtr(), model_type_)); |
| 328 state_map_[unique_id] = std::move(upload_state); | 328 state_map_[unique_id] = std::move(upload_state); |
| 329 } | 329 } |
| 330 | 330 |
| 331 // Static. | 331 // Static. |
| 332 GURL AttachmentUploaderImpl::GetURLForAttachmentId( | 332 GURL AttachmentUploaderImpl::GetURLForAttachmentId( |
| 333 const GURL& sync_service_url, | 333 const GURL& sync_service_url, |
| 334 const AttachmentId& attachment_id) { | 334 const AttachmentId& attachment_id) { |
| 335 std::string path = sync_service_url.path(); | 335 std::string path = sync_service_url.path().as_string(); |
| 336 if (path.empty() || *path.rbegin() != '/') { | 336 if (path.empty() || *path.rbegin() != '/') { |
| 337 path += '/'; | 337 path += '/'; |
| 338 } | 338 } |
| 339 path += kAttachments; | 339 path += kAttachments; |
| 340 path += attachment_id.GetProto().unique_id(); | 340 path += attachment_id.GetProto().unique_id(); |
| 341 GURL::Replacements replacements; | 341 GURL::Replacements replacements; |
| 342 replacements.SetPathStr(path); | 342 replacements.SetPathStr(path); |
| 343 return sync_service_url.ReplaceComponents(replacements); | 343 return sync_service_url.ReplaceComponents(replacements); |
| 344 } | 344 } |
| 345 | 345 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 "%s: %s", kSyncStoreBirthday, encoded_store_birthday.c_str())); | 389 "%s: %s", kSyncStoreBirthday, encoded_store_birthday.c_str())); |
| 390 | 390 |
| 391 // Use field number to pass ModelType because it's stable and we have server | 391 // Use field number to pass ModelType because it's stable and we have server |
| 392 // code to decode it. | 392 // code to decode it. |
| 393 const int field_number = GetSpecificsFieldNumberFromModelType(model_type); | 393 const int field_number = GetSpecificsFieldNumberFromModelType(model_type); |
| 394 fetcher->AddExtraRequestHeader( | 394 fetcher->AddExtraRequestHeader( |
| 395 base::StringPrintf("%s: %d", kSyncDataTypeId, field_number)); | 395 base::StringPrintf("%s: %d", kSyncDataTypeId, field_number)); |
| 396 } | 396 } |
| 397 | 397 |
| 398 } // namespace syncer | 398 } // namespace syncer |
| OLD | NEW |