diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-01 21:42:26 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-01 21:42:26 +0000 |
commit | a3845c429cc361407e0d436d7ddba520580ec6bb (patch) | |
tree | 29bd0b6a836e9f5a9b90cce3a4f4e7e3ee65ee10 /chrome/browser | |
parent | 38abf5e539f3a7808c68d46482aecaf1c4d317f5 (diff) | |
download | chromium_src-a3845c429cc361407e0d436d7ddba520580ec6bb.zip chromium_src-a3845c429cc361407e0d436d7ddba520580ec6bb.tar.gz chromium_src-a3845c429cc361407e0d436d7ddba520580ec6bb.tar.bz2 |
Profiles: Listen to a specific ThemeService for BROWSER_THEME_CHANGE notifications.
We don't want to respond to theme change notifications from other profiles.
BUG=87457
TEST=none
Review URL: http://codereview.chromium.org/7532004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94984 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
9 files changed, 21 insertions, 12 deletions
diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc index a1a37fc..5611b0c 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc @@ -451,7 +451,7 @@ BrowserActionsToolbarGtk::BrowserActionsToolbarGtk(Browser* browser) registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); } diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc index f12ab3a..276fe06 100644 --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc @@ -97,9 +97,6 @@ BrowserToolbarGtk::BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window) browser_->command_updater()->AddCommandObserver(IDC_BOOKMARK_PAGE, this); registrar_.Add(this, - chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); - registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, NotificationService::AllSources()); } @@ -121,6 +118,10 @@ void BrowserToolbarGtk::Init(Profile* profile, SetProfile(profile); theme_service_ = GtkThemeService::GetFrom(profile); + registrar_.Add(this, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, + Source<ThemeService>(theme_service_)); + offscreen_entry_.Own(gtk_entry_new()); show_home_button_.Init(prefs::kShowHomeButton, profile->GetPrefs(), this); diff --git a/chrome/browser/ui/gtk/custom_button.cc b/chrome/browser/ui/gtk/custom_button.cc index d34212a..fe2b52a 100644 --- a/chrome/browser/ui/gtk/custom_button.cc +++ b/chrome/browser/ui/gtk/custom_button.cc @@ -41,7 +41,7 @@ CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeService* theme_provider, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_provider)); } else { // Load the button images from the resource bundle. ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -246,7 +246,7 @@ CustomDrawButton::CustomDrawButton(GtkThemeService* theme_provider, theme_service_->InitThemesFor(this); registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_provider)); } CustomDrawButton::CustomDrawButton(GtkThemeService* theme_provider, @@ -264,7 +264,7 @@ CustomDrawButton::CustomDrawButton(GtkThemeService* theme_provider, theme_service_->InitThemesFor(this); registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_provider)); } CustomDrawButton::~CustomDrawButton() { diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index adcd7ab..6bd7fa3 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -333,7 +333,7 @@ void LocationBarViewGtk::Init(bool popup_window_mode) { registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, profile_->GetPrefs(), this); diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc index ff5a7d4..ee77e01 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc @@ -313,7 +313,7 @@ OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); // TODO(erg): There appears to be a bug somewhere in something which shows diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc index 1634b97..838ed9f 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc @@ -406,7 +406,7 @@ void OmniboxViewGtk::Init() { #if !defined(TOOLKIT_VIEWS) registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); #else // Manually invoke SetBaseColor() because TOOLKIT_VIEWS doesn't observe diff --git a/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc index c7bb857..7a52969 100644 --- a/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc +++ b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc @@ -50,6 +50,10 @@ ThemeInstallBubbleViewGtk::ThemeInstallBubbleViewGtk(GtkWidget* parent) InitWidgets(); // Close when theme has been installed. + // + // TODO(erg): At least for version 1 of multiprofiles, we're still going to + // listen to AllSources(). Installing a theme blocks the entire UI thread so + // we won't have another profile trying to install a theme. registrar_.Add( this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index 27050c55..438c021 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -43,6 +43,8 @@ #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" #include "chrome/browser/tab_contents/thumbnail_generator.h" +#include "chrome/browser/themes/theme_service.h" +#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/translate/translate_tab_helper.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" @@ -173,7 +175,8 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents) NotificationService::AllSources()); #if defined(OS_POSIX) && !defined(OS_MACOSX) registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>( + ThemeServiceFactory::GetForProfile(profile()))); #endif // Register for notifications about all interested prefs change. diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc index 46dac94..087c579 100644 --- a/chrome/browser/ui/webui/options/personal_options_handler.cc +++ b/chrome/browser/ui/webui/options/personal_options_handler.cc @@ -355,7 +355,8 @@ void PersonalOptionsHandler::ObserveThemeChanged() { void PersonalOptionsHandler::Initialize() { // Listen for theme installation. registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(ThemeServiceFactory::GetForProfile( + web_ui_->GetProfile()))); registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, NotificationService::AllSources()); ObserveThemeChanged(); |