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

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

Issue 8333021: Fix a crash in PageActionImageView when extensions are reloaded due to incognito settings changing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
===================================================================
--- chrome/browser/extensions/extension_service.cc (revision 107550)
+++ chrome/browser/extensions/extension_service.cc (working copy)
@@ -1711,7 +1711,7 @@
namespace {
bool IsSyncableNone(const Extension& extension) { return false; }
-} // namespace
+} // namespace
ExtensionService::SyncBundle::SyncBundle()
: filter(IsSyncableNone),
@@ -1942,14 +1942,6 @@
return;
}
- // Set user settings.
- if (extension_sync_data.enabled()) {
- EnableExtension(id);
- } else {
- DisableExtension(id);
- }
- SetIsIncognitoEnabled(id, extension_sync_data.incognito_enabled());
Finnur 2011/10/27 15:23:32 I had to move this down to the bottom of the funct
akalin 2011/10/31 20:26:49 I'd prefer leaving this block as is, but caching a
-
if (extension) {
// If the extension is already installed, check if it's outdated.
int result = extension->version()->CompareTo(extension_sync_data.version());
@@ -1977,6 +1969,14 @@
bundle.pending_sync_data[extension_sync_data.id()] = extension_sync_data;
CheckForUpdatesSoon();
}
+
+ // Set user settings.
+ if (extension_sync_data.enabled()) {
+ EnableExtension(id);
+ } else {
+ DisableExtension(id);
+ }
+ SetIsIncognitoEnabled(id, extension_sync_data.incognito_enabled());
}
bool ExtensionService::IsIncognitoEnabled(
@@ -2009,17 +2009,10 @@
extension_prefs_->SetIsIncognitoEnabled(extension_id, enabled);
- // If the extension is enabled (and not terminated), unload and
- // reload it to update UI.
- const Extension* enabled_extension = GetExtensionById(extension_id, false);
- if (enabled_extension) {
- NotifyExtensionUnloaded(
- enabled_extension, extension_misc::UNLOAD_REASON_DISABLE);
- NotifyExtensionLoaded(enabled_extension);
- }
-
- if (extension)
- SyncExtensionChangeIfNeeded(*extension);
Finnur 2011/10/27 15:23:32 These last two lines are not needed because Reload
+ bool extension_is_enabled = std::find(extensions_.begin(), extensions_.end(),
+ extension) != extensions_.end();
+ if (extension_is_enabled)
+ ReloadExtension(extension->id());
}
bool ExtensionService::CanCrossIncognito(const Extension* extension) {

Powered by Google App Engine
This is Rietveld 408576698