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

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: Rebase and fix compile 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
« no previous file with comments | « chrome/browser/sync/engine/syncapi.h ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncapi.cc
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index ca11c34ca04c7cb2565682bb68211f5462cbfc21..de00056c7332f38e11e22b3ac06050df4c9f9dae 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());
« no previous file with comments | « chrome/browser/sync/engine/syncapi.h ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698