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

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

Issue 2923013006: [Extensions Sync] Don't apply sync data for unsyncable extensions (Closed)
Patch Set: lazyboy's Created 3 years, 6 months 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
« no previous file with comments | « chrome/browser/extensions/extension_service_sync_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_sync_service.cc
diff --git a/chrome/browser/extensions/extension_sync_service.cc b/chrome/browser/extensions/extension_sync_service.cc
index 4ca790b6f821048ec91bfe2c780a53cb649ed5d3..bc9add5842ea0fcfe94ba609bf65b9bcf6915ec0 100644
--- a/chrome/browser/extensions/extension_sync_service.cc
+++ b/chrome/browser/extensions/extension_sync_service.cc
@@ -317,6 +317,19 @@ ExtensionSyncData ExtensionSyncService::CreateSyncData(
void ExtensionSyncService::ApplySyncData(
const ExtensionSyncData& extension_sync_data) {
+ const std::string& id = extension_sync_data.id();
+ // Note: |extension| may be null if it hasn't been installed yet.
+ const Extension* extension =
+ ExtensionRegistry::Get(profile_)->GetInstalledExtension(id);
+ // If there is an existing extension that shouldn't be sync'd, don't
+ // apply this sync data. This can happen if the local version of an
+ // extension is default-installed, but the sync server has data from another
+ // (non-default-installed) installation. We can't apply the sync data because
+ // it would always override the local state (which would never get sync'd).
+ // See crbug.com/731824.
+ if (extension && !ShouldSync(*extension))
+ return;
+
// Ignore any pref change notifications etc. while we're applying incoming
// sync data, so that we don't end up notifying ourselves.
base::AutoReset<bool> ignore_updates(&ignore_updates_, true);
@@ -328,12 +341,8 @@ void ExtensionSyncService::ApplySyncData(
syncer::ModelType type = extension_sync_data.is_app() ? syncer::APPS
: syncer::EXTENSIONS;
- const std::string& id = extension_sync_data.id();
SyncBundle* bundle = GetSyncBundle(type);
DCHECK(bundle->IsSyncing());
- // Note: |extension| may be null if it hasn't been installed yet.
- const Extension* extension =
- ExtensionRegistry::Get(profile_)->GetInstalledExtension(id);
if (extension && !IsCorrectSyncType(*extension, type)) {
// The installed item isn't the same type as the sync data item, so we need
// to remove the sync data item; otherwise it will be a zombie that will
« no previous file with comments | « chrome/browser/extensions/extension_service_sync_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698