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

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

Issue 1240573012: Extension syncing: Introduce a NeedsSync pref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext_sync_uninstall
Patch Set: (b); hackfix sync_integration_tests 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 4a1919f96453a0140328f7aaa1b20c8cef7b40b0..94c94fd0ea520a682d770420c3796bac62c9d288 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -278,7 +278,6 @@ ExtensionService::ExtensionService(Profile* profile,
system_(extensions::ExtensionSystem::Get(profile)),
extension_prefs_(extension_prefs),
blacklist_(blacklist),
- extension_sync_service_(NULL),
registry_(extensions::ExtensionRegistry::Get(profile)),
pending_extension_manager_(profile),
install_directory_(install_directory),
@@ -776,9 +775,8 @@ bool ExtensionService::UninstallExtension(
// Don't sync the uninstall if we're going to reinstall the extension
// momentarily.
- if (extension_sync_service_ &&
- reason != extensions::UNINSTALL_REASON_REINSTALL) {
- extension_sync_service_->SyncUninstallExtension(*extension);
+ if (reason != extensions::UNINSTALL_REASON_REINSTALL) {
+ ExtensionSyncService::Get(profile_)->SyncUninstallExtension(*extension);
}
delayed_installs_.Remove(extension->id());
@@ -866,8 +864,7 @@ void ExtensionService::EnableExtension(const std::string& extension_id) {
content::Source<Profile>(profile_),
content::Details<const Extension>(extension));
- if (extension_sync_service_)
- extension_sync_service_->SyncEnableExtension(*extension);
+ ExtensionSyncService::Get(profile_)->SyncExtensionChangeIfNeeded(*extension);
}
void ExtensionService::DisableExtension(const std::string& extension_id,
@@ -917,8 +914,7 @@ void ExtensionService::DisableExtension(const std::string& extension_id,
registry_->RemoveTerminated(extension->id());
}
- if (extension_sync_service_)
- extension_sync_service_->SyncDisableExtension(*extension);
+ ExtensionSyncService::Get(profile_)->SyncExtensionChangeIfNeeded(*extension);
}
void ExtensionService::DisableUserExtensions(
@@ -1510,8 +1506,8 @@ void ExtensionService::AddExtension(const Extension* extension) {
} else if (!reloading &&
extension_prefs_->IsExtensionDisabled(extension->id())) {
registry_->AddDisabled(extension);
- if (extension_sync_service_)
- extension_sync_service_->SyncExtensionChangeIfNeeded(*extension);
+ ExtensionSyncService::Get(profile_)->SyncExtensionChangeIfNeeded(
+ *extension);
content::NotificationService::current()->Notify(
extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
content::Source<Profile>(profile_),
@@ -1548,8 +1544,8 @@ void ExtensionService::AddExtension(const Extension* extension) {
}
registry_->AddEnabled(extension);
- if (extension_sync_service_)
- extension_sync_service_->SyncExtensionChangeIfNeeded(*extension);
+ ExtensionSyncService::Get(profile_)->SyncExtensionChangeIfNeeded(
+ *extension);
NotifyExtensionLoaded(extension);
}
system_->runtime_data()->SetBeingUpgraded(extension->id(), false);
@@ -2062,8 +2058,10 @@ void ExtensionService::PromoteEphemeralApp(
registry_->TriggerOnInstalled(extension, true);
- if (!is_from_sync && extension_sync_service_)
- extension_sync_service_->SyncExtensionChangeIfNeeded(*extension);
+ if (!is_from_sync) {
+ ExtensionSyncService::Get(profile_)->SyncExtensionChangeIfNeeded(
+ *extension);
+ }
}
const Extension* ExtensionService::GetPendingExtensionUpdate(

Powered by Google App Engine
This is Rietveld 408576698