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

Unified Diff: components/sync/base/sync_prefs.cc

Issue 2395533003: [Sync] Move some things from driver to base. (Closed)
Patch Set: Rebase. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/base/sync_prefs.h ('k') | components/sync/base/sync_prefs_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/base/sync_prefs.cc
diff --git a/components/sync/driver/sync_prefs.cc b/components/sync/base/sync_prefs.cc
similarity index 95%
rename from components/sync/driver/sync_prefs.cc
rename to components/sync/base/sync_prefs.cc
index 540265f9b6ee37a32591a7dad5d8215eb707417a..6f5d5c0c719c2985e90eedc0b9eb10c6fc4e6149 100644
--- a/components/sync/driver/sync_prefs.cc
+++ b/components/sync/base/sync_prefs.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/sync/driver/sync_prefs.h"
+#include "components/sync/base/sync_prefs.h"
#include "base/base64.h"
#include "base/logging.h"
@@ -10,7 +10,7 @@
#include "base/values.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
-#include "components/sync/driver/pref_names.h"
+#include "components/sync/base/pref_names.h"
namespace syncer {
@@ -528,28 +528,22 @@ bool SyncPrefs::GetPassphraseEncryptionTransitionInProgress() const {
prefs::kSyncPassphraseEncryptionTransitionInProgress);
}
-void SyncPrefs::SetSavedNigoriStateForPassphraseEncryptionTransition(
- const SyncEncryptionHandler::NigoriState& nigori_state) {
+void SyncPrefs::SetNigoriSpecificsForPassphraseTransition(
+ const sync_pb::NigoriSpecifics& nigori_specifics) {
std::string encoded;
- base::Base64Encode(nigori_state.nigori_specifics.SerializeAsString(),
- &encoded);
+ base::Base64Encode(nigori_specifics.SerializeAsString(), &encoded);
pref_service_->SetString(prefs::kSyncNigoriStateForPassphraseTransition,
encoded);
}
-std::unique_ptr<SyncEncryptionHandler::NigoriState>
-SyncPrefs::GetSavedNigoriStateForPassphraseEncryptionTransition() const {
+void SyncPrefs::GetNigoriSpecificsForPassphraseTransition(
+ sync_pb::NigoriSpecifics* nigori_specifics) const {
const std::string encoded =
pref_service_->GetString(prefs::kSyncNigoriStateForPassphraseTransition);
std::string decoded;
- if (!base::Base64Decode(encoded, &decoded))
- return std::unique_ptr<SyncEncryptionHandler::NigoriState>();
-
- std::unique_ptr<SyncEncryptionHandler::NigoriState> result(
- new SyncEncryptionHandler::NigoriState());
- if (!result->nigori_specifics.ParseFromString(decoded))
- return std::unique_ptr<SyncEncryptionHandler::NigoriState>();
- return result;
+ if (base::Base64Decode(encoded, &decoded)) {
+ nigori_specifics->ParseFromString(decoded);
+ }
}
} // namespace syncer
« no previous file with comments | « components/sync/base/sync_prefs.h ('k') | components/sync/base/sync_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698