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

Side by Side Diff: components/sync_driver/sync_prefs.cc

Issue 1907683003: Convert //components/sync_driver from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix, address feedback Created 4 years, 8 months 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
« no previous file with comments | « components/sync_driver/sync_prefs.h ('k') | components/sync_driver/sync_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_driver/sync_prefs.h" 5 #include "components/sync_driver/sync_prefs.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 continue; 491 continue;
492 int64_t version = 0; 492 int64_t version = 0;
493 if (!base::StringToInt64(version_str, &version)) 493 if (!base::StringToInt64(version_str, &version))
494 continue; 494 continue;
495 (*invalidation_versions)[iter.Get()] = version; 495 (*invalidation_versions)[iter.Get()] = version;
496 } 496 }
497 } 497 }
498 498
499 void SyncPrefs::UpdateInvalidationVersions( 499 void SyncPrefs::UpdateInvalidationVersions(
500 const std::map<syncer::ModelType, int64_t>& invalidation_versions) { 500 const std::map<syncer::ModelType, int64_t>& invalidation_versions) {
501 scoped_ptr<base::DictionaryValue> invalidation_dictionary( 501 std::unique_ptr<base::DictionaryValue> invalidation_dictionary(
502 new base::DictionaryValue()); 502 new base::DictionaryValue());
503 for (const auto& map_iter : invalidation_versions) { 503 for (const auto& map_iter : invalidation_versions) {
504 std::string version_str = base::Int64ToString(map_iter.second); 504 std::string version_str = base::Int64ToString(map_iter.second);
505 invalidation_dictionary->SetString( 505 invalidation_dictionary->SetString(
506 syncer::ModelTypeToString(map_iter.first), version_str); 506 syncer::ModelTypeToString(map_iter.first), version_str);
507 } 507 }
508 pref_service_->Set(prefs::kSyncInvalidationVersions, 508 pref_service_->Set(prefs::kSyncInvalidationVersions,
509 *invalidation_dictionary); 509 *invalidation_dictionary);
510 } 510 }
511 511
(...skipping 17 matching lines...) Expand all
529 529
530 void SyncPrefs::SetSavedNigoriStateForPassphraseEncryptionTransition( 530 void SyncPrefs::SetSavedNigoriStateForPassphraseEncryptionTransition(
531 const syncer::SyncEncryptionHandler::NigoriState& nigori_state) { 531 const syncer::SyncEncryptionHandler::NigoriState& nigori_state) {
532 std::string encoded; 532 std::string encoded;
533 base::Base64Encode(nigori_state.nigori_specifics.SerializeAsString(), 533 base::Base64Encode(nigori_state.nigori_specifics.SerializeAsString(),
534 &encoded); 534 &encoded);
535 pref_service_->SetString(prefs::kSyncNigoriStateForPassphraseTransition, 535 pref_service_->SetString(prefs::kSyncNigoriStateForPassphraseTransition,
536 encoded); 536 encoded);
537 } 537 }
538 538
539 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> 539 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>
540 SyncPrefs::GetSavedNigoriStateForPassphraseEncryptionTransition() const { 540 SyncPrefs::GetSavedNigoriStateForPassphraseEncryptionTransition() const {
541 const std::string encoded = 541 const std::string encoded =
542 pref_service_->GetString(prefs::kSyncNigoriStateForPassphraseTransition); 542 pref_service_->GetString(prefs::kSyncNigoriStateForPassphraseTransition);
543 std::string decoded; 543 std::string decoded;
544 if (!base::Base64Decode(encoded, &decoded)) 544 if (!base::Base64Decode(encoded, &decoded))
545 return scoped_ptr<syncer::SyncEncryptionHandler::NigoriState>(); 545 return std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>();
546 546
547 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> result( 547 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> result(
548 new syncer::SyncEncryptionHandler::NigoriState()); 548 new syncer::SyncEncryptionHandler::NigoriState());
549 if (!result->nigori_specifics.ParseFromString(decoded)) 549 if (!result->nigori_specifics.ParseFromString(decoded))
550 return scoped_ptr<syncer::SyncEncryptionHandler::NigoriState>(); 550 return std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>();
551 return result; 551 return result;
552 } 552 }
553 553
554 } // namespace sync_driver 554 } // namespace sync_driver
OLDNEW
« no previous file with comments | « components/sync_driver/sync_prefs.h ('k') | components/sync_driver/sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698