diff options
-rw-r--r-- | sync/protocol/proto_value_conversions.cc | 37 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions.h | 18 |
2 files changed, 52 insertions, 3 deletions
diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc index c145269..21db7b2 100644 --- a/sync/protocol/proto_value_conversions.cc +++ b/sync/protocol/proto_value_conversions.cc @@ -240,8 +240,36 @@ base::DictionaryValue* TimeRangeDirectiveToValue( return value; } -// TODO(petewil): I will need new functions here for the SyncedNotifications -// subtypes. +base::DictionaryValue* SimpleCollapsedLayoutToValue( + const sync_pb::SimpleCollapsedLayout& proto) { + base::DictionaryValue* value = new base::DictionaryValue(); + SET_STR(heading); + SET_STR(description); + return value; +} + +base::DictionaryValue* CollapsedInfoToValue( + const sync_pb::CollapsedInfo& proto) { + base::DictionaryValue* value = new base::DictionaryValue(); + SET(simple_collapsed_layout, SimpleCollapsedLayoutToValue); + return value; +} + +base::DictionaryValue* RenderInfoToValue( + const sync_pb::SyncedNotificationRenderInfo& proto) { + base::DictionaryValue* value = new base::DictionaryValue(); + SET(collapsed_info, CollapsedInfoToValue); + return value; +} + +base::DictionaryValue* CoalescedNotificationToValue( + const sync_pb::CoalescedSyncedNotification& proto) { + base::DictionaryValue* value = new base::DictionaryValue(); + SET_STR(key); + SET_INT32(read_state); + SET(render_info, RenderInfoToValue); + return value; +} base::DictionaryValue* AppNotificationToValue( const sync_pb::AppNotification& proto) { @@ -488,8 +516,11 @@ base::DictionaryValue* PriorityPreferenceSpecificsToValue( base::DictionaryValue* SyncedNotificationSpecificsToValue( const sync_pb::SyncedNotificationSpecifics& proto) { + // There is a lot of data, for now just use heading, description, key, and + // the read state. + // TODO(petewil): Eventually add more data here. base::DictionaryValue* value = new base::DictionaryValue(); - // TODO(petewil): Adjust this once we add actual types in protobuf. + SET(coalesced_notification, CoalescedNotificationToValue); return value; } diff --git a/sync/protocol/proto_value_conversions.h b/sync/protocol/proto_value_conversions.h index 8bcc26d..39b8e0e 100644 --- a/sync/protocol/proto_value_conversions.h +++ b/sync/protocol/proto_value_conversions.h @@ -24,6 +24,8 @@ class BookmarkSpecifics; class ClientConfigParams; class ClientToServerMessage; class ClientToServerResponse; +class CoalescedSyncedNotification; +class CollapsedInfo; class DatatypeAssociationStats; class DebugEventInfo; class DebugInfo; @@ -53,7 +55,9 @@ class SessionHeader; class SessionSpecifics; class SessionTab; class SessionWindow; +class SimpleCollapsedLayout; class SyncCycleCompletedEventInfo; +class SyncedNotificationRenderInfo; class SyncedNotificationSpecifics; class TabNavigation; class ThemeSpecifics; @@ -120,6 +124,20 @@ base::DictionaryValue* TimeRangeDirectiveToValue( base::DictionaryValue* KeystoreEncryptionToValue( const sync_pb::KeystoreEncryptionFlagsSpecifics& proto); +// Sub protocols of SyncedNotifications. + +base::DictionaryValue* SimpleCollapsedLayoutToValue( + const sync_pb::SimpleCollapsedLayout& proto); + +base::DictionaryValue* CollapsedInfoToValue( + const sync_pb::CollapsedInfo& proto); + +base::DictionaryValue* RenderInfoToValue( + const sync_pb::SyncedNotificationRenderInfo& proto); + +base::DictionaryValue* CoalescedNotificationToValue( + const sync_pb::CoalescedSyncedNotification& proto); + // Main *SpecificsToValue functions. SYNC_EXPORT_PRIVATE base::DictionaryValue* AppNotificationToValue( |