Add preexisting local extensions to sync bundle when sync is enabled.
BUG=104399
TEST=TwoClientExtensionsSyncTest.UninstallPreinstalledExtensions
Review URL: http://codereview.chromium.org/8889048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114652 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index c5fd28c..12327db4 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1305,6 +1305,7 @@
bundle->sync_processor = sync_processor;
+ // Process extensions from sync.
for (SyncDataList::const_iterator i = initial_sync_data.begin();
i != initial_sync_data.end();
++i) {
@@ -1313,15 +1314,20 @@
ProcessExtensionSyncData(extension_sync_data, *bundle);
}
+ // Process local extensions.
+ // TODO(yoz): Determine whether pending extensions should be considered too.
+ // See crbug.com/104399.
SyncDataList sync_data_list = GetAllSyncData(type);
SyncChangeList sync_change_list;
for (SyncDataList::const_iterator i = sync_data_list.begin();
i != sync_data_list.end();
++i) {
- if (bundle->HasExtensionId(i->GetTag()))
+ if (bundle->HasExtensionId(i->GetTag())) {
sync_change_list.push_back(SyncChange(SyncChange::ACTION_UPDATE, *i));
- else
+ } else {
+ bundle->synced_extensions.insert(i->GetTag());
sync_change_list.push_back(SyncChange(SyncChange::ACTION_ADD, *i));
+ }
}
bundle->sync_processor->ProcessSyncChanges(FROM_HERE, sync_change_list);