summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authoralbertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-27 22:18:55 +0000
committeralbertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-27 22:18:55 +0000
commit43fe640e64aac277a5e0b28fe6b58d2973164df8 (patch)
tree367962ca89c283d63bb3ef810e6593f3b0317811 /sync
parentcbe30167853f161d2aaa16846d9b8bea16027858 (diff)
downloadchromium_src-43fe640e64aac277a5e0b28fe6b58d2973164df8.zip
chromium_src-43fe640e64aac277a5e0b28fe6b58d2973164df8.tar.gz
chromium_src-43fe640e64aac277a5e0b28fe6b58d2973164df8.tar.bz2
sync: Implementation of Priority Preferences.
Priority preferences are similar to normal preferences but are never encrypted and are synced ahead of other datatypes. Because they're never encrypted, on first sync, they can be synced immediately after login, before the user is prompted for a passphrase. Expected uses of priority preferences include hardware setting (eg. trackpad speed, scroll direction, etc.) as well as settings that could be 2-way synced with existing Google Account settings (eg. language). BUG=168648 Review URL: https://chromiumcodereview.appspot.com/12033093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191047 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/internal_api/public/base/model_type.h12
-rw-r--r--sync/protocol/priority_preference_specifics.proto5
-rw-r--r--sync/protocol/proto_value_conversions.cc15
-rw-r--r--sync/syncable/model_type.cc10
-rw-r--r--sync/tools/testserver/chromiumsync.py8
5 files changed, 32 insertions, 18 deletions
diff --git a/sync/internal_api/public/base/model_type.h b/sync/internal_api/public/base/model_type.h
index ebf7665..92df116 100644
--- a/sync/internal_api/public/base/model_type.h
+++ b/sync/internal_api/public/base/model_type.h
@@ -90,6 +90,9 @@ enum ModelType {
FAVICON_IMAGES,
// Favicon tracking information.
FAVICON_TRACKING,
+ // These preferences are synced before other user types and are never
+ // encrypted.
+ PRIORITY_PREFERENCES,
// ---- Proxy types ----
// Proxy types are excluded from the sync protocol, but are still considered
@@ -113,10 +116,7 @@ enum ModelType {
DEVICE_INFO,
// Flags to enable experimental features.
EXPERIMENTS,
- // These preferences are never encrypted so that they can be applied before
- // the encryption system is fully initialized.
- PRIORITY_PREFERENCES,
- LAST_CONTROL_MODEL_TYPE = PRIORITY_PREFERENCES,
+ LAST_CONTROL_MODEL_TYPE = EXPERIMENTS,
LAST_REAL_MODEL_TYPE = LAST_CONTROL_MODEL_TYPE,
@@ -179,6 +179,10 @@ SYNC_EXPORT bool IsUserSelectableType(ModelType model_type);
// This is the subset of UserTypes() that can be encrypted.
SYNC_EXPORT_PRIVATE ModelTypeSet EncryptableUserTypes();
+// This is the subset of UserTypes() that have priority over other types. These
+// types are synced before other user types and are never encrypted.
+SYNC_EXPORT ModelTypeSet PriorityUserTypes();
+
// Proxy types are placeholder types for handling implicitly enabling real
// types. They do not exist at the server, and are simply used for
// UI/Configuration logic.
diff --git a/sync/protocol/priority_preference_specifics.proto b/sync/protocol/priority_preference_specifics.proto
index e52e0be..97b554e 100644
--- a/sync/protocol/priority_preference_specifics.proto
+++ b/sync/protocol/priority_preference_specifics.proto
@@ -14,8 +14,9 @@ option retain_unknown_fields = true;
package sync_pb;
+import "preference_specifics.proto";
+
// Properties of a synced priority preference.
message PriorityPreferenceSpecifics {
- optional string name = 1;
- optional string value = 2;
+ optional PreferenceSpecifics preference = 1;
}
diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc
index ebb4d95..d102b7c 100644
--- a/sync/protocol/proto_value_conversions.cc
+++ b/sync/protocol/proto_value_conversions.cc
@@ -312,14 +312,6 @@ base::DictionaryValue* BookmarkSpecificsToValue(
return value;
}
-base::DictionaryValue* PriorityPreferenceSpecificsToValue(
- const sync_pb::PriorityPreferenceSpecifics& proto) {
- base::DictionaryValue* value = new base::DictionaryValue();
- SET_STR(name);
- SET_STR(value);
- return value;
-}
-
base::DictionaryValue* DeviceInfoSpecificsToValue(
const sync_pb::DeviceInfoSpecifics& proto) {
base::DictionaryValue* value = new base::DictionaryValue();
@@ -450,6 +442,13 @@ base::DictionaryValue* PreferenceSpecificsToValue(
return value;
}
+base::DictionaryValue* PriorityPreferenceSpecificsToValue(
+ const sync_pb::PriorityPreferenceSpecifics& specifics) {
+ base::DictionaryValue* value = new base::DictionaryValue();
+ SET_FIELD(preference, PreferenceSpecificsToValue);
+ return value;
+}
+
base::DictionaryValue* SyncedNotificationSpecificsToValue(
const sync_pb::SyncedNotificationSpecifics& proto) {
base::DictionaryValue* value = new base::DictionaryValue();
diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc
index 37bdd36..31120a7 100644
--- a/sync/syncable/model_type.cc
+++ b/sync/syncable/model_type.cc
@@ -353,6 +353,9 @@ ModelTypeSet EncryptableUserTypes() {
encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES);
// Synced notifications are not encrypted since the server must see changes.
encryptable_user_types.Remove(SYNCED_NOTIFICATIONS);
+ // Priority preferences are not encrypted because they might be synced before
+ // encryption is ready.
+ encryptable_user_types.RemoveAll(PriorityUserTypes());
// Proxy types have no sync representation and are therefore not encrypted.
// Note however that proxy types map to one or more protocol types, which
// may or may not be encrypted themselves.
@@ -360,6 +363,10 @@ ModelTypeSet EncryptableUserTypes() {
return encryptable_user_types;
}
+ModelTypeSet PriorityUserTypes() {
+ return ModelTypeSet(PRIORITY_PREFERENCES);
+}
+
ModelTypeSet ControlTypes() {
ModelTypeSet set;
// TODO(sync): We should be able to build the actual enumset's internal
@@ -369,9 +376,6 @@ ModelTypeSet ControlTypes() {
set.Put(ModelTypeFromInt(i));
}
- // TODO(albertb): Re-enable this when the server supports it.
- set.Remove(PRIORITY_PREFERENCES);
-
return set;
}
diff --git a/sync/tools/testserver/chromiumsync.py b/sync/tools/testserver/chromiumsync.py
index d33ed01..06dfa40 100644
--- a/sync/tools/testserver/chromiumsync.py
+++ b/sync/tools/testserver/chromiumsync.py
@@ -34,6 +34,7 @@ import history_delete_directive_specifics_pb2
import nigori_specifics_pb2
import password_specifics_pb2
import preference_specifics_pb2
+import priority_preference_specifics_pb2
import search_engine_specifics_pb2
import session_specifics_pb2
import sync_pb2
@@ -62,6 +63,7 @@ ALL_TYPES = (
NIGORI,
PASSWORD,
PREFERENCE,
+ PRIORITY_PREFERENCE,
SEARCH_ENGINE,
SESSION,
SYNCED_NOTIFICATION,
@@ -69,7 +71,7 @@ ALL_TYPES = (
TYPED_URL,
EXTENSION_SETTINGS,
FAVICON_IMAGES,
- FAVICON_TRACKING) = range(23)
+ FAVICON_TRACKING) = range(24)
# An enumeration on the frequency at which the server should send errors
# to the client. This would be specified by the url that triggers the error.
@@ -103,6 +105,7 @@ SYNC_TYPE_TO_DESCRIPTOR = {
NIGORI: SYNC_TYPE_FIELDS['nigori'],
PASSWORD: SYNC_TYPE_FIELDS['password'],
PREFERENCE: SYNC_TYPE_FIELDS['preference'],
+ PRIORITY_PREFERENCE: SYNC_TYPE_FIELDS['priority_preference'],
SEARCH_ENGINE: SYNC_TYPE_FIELDS['search_engine'],
SESSION: SYNC_TYPE_FIELDS['session'],
SYNCED_NOTIFICATION: SYNC_TYPE_FIELDS["synced_notification"],
@@ -494,6 +497,9 @@ class SyncDataModel(object):
parent_tag=ROOT_ID, sync_type=PASSWORD),
PermanentItem('google_chrome_preferences', name='Preferences',
parent_tag=ROOT_ID, sync_type=PREFERENCE),
+ PermanentItem('google_chrome_priority_preferences',
+ name='Priority Preferences',
+ parent_tag=ROOT_ID, sync_type=PRIORITY_PREFERENCE),
PermanentItem('google_chrome_synced_notifications',
name='Synced Notifications',
parent_tag=ROOT_ID, sync_type=SYNCED_NOTIFICATION),