diff options
author | petewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 01:00:06 +0000 |
---|---|---|
committer | petewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 01:00:06 +0000 |
commit | 0e90ab01373af01ea3fdc3aa97b5bceaf2e990fa (patch) | |
tree | c3a60f8a3343b88758f736a65632efa6cf1af322 /sync/protocol | |
parent | 04b9a4170fd0692fe38b6202a936faf3c21f2ed5 (diff) | |
download | chromium_src-0e90ab01373af01ea3fdc3aa97b5bceaf2e990fa.zip chromium_src-0e90ab01373af01ea3fdc3aa97b5bceaf2e990fa.tar.gz chromium_src-0e90ab01373af01ea3fdc3aa97b5bceaf2e990fa.tar.bz2 |
New Sync datatype for Synced Notifications App Info
This is the first checkin for creating a new sync datatype for the synced notifications app info. The new datatype will be used for synced notification metadata such as the name and icon of the service sending the synced notification.
BUG=280266
Review URL: https://codereview.chromium.org/143973006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247551 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/protocol')
-rw-r--r-- | sync/protocol/nigori_specifics.proto | 2 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions.cc | 20 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions.h | 7 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions_unittest.cc | 7 | ||||
-rw-r--r-- | sync/protocol/sync.proto | 3 | ||||
-rw-r--r-- | sync/protocol/synced_notification_app_info_specifics.proto | 34 |
6 files changed, 72 insertions, 1 deletions
diff --git a/sync/protocol/nigori_specifics.proto b/sync/protocol/nigori_specifics.proto index 87e6c37..407281f 100644 --- a/sync/protocol/nigori_specifics.proto +++ b/sync/protocol/nigori_specifics.proto @@ -55,6 +55,8 @@ message NigoriSpecifics { // thus can't be encrypted. // Synced Notifications need to be consumed by the server (the read flag) // and thus can't be encrypted. + // Synced Notification App Info is set by the server, and thus cannot be + // encrypted. optional bool encrypt_bookmarks = 13; optional bool encrypt_preferences = 14; optional bool encrypt_autofill_profile = 15; diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc index be639425..cb6c218 100644 --- a/sync/protocol/proto_value_conversions.cc +++ b/sync/protocol/proto_value_conversions.cc @@ -36,6 +36,7 @@ #include "sync/protocol/search_engine_specifics.pb.h" #include "sync/protocol/session_specifics.pb.h" #include "sync/protocol/sync.pb.h" +#include "sync/protocol/synced_notification_app_info_specifics.pb.h" #include "sync/protocol/synced_notification_specifics.pb.h" #include "sync/protocol/theme_specifics.pb.h" #include "sync/protocol/typed_url_specifics.pb.h" @@ -241,6 +242,16 @@ base::DictionaryValue* TimeRangeDirectiveToValue( return value; } +base::DictionaryValue* SyncedNotificationAppInfoToValue( + const sync_pb::SyncedNotificationAppInfo& proto) { + base::DictionaryValue* value = new base::DictionaryValue(); + SET_STR_REP(app_id); + SET_STR(settings_display_name); + SET(icon, SyncedNotificationImageToValue); + // TODO(petewil): Add fields for the monochrome icon when it is available. + return value; +} + base::DictionaryValue* SyncedNotificationImageToValue( const sync_pb::SyncedNotificationImage& proto) { base::DictionaryValue* value = new base::DictionaryValue(); @@ -650,6 +661,13 @@ base::DictionaryValue* PriorityPreferenceSpecificsToValue( return value; } +base::DictionaryValue* SyncedNotificationAppInfoSpecificsToValue( + const sync_pb::SyncedNotificationAppInfoSpecifics& proto) { + base::DictionaryValue* value = new base::DictionaryValue(); + SET_REP(synced_notification_app_info, SyncedNotificationAppInfoToValue); + return value; +} + base::DictionaryValue* SyncedNotificationSpecificsToValue( const sync_pb::SyncedNotificationSpecifics& proto) { // There is a lot of data, for now just use heading, description, key, and @@ -751,6 +769,8 @@ base::DictionaryValue* EntitySpecificsToValue( SET_FIELD(search_engine, SearchEngineSpecificsToValue); SET_FIELD(session, SessionSpecificsToValue); SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue); + SET_FIELD(synced_notification_app_info, + SyncedNotificationAppInfoSpecificsToValue); SET_FIELD(theme, ThemeSpecificsToValue); SET_FIELD(typed_url, TypedUrlSpecificsToValue); return value; diff --git a/sync/protocol/proto_value_conversions.h b/sync/protocol/proto_value_conversions.h index 3c8f3d9..d93d5d1 100644 --- a/sync/protocol/proto_value_conversions.h +++ b/sync/protocol/proto_value_conversions.h @@ -64,6 +64,8 @@ class SyncAttachmentId; class SyncCycleCompletedEventInfo; class SyncedNotification; class SyncedNotificationAction; +class SyncedNotificationAppInfo; +class SyncedNotificationAppInfoSpecifics; class SyncedNotificationDestination; class SyncedNotificationImage; class SyncedNotificationProfileImage; @@ -249,6 +251,11 @@ SYNC_EXPORT_PRIVATE base::DictionaryValue* PasswordSpecificsToValue( SYNC_EXPORT_PRIVATE base::DictionaryValue* PreferenceSpecificsToValue( const sync_pb::PreferenceSpecifics& password_specifics); +SYNC_EXPORT_PRIVATE base::DictionaryValue* + SyncedNotificationAppInfoSpecificsToValue( + const sync_pb::SyncedNotificationAppInfoSpecifics& + synced_notification_specifics); + SYNC_EXPORT_PRIVATE base::DictionaryValue* SyncedNotificationSpecificsToValue( const sync_pb::SyncedNotificationSpecifics& synced_notification_specifics); diff --git a/sync/protocol/proto_value_conversions_unittest.cc b/sync/protocol/proto_value_conversions_unittest.cc index 11c9674..dd3a701 100644 --- a/sync/protocol/proto_value_conversions_unittest.cc +++ b/sync/protocol/proto_value_conversions_unittest.cc @@ -55,7 +55,7 @@ TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) { // If this number changes, that means we added or removed a data // type. Don't forget to add a unit test for {New // type}SpecificsToValue below. - EXPECT_EQ(31, MODEL_TYPE_COUNT); + EXPECT_EQ(32, MODEL_TYPE_COUNT); // We'd also like to check if we changed any field in our messages. // However, that's hard to do: sizeof could work, but it's @@ -236,6 +236,10 @@ TEST_F(ProtoValueConversionsTest, SessionSpecificsToValue) { TestSpecificsToValue(SessionSpecificsToValue); } +TEST_F(ProtoValueConversionsTest, SyncedNotificationAppInfoSpecificsToValue) { + TestSpecificsToValue(SyncedNotificationAppInfoSpecificsToValue); +} + TEST_F(ProtoValueConversionsTest, SyncedNotificationSpecificsToValue) { TestSpecificsToValue(SyncedNotificationSpecificsToValue); } @@ -290,6 +294,7 @@ TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) { SET_FIELD(search_engine); SET_FIELD(session); SET_FIELD(synced_notification); + SET_FIELD(synced_notification_app_info); SET_FIELD(theme); SET_FIELD(typed_url); diff --git a/sync/protocol/sync.proto b/sync/protocol/sync.proto index d5fc00c..55bc9b3 100644 --- a/sync/protocol/sync.proto +++ b/sync/protocol/sync.proto @@ -44,6 +44,7 @@ import "priority_preference_specifics.proto"; import "search_engine_specifics.proto"; import "session_specifics.proto"; import "sync_enums.proto"; +import "synced_notification_app_info_specifics.proto"; import "synced_notification_specifics.proto"; import "theme_specifics.proto"; import "typed_url_specifics.proto"; @@ -114,6 +115,8 @@ message EntitySpecifics { optional AppSettingSpecifics app_setting = 103656; optional HistoryDeleteDirectiveSpecifics history_delete_directive = 150251; optional SyncedNotificationSpecifics synced_notification = 153108; + optional SyncedNotificationAppInfoSpecifics synced_notification_app_info = + 235816; optional DeviceInfoSpecifics device_info = 154522; optional ExperimentsSpecifics experiments = 161496; optional PriorityPreferenceSpecifics priority_preference = 163425; diff --git a/sync/protocol/synced_notification_app_info_specifics.proto b/sync/protocol/synced_notification_app_info_specifics.proto new file mode 100644 index 0000000..22bb4d2 --- /dev/null +++ b/sync/protocol/synced_notification_app_info_specifics.proto @@ -0,0 +1,34 @@ +// Copyright 2014 Google Inc. All Rights Reserved. +// +// Sync protocol datatype extension for appInfo objects. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +import "synced_notification_render.proto"; + +message SyncedNotificationAppInfoSpecifics { + // Information of the list of apps we know about. + // NOTE: This may not be the comprehensive list of apps that send + // notifications. At best, it will contain all the first party apps and + // paging support is not needed. + // This is a static list sent from the server that is read only on the client. + repeated SyncedNotificationAppInfo synced_notification_app_info = 1; +} + +message SyncedNotificationAppInfo { + // The application ID of a subservice within the notification sending service. + repeated string app_id = 1; + + // The name to use in the settings screen for this app. + optional string settings_display_name = 2; + + // The icon to use. The URL of the icon may point to a + // hi-res image, so clients should always size the image to the + // preferred width and height specified in the Image proto. + optional SyncedNotificationImage icon = 3; +}
\ No newline at end of file |