From a9f74a6b78ecfb8f868d19d99e43a5679bb95ad4 Mon Sep 17 00:00:00 2001 From: "calamity@chromium.org" Date: Fri, 10 Jan 2014 06:48:36 +0000 Subject: Sync the launch type pref for apps. This CL syncs the launch type pref for apps by adding a property to app_specifics.proto. The sync data is processed in ExtensionSyncService. extensions::SetLaunchType has been changed to take an ExtensionService so that it is able to sync the pref change when a launch type is updated. A value has been added to the LaunchType enum to represent an invalid launch type preference. BUG=181576 TBR=sky@chromium.org Review URL: https://codereview.chromium.org/93883004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244112 0039d316-1c4b-4281-b951-d872f2087c98 --- sync/protocol/app_specifics.proto | 15 +++++++++++++-- sync/protocol/proto_enum_conversions.cc | 12 ++++++++++++ sync/protocol/proto_enum_conversions.h | 5 +++++ sync/protocol/proto_value_conversions.cc | 1 + 4 files changed, 31 insertions(+), 2 deletions(-) (limited to 'sync') diff --git a/sync/protocol/app_specifics.proto b/sync/protocol/app_specifics.proto index a7f09ec..374a219 100644 --- a/sync/protocol/app_specifics.proto +++ b/sync/protocol/app_specifics.proto @@ -47,7 +47,7 @@ message AppSpecifics { optional ExtensionSpecifics extension = 1; // Notification settings. - optional AppNotificationSettings notification_settings = 2; + optional AppNotificationSettings notification_settings = 2; // This controls where on a page this application icon will appear. optional string app_launch_ordinal = 3; @@ -56,5 +56,16 @@ message AppSpecifics { // This values only provide the order within the application pages, not within // all of the panels in the NTP. optional string page_ordinal = 4; -} + // The possible launch types for an app. + // This enum should be kept in sync with extensions::LaunchType. + enum LaunchType { + PINNED = 0; + REGULAR = 1; + FULLSCREEN = 2; + WINDOW = 3; + } + + // This describes how the extension should be launched. + optional LaunchType launch_type = 5; +} diff --git a/sync/protocol/proto_enum_conversions.cc b/sync/protocol/proto_enum_conversions.cc index af95822..c624efe 100644 --- a/sync/protocol/proto_enum_conversions.cc +++ b/sync/protocol/proto_enum_conversions.cc @@ -170,6 +170,18 @@ const char* GetActionString(sync_pb::SyncEnums::Action action) { } +const char* GetLaunchTypeString(sync_pb::AppSpecifics::LaunchType launch_type) { + ASSERT_ENUM_BOUNDS(sync_pb::AppSpecifics, LaunchType, PINNED, WINDOW); + switch (launch_type) { + ENUM_CASE(sync_pb::AppSpecifics, PINNED); + ENUM_CASE(sync_pb::AppSpecifics, REGULAR); + ENUM_CASE(sync_pb::AppSpecifics, FULLSCREEN); + ENUM_CASE(sync_pb::AppSpecifics, WINDOW); + } + NOTREACHED(); + return ""; +} + const char* GetDeviceTypeString( sync_pb::SyncEnums::DeviceType device_type) { ASSERT_ENUM_BOUNDS(sync_pb::SyncEnums, DeviceType, TYPE_WIN, TYPE_TABLET); diff --git a/sync/protocol/proto_enum_conversions.h b/sync/protocol/proto_enum_conversions.h index 6812cb7..224abbc 100644 --- a/sync/protocol/proto_enum_conversions.h +++ b/sync/protocol/proto_enum_conversions.h @@ -9,6 +9,7 @@ #include "sync/base/sync_export.h" #include "sync/protocol/app_list_specifics.pb.h" +#include "sync/protocol/app_specifics.pb.h" #include "sync/protocol/client_debug_info.pb.h" #include "sync/protocol/session_specifics.pb.h" #include "sync/protocol/sync.pb.h" @@ -49,6 +50,10 @@ SYNC_EXPORT_PRIVATE const char* GetErrorTypeString( SYNC_EXPORT_PRIVATE const char* GetActionString( sync_pb::SyncEnums::Action action); +SYNC_EXPORT_PRIVATE const char* GetLaunchTypeString( + sync_pb::AppSpecifics::LaunchType launch_type); + + const char* GetDeviceTypeString(sync_pb::SyncEnums::DeviceType device_type); const char* GetFaviconTypeString(sync_pb::SessionTab::FaviconType favicon_type); diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc index b142919..be639425 100644 --- a/sync/protocol/proto_value_conversions.cc +++ b/sync/protocol/proto_value_conversions.cc @@ -389,6 +389,7 @@ base::DictionaryValue* AppSpecificsToValue( SET(notification_settings, AppSettingsToValue); SET_STR(app_launch_ordinal); SET_STR(page_ordinal); + SET_ENUM(launch_type, GetLaunchTypeString); return value; } -- cgit v1.1