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

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: add test for invalid value, make tests actually check things 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..411a2965df91e54c1b7921d841b71521999bc630 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,21 @@ 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());
+ sync_pb::AppSpecifics::LaunchType sync_launch_type =
+ static_cast<sync_pb::AppSpecifics::LaunchType>(launch_type_);
+
+ if (launch_type_ >= extensions::LAUNCH_TYPE_FIRST &&
+ launch_type_ < extensions::NUM_LAUNCH_TYPES &&
+ sync_pb::AppSpecifics_LaunchType_IsValid(sync_launch_type)) {
+ specifics->set_launch_type(sync_launch_type);
+ }
+
extension_sync_data_.PopulateExtensionSpecifics(
specifics->mutable_extension());
}
@@ -67,6 +78,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