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

Unified Diff: chrome/browser/sync/engine/syncapi.cc

Issue 6995008: Implement new SyncAPI and convert Preferences to it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing file. Also switch to CommitChanges Created 9 years, 7 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
Index: chrome/browser/sync/engine/syncapi.cc
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index 72491200a05f16da6c28f2d5001f67bc24d34604..80a1d1ddd9976ed6c32044e2a43354a53aeb4416 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -409,13 +409,6 @@ const sync_pb::PasswordSpecificsData& BaseNode::GetPasswordSpecifics() const {
return *password_data_;
}
-const sync_pb::PreferenceSpecifics& BaseNode::GetPreferenceSpecifics() const {
- DCHECK_EQ(syncable::PREFERENCES, GetModelType());
- const sync_pb::EntitySpecifics& unencrypted =
- GetUnencryptedSpecifics(GetEntry());
- return unencrypted.GetExtension(sync_pb::preference);
-}
-
const sync_pb::ThemeSpecifics& BaseNode::GetThemeSpecifics() const {
DCHECK_EQ(syncable::THEMES, GetModelType());
const sync_pb::EntitySpecifics& unencrypted =
@@ -444,6 +437,12 @@ const sync_pb::SessionSpecifics& BaseNode::GetSessionSpecifics() const {
return unencrypted.GetExtension(sync_pb::session);
}
+const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const {
+ const sync_pb::EntitySpecifics& unencrypted =
+ GetUnencryptedSpecifics(GetEntry());
+ return unencrypted;
+}
+
syncable::ModelType BaseNode::GetModelType() const {
return GetEntry()->GetModelType();
}
@@ -600,12 +599,6 @@ void WriteNode::SetPasswordSpecifics(
PutPasswordSpecificsAndMarkForSyncing(new_value);
}
-void WriteNode::SetPreferenceSpecifics(
- const sync_pb::PreferenceSpecifics& new_value) {
- DCHECK_EQ(syncable::PREFERENCES, GetModelType());
- PutPreferenceSpecificsAndMarkForSyncing(new_value);
-}
-
void WriteNode::SetThemeSpecifics(
const sync_pb::ThemeSpecifics& new_value) {
DCHECK_EQ(syncable::THEMES, GetModelType());
@@ -618,6 +611,17 @@ void WriteNode::SetSessionSpecifics(
PutSessionSpecificsAndMarkForSyncing(new_value);
}
+void WriteNode::SetEntitySpecifics(
+ const sync_pb::EntitySpecifics& new_value) {
+ syncable::ModelType specifics_type =
+ syncable::GetModelTypeFromSpecifics(new_value);
+ DCHECK_EQ(specifics_type, GetModelType());
+ sync_pb::EntitySpecifics entity_specifics;
+ entity_specifics.CopyFrom(new_value);
+ EncryptIfNecessary(&entity_specifics);
+ PutSpecificsAndMarkForSyncing(entity_specifics);
+}
+
void WriteNode::ResetFromSpecifics() {
sync_pb::EntitySpecifics new_data;
new_data.CopyFrom(GetUnencryptedSpecifics(GetEntry()));
@@ -632,14 +636,6 @@ void WriteNode::PutPasswordSpecificsAndMarkForSyncing(
PutSpecificsAndMarkForSyncing(entity_specifics);
}
-void WriteNode::PutPreferenceSpecificsAndMarkForSyncing(
- const sync_pb::PreferenceSpecifics& new_value) {
- sync_pb::EntitySpecifics entity_specifics;
- entity_specifics.MutableExtension(sync_pb::preference)->CopyFrom(new_value);
- EncryptIfNecessary(&entity_specifics);
- PutSpecificsAndMarkForSyncing(entity_specifics);
-}
-
void WriteNode::SetTypedUrlSpecifics(
const sync_pb::TypedUrlSpecifics& new_value) {
DCHECK_EQ(syncable::TYPED_URLS, GetModelType());

Powered by Google App Engine
This is Rietveld 408576698