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

Unified Diff: chrome/browser/themes/theme_service.cc

Issue 11411330: Have ExtensionService notify ThemeService directly for themes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase on head Created 8 years 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/themes/theme_service.h ('k') | chrome/browser/ui/gtk/gtk_theme_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/themes/theme_service.cc
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index 4dfe640fbaf7bbd21c836b6cce67337c09b33d2a..5457f1bafcaa7c287b0b40c08222dce319ef22c9 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -224,14 +224,6 @@ void ThemeService::Init(Profile* profile) {
DCHECK(CalledOnValidThread());
profile_ = profile;
- // Listen to EXTENSION_LOADED instead of EXTENSION_INSTALLED because
- // the extension cannot yet be found via GetExtensionById() if it is
- // installed but not loaded (which may confuse listeners to
- // BROWSER_THEME_CHANGED).
- registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_LOADED,
- content::Source<Profile>(profile_));
-
LoadThemePrefs();
theme_syncable_service_.reset(new ThemeSyncableService(profile_, this));
@@ -348,6 +340,12 @@ void ThemeService::SetTheme(const Extension* extension) {
DCHECK(extension);
DCHECK(extension->is_theme());
+ if (DCHECK_IS_ON()) {
+ ExtensionService* service =
+ extensions::ExtensionSystem::Get(profile_)->extension_service();
+ DCHECK(service);
+ DCHECK(service->GetExtensionById(extension->id(), false));
+ }
BuildFromExtension(extension);
SaveThemeID(extension->id());
@@ -656,17 +654,6 @@ void ThemeService::FreePlatformCaches() {
}
#endif
-void ThemeService::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED);
- const Extension* extension = content::Details<const Extension>(details).ptr();
- if (!extension->is_theme()) {
- return;
- }
- SetTheme(extension);
-}
-
void ThemeService::SavePackName(const FilePath& pack_path) {
profile_->GetPrefs()->SetFilePath(
prefs::kCurrentThemePackFilename, pack_path);
« no previous file with comments | « chrome/browser/themes/theme_service.h ('k') | chrome/browser/ui/gtk/gtk_theme_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698