Commit a58f599c authored by akalin@chromium.org's avatar akalin@chromium.org

Notify the ThemeService on extension install and not extension load

This is a speculative fix for the startup regression introduced by
169875.

Also fix a bug in GtkThemeService where use_gtk_ wasn't being set
to false if a custom theme was installed before the ThemeService
was created.

BUG=163706
TBR=estade@chromium.org

Review URL: https://chromiumcodereview.appspot.com/11421191

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170640 0039d316-1c4b-4281-b951-d872f2087c98
parent 17b946c2
...@@ -1034,11 +1034,7 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { ...@@ -1034,11 +1034,7 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) {
// extension. // extension.
system_->RegisterExtensionWithRequestContexts(extension); system_->RegisterExtensionWithRequestContexts(extension);
if (extension->is_theme()) { if (!extension->is_theme()) {
#if defined(ENABLE_THEMES)
ThemeServiceFactory::SetThemeForProfile(profile_, extension);
#endif
} else {
// Tell renderers about non-theme extensions (renderers don't need // Tell renderers about non-theme extensions (renderers don't need
// to know about themes). // to know about themes).
for (content::RenderProcessHost::iterator i( for (content::RenderProcessHost::iterator i(
...@@ -2114,6 +2110,13 @@ void ExtensionService::AddExtension(const Extension* extension) { ...@@ -2114,6 +2110,13 @@ void ExtensionService::AddExtension(const Extension* extension) {
SyncExtensionChangeIfNeeded(*extension); SyncExtensionChangeIfNeeded(*extension);
NotifyExtensionLoaded(extension); NotifyExtensionLoaded(extension);
DoPostLoadTasks(extension); DoPostLoadTasks(extension);
#if defined(ENABLE_THEMES)
if (extension->is_theme()) {
// Notify the ThemeService about the newly-installed theme.
ThemeServiceFactory::SetThemeForProfile(profile_, extension);
}
#endif
} }
void ExtensionService::AddComponentExtension(const Extension* extension) { void ExtensionService::AddComponentExtension(const Extension* extension) {
......
...@@ -294,7 +294,6 @@ void GtkThemeService::Init(Profile* profile) { ...@@ -294,7 +294,6 @@ void GtkThemeService::Init(Profile* profile) {
registrar_.Add(prefs::kUsesSystemTheme, registrar_.Add(prefs::kUsesSystemTheme,
base::Bind(&GtkThemeService::OnUsesSystemThemeChanged, base::Bind(&GtkThemeService::OnUsesSystemThemeChanged,
base::Unretained(this))); base::Unretained(this)));
use_gtk_ = profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
ThemeService::Init(profile); ThemeService::Init(profile);
} }
...@@ -620,6 +619,14 @@ void GtkThemeService::ClearAllThemeData() { ...@@ -620,6 +619,14 @@ void GtkThemeService::ClearAllThemeData() {
} }
void GtkThemeService::LoadThemePrefs() { void GtkThemeService::LoadThemePrefs() {
if (ThemeService::UsingDefaultTheme()) {
use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
} else {
// Do this here since ThemeServiceFactory::SetThemeForProfile()
// doesn't know to set kUsesSystemTheme to false.
profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false);
use_gtk_ = false;
}
if (use_gtk_) { if (use_gtk_) {
LoadGtkValues(); LoadGtkValues();
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment