Index: chrome/browser/profiles/profile_impl.cc |
=================================================================== |
--- chrome/browser/profiles/profile_impl.cc (revision 75613) |
+++ chrome/browser/profiles/profile_impl.cc (working copy) |
@@ -282,9 +282,17 @@ |
file_util::CreateDirectory(base_cache_path_); |
// Listen for theme installations from our original profile. |
- registrar_.Add(this, NotificationType::THEME_INSTALLED, |
+ registrar_.Add(this, NotificationType::EXTENSION_INSTALLED, |
Source<Profile>(GetOriginalProfile())); |
+ registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, |
+ Source<Profile>(GetOriginalProfile())); |
+ // Once the extensions system is ready, we want to listen to EXTENSION_LOADED |
+ // events (they get sent for enabled extensions during startup). |
+ registrar_.Add(this, NotificationType::EXTENSIONS_READY, |
+ Source<Profile>(GetOriginalProfile())); |
+ |
+ |
#if !defined(OS_CHROMEOS) |
// Listen for bookmark model load, to bootstrap the sync service. |
// On CrOS sync service will be initialized after sign in. |
@@ -1279,10 +1287,27 @@ |
clear_local_state_on_exit_); |
} |
} |
- } else if (NotificationType::THEME_INSTALLED == type) { |
+ } else if (NotificationType::EXTENSIONS_READY == type) { |
+ registrar_.Add(this, NotificationType::EXTENSION_LOADED, |
+ Source<Profile>(GetOriginalProfile())); |
+ } else if (NotificationType::EXTENSION_INSTALLED == type) { |
DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile()); |
const Extension* extension = Details<const Extension>(details).ptr(); |
- SetTheme(extension); |
+ if (extension->is_theme()) |
+ SetTheme(extension); |
+ } else if (NotificationType::EXTENSION_LOADED == type) { |
+ DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile()); |
+ const Extension* extension = Details<const Extension>(details).ptr(); |
+ if (extension->is_theme() && |
+ extension->id() != GetThemeProvider()->GetThemeID()) |
+ SetTheme(extension); |
+ } else if (NotificationType::EXTENSION_UNLOADED == type) { |
+ DCHECK_EQ(Source<Profile>(source).ptr(), GetOriginalProfile()); |
+ UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr(); |
+ const Extension* extension = info->extension; |
+ if (extension->id() == GetThemeProvider()->GetThemeID() && |
+ info->reason != UnloadedExtensionInfo::UPDATE) |
+ ClearTheme(); |
} else if (NotificationType::BOOKMARK_MODEL_LOADED == type) { |
GetProfileSyncService(); // Causes lazy-load if sync is enabled. |
registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED, |