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

Unified Diff: chrome/browser/extensions/app_sync_data.cc

Issue 93883004: Sync the launch type pref for apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change launch_type to an enum in proto Created 7 years 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
Index: chrome/browser/extensions/app_sync_data.cc
diff --git a/chrome/browser/extensions/app_sync_data.cc b/chrome/browser/extensions/app_sync_data.cc
index f3a817d4bb694894842e166d1d22996a6e203ef5..7e179a96f3c9da2fd2eda5c4909d64406b214ba6 100644
--- a/chrome/browser/extensions/app_sync_data.cc
+++ b/chrome/browser/extensions/app_sync_data.cc
@@ -27,10 +27,12 @@ AppSyncData::AppSyncData(const Extension& extension,
bool enabled,
bool incognito_enabled,
const syncer::StringOrdinal& app_launch_ordinal,
- const syncer::StringOrdinal& page_ordinal)
+ const syncer::StringOrdinal& page_ordinal,
+ extensions::LaunchType launch_type)
: extension_sync_data_(extension, enabled, incognito_enabled),
app_launch_ordinal_(app_launch_ordinal),
- page_ordinal_(page_ordinal) {
+ page_ordinal_(page_ordinal),
+ launch_type_(launch_type) {
}
AppSyncData::~AppSyncData() {}
@@ -51,12 +53,18 @@ syncer::SyncChange AppSyncData::GetSyncChange(
void AppSyncData::PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const {
DCHECK(specifics);
- // Only sync the ordinal values if they are valid.
+ // Only sync the ordinal values and launch type if they are valid.
if (app_launch_ordinal_.IsValid())
specifics->set_app_launch_ordinal(app_launch_ordinal_.ToInternalValue());
if (page_ordinal_.IsValid())
specifics->set_page_ordinal(page_ordinal_.ToInternalValue());
+ if (launch_type_ >= extensions::LAUNCH_TYPE_FIRST &&
+ launch_type_ < extensions::NUM_LAUNCH_TYPES) {
+ specifics->set_launch_type(
+ static_cast<sync_pb::AppSpecifics::LaunchType>(launch_type_));
+ }
+
extension_sync_data_.PopulateExtensionSpecifics(
specifics->mutable_extension());
}
@@ -67,6 +75,10 @@ void AppSyncData::PopulateFromAppSpecifics(
app_launch_ordinal_ = syncer::StringOrdinal(specifics.app_launch_ordinal());
page_ordinal_ = syncer::StringOrdinal(specifics.page_ordinal());
+
+ launch_type_ = specifics.has_launch_type()
+ ? static_cast<extensions::LaunchType>(specifics.launch_type())
+ : LAUNCH_TYPE_INVALID;
}
void AppSyncData::PopulateFromSyncData(const syncer::SyncData& sync_data) {

Powered by Google App Engine
This is Rietveld 408576698