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

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

Issue 1549993003: Switch to standard integer types in components/, part 4 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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_prefs_unittest.cc » ('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/prefs/pref_member.h" 9 #include "base/prefs/pref_member.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 bool SyncPrefs::DidSyncShutdownCleanly() const { 484 bool SyncPrefs::DidSyncShutdownCleanly() const {
485 return pref_service_->GetBoolean(prefs::kSyncShutdownCleanly); 485 return pref_service_->GetBoolean(prefs::kSyncShutdownCleanly);
486 } 486 }
487 487
488 void SyncPrefs::SetCleanShutdown(bool value) { 488 void SyncPrefs::SetCleanShutdown(bool value) {
489 pref_service_->SetBoolean(prefs::kSyncShutdownCleanly, value); 489 pref_service_->SetBoolean(prefs::kSyncShutdownCleanly, value);
490 } 490 }
491 491
492 void SyncPrefs::GetInvalidationVersions( 492 void SyncPrefs::GetInvalidationVersions(
493 std::map<syncer::ModelType, int64>* invalidation_versions) const { 493 std::map<syncer::ModelType, int64_t>* invalidation_versions) const {
494 const base::DictionaryValue* invalidation_dictionary = 494 const base::DictionaryValue* invalidation_dictionary =
495 pref_service_->GetDictionary(prefs::kSyncInvalidationVersions); 495 pref_service_->GetDictionary(prefs::kSyncInvalidationVersions);
496 syncer::ModelTypeSet protocol_types = syncer::ProtocolTypes(); 496 syncer::ModelTypeSet protocol_types = syncer::ProtocolTypes();
497 for (auto iter = protocol_types.First(); iter.Good(); iter.Inc()) { 497 for (auto iter = protocol_types.First(); iter.Good(); iter.Inc()) {
498 std::string key = syncer::ModelTypeToString(iter.Get()); 498 std::string key = syncer::ModelTypeToString(iter.Get());
499 std::string version_str; 499 std::string version_str;
500 if (!invalidation_dictionary->GetString(key, &version_str)) 500 if (!invalidation_dictionary->GetString(key, &version_str))
501 continue; 501 continue;
502 int64 version = 0; 502 int64_t version = 0;
503 if (!base::StringToInt64(version_str, &version)) 503 if (!base::StringToInt64(version_str, &version))
504 continue; 504 continue;
505 (*invalidation_versions)[iter.Get()] = version; 505 (*invalidation_versions)[iter.Get()] = version;
506 } 506 }
507 } 507 }
508 508
509 void SyncPrefs::UpdateInvalidationVersions( 509 void SyncPrefs::UpdateInvalidationVersions(
510 const std::map<syncer::ModelType, int64>& invalidation_versions) { 510 const std::map<syncer::ModelType, int64_t>& invalidation_versions) {
511 scoped_ptr<base::DictionaryValue> invalidation_dictionary( 511 scoped_ptr<base::DictionaryValue> invalidation_dictionary(
512 new base::DictionaryValue()); 512 new base::DictionaryValue());
513 for (const auto& map_iter : invalidation_versions) { 513 for (const auto& map_iter : invalidation_versions) {
514 std::string version_str = base::Int64ToString(map_iter.second); 514 std::string version_str = base::Int64ToString(map_iter.second);
515 invalidation_dictionary->SetString( 515 invalidation_dictionary->SetString(
516 syncer::ModelTypeToString(map_iter.first), version_str); 516 syncer::ModelTypeToString(map_iter.first), version_str);
517 } 517 }
518 pref_service_->Set(prefs::kSyncInvalidationVersions, 518 pref_service_->Set(prefs::kSyncInvalidationVersions,
519 *invalidation_dictionary); 519 *invalidation_dictionary);
520 } 520 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 return scoped_ptr<syncer::SyncEncryptionHandler::NigoriState>(); 555 return scoped_ptr<syncer::SyncEncryptionHandler::NigoriState>();
556 556
557 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> result( 557 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> result(
558 new syncer::SyncEncryptionHandler::NigoriState()); 558 new syncer::SyncEncryptionHandler::NigoriState());
559 if (!result->nigori_specifics.ParseFromString(decoded)) 559 if (!result->nigori_specifics.ParseFromString(decoded))
560 return scoped_ptr<syncer::SyncEncryptionHandler::NigoriState>(); 560 return scoped_ptr<syncer::SyncEncryptionHandler::NigoriState>();
561 return result; 561 return result;
562 } 562 }
563 563
564 } // namespace sync_driver 564 } // namespace sync_driver
OLDNEW
« no previous file with comments | « components/sync_driver/sync_prefs.h ('k') | components/sync_driver/sync_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698