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

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 6546072: Clean up how we handle themes in the extensions system and management API.... Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 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/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,
« no previous file with comments | « chrome/browser/extensions/theme_installed_infobar_delegate.cc ('k') | chrome/browser/themes/browser_theme_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698