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

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

Issue 1236363002: ExtensionSyncService cleanup: process uninstalls in one step (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 5 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_sync_service.h ('k') | chrome/browser/extensions/pending_enables.cc » ('j') | 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 4b55a274842462b0c28d0f5b41721ca68cded36f..33613fe76b5be2c31fb9b20f4842f3e408538206 100644
--- a/chrome/browser/extensions/extension_sync_service.cc
+++ b/chrome/browser/extensions/extension_sync_service.cc
@@ -112,33 +112,26 @@ ExtensionSyncService* ExtensionSyncService::Get(
return ExtensionSyncServiceFactory::GetForBrowserContext(context);
}
-syncer::SyncData ExtensionSyncService::PrepareToSyncUninstallExtension(
- const Extension& extension) {
- // Extract the data we need for sync now, but don't actually sync until we've
- // completed the uninstallation.
+void ExtensionSyncService::SyncUninstallExtension(
+ const extensions::Extension& extension) {
+ if (!extensions::util::ShouldSync(&extension, profile_))
+ return;
+
// TODO(tim): If we get here and IsSyncing is false, this will cause
// "back from the dead" style bugs, because sync will add-back the extension
// that was uninstalled here when MergeDataAndStartSyncing is called.
// See crbug.com/256795.
syncer::ModelType type =
extension.is_app() ? syncer::APPS : syncer::EXTENSIONS;
- const SyncBundle* bundle = GetSyncBundle(type);
- if (extensions::util::ShouldSync(&extension, profile_)) {
- if (bundle->IsSyncing())
- return CreateSyncData(extension).GetSyncData();
+ SyncBundle* bundle = GetSyncBundle(type);
+ if (!bundle->IsSyncing()) {
if (extension_service_->is_ready() && !flare_.is_null())
flare_.Run(type); // Tell sync to start ASAP.
+ return;
}
-
- return syncer::SyncData();
-}
-
-void ExtensionSyncService::ProcessSyncUninstallExtension(
- const std::string& extension_id,
- const syncer::SyncData& sync_data) {
- SyncBundle* bundle = GetSyncBundle(sync_data.GetDataType());
- if (bundle->HasExtensionId(extension_id))
- bundle->PushSyncDeletion(extension_id, sync_data);
+ const std::string& id = extension.id();
+ if (bundle->HasExtensionId(id))
+ bundle->PushSyncDeletion(id, CreateSyncData(extension).GetSyncData());
}
void ExtensionSyncService::SyncEnableExtension(const Extension& extension) {
@@ -166,7 +159,7 @@ void ExtensionSyncService::SyncExtensionChangeIfNeeded(
extension.is_app() ? syncer::APPS : syncer::EXTENSIONS;
SyncBundle* bundle = GetSyncBundle(type);
if (bundle->IsSyncing())
- bundle->PushSyncChangeIfNeeded(extension);
+ bundle->PushSyncAddOrUpdate(extension);
else if (extension_service_->is_ready() && !flare_.is_null())
flare_.Run(type);
}
« no previous file with comments | « chrome/browser/extensions/extension_sync_service.h ('k') | chrome/browser/extensions/pending_enables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698