Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: components/sync/engine_impl/attachments/attachment_uploader_impl.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/sync/driver/sync_stopped_reporter.cc ('k') | components/sync/engine_impl/sync_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698