diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-24 22:03:57 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-24 22:03:57 +0000 |
commit | ffa6f5975ce23dbd97f9300c97b46d3c0f29605b (patch) | |
tree | ed9b5c8b6427eb37ce66165dd4a20dad359cf469 | |
parent | 38cc5ad9ecc757db16a5e97c2fd0e6a1713ba86c (diff) | |
download | chromium_src-ffa6f5975ce23dbd97f9300c97b46d3c0f29605b.zip chromium_src-ffa6f5975ce23dbd97f9300c97b46d3c0f29605b.tar.gz chromium_src-ffa6f5975ce23dbd97f9300c97b46d3c0f29605b.tar.bz2 |
Multiprofile: Fix all places where we observe BROWSER_THEME_CHANGED so that we
observe on a specific ThemeService.
BUG=87457
TEST=none
Review URL: http://codereview.chromium.org/7243013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90446 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 31 insertions, 22 deletions
diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 20f7aee..dd24777 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -91,8 +91,10 @@ DevToolsWindow::DevToolsWindow(Profile* profile, registrar_.Add(this, NotificationType::TAB_CLOSING, Source<NavigationController>(&tab_contents_->controller())); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + registrar_.Add( + this, + NotificationType::BROWSER_THEME_CHANGED, + Source<ThemeService>(ThemeServiceFactory::GetForProfile(profile_))); TabContents* tab = inspected_rvh->delegate()->GetAsTabContents(); if (tab) inspected_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc index 07bfccc..040963f 100644 --- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc +++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc @@ -34,7 +34,7 @@ ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( tab_contents_(tab_contents) { theme_service_->OnInfobarDisplayed(); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); } bool ThemeInstalledInfoBarDelegate::MatchesTheme(const Extension* theme) const { diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index e2d117f..a60947f 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -74,6 +74,8 @@ #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" #include "chrome/browser/tabs/tab_finder.h" #include "chrome/browser/tabs/tab_strip_model.h" +#include "chrome/browser/themes/theme_service.h" +#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" @@ -241,8 +243,9 @@ Browser::Browser(Type type, Profile* profile) NotificationService::AllSources()); registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + registrar_.Add( + this, NotificationType::BROWSER_THEME_CHANGED, + Source<ThemeService>(ThemeServiceFactory::GetForProfile(profile_))); registrar_.Add(this, NotificationType::TAB_CONTENT_SETTINGS_CHANGED, NotificationService::AllSources()); registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc index fd7797e..23a97ea 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc @@ -159,7 +159,7 @@ BookmarkBarGtk::BookmarkBarGtk(BrowserWindowGtk* window, UpdateFloatingState(); registrar_.Add(this, NotificationType::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/bookmarks/bookmark_bar_instructions_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc index c2c18d7..b8dc6e9 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc @@ -48,7 +48,7 @@ BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate, NULL); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc index 8934d70..a41f5ae 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc @@ -182,7 +182,7 @@ BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWidget* anchor, G_CALLBACK(&OnRemoveClickedThunk), this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); } diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc index 88fe07a..e9ff2f8 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.cc +++ b/chrome/browser/ui/gtk/browser_titlebar.cc @@ -403,7 +403,7 @@ void BrowserTitlebar::Init() { theme_service_ = GtkThemeService::GetFrom( browser_window_->browser()->profile()); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); UpdateTitleAndIcon(); } diff --git a/chrome/browser/ui/gtk/bubble/bubble_gtk.cc b/chrome/browser/ui/gtk/bubble/bubble_gtk.cc index c803033..e962568 100644 --- a/chrome/browser/ui/gtk/bubble/bubble_gtk.cc +++ b/chrome/browser/ui/gtk/bubble/bubble_gtk.cc @@ -180,7 +180,7 @@ void BubbleGtk::Init(GtkWidget* anchor_widget, } registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); } diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.cc b/chrome/browser/ui/gtk/download/download_item_gtk.cc index c927494..44305cb 100644 --- a/chrome/browser/ui/gtk/download/download_item_gtk.cc +++ b/chrome/browser/ui/gtk/download/download_item_gtk.cc @@ -243,7 +243,7 @@ DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf, } registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); // Set the initial width of the widget to be animated. diff --git a/chrome/browser/ui/gtk/download/download_shelf_gtk.cc b/chrome/browser/ui/gtk/download/download_shelf_gtk.cc index 4f56282..ef8e8d0 100644 --- a/chrome/browser/ui/gtk/download/download_shelf_gtk.cc +++ b/chrome/browser/ui/gtk/download/download_shelf_gtk.cc @@ -143,7 +143,7 @@ DownloadShelfGtk::DownloadShelfGtk(Browser* browser, GtkWidget* parent) theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); gtk_widget_show_all(shelf_.get()); diff --git a/chrome/browser/ui/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc index 8e3be1a..439a815 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.cc +++ b/chrome/browser/ui/gtk/find_bar_gtk.cc @@ -301,7 +301,7 @@ void FindBarGtk::InitWidgets() { theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); g_signal_connect(widget(), "parent-set", G_CALLBACK(OnParentSet), this); diff --git a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc index 949ff62..6ea160a 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc @@ -92,7 +92,7 @@ InfoBarGtk::InfoBarGtk(TabContentsWrapper* owner, InfoBarDelegate* delegate) this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); UpdateBorderColor(); } diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc index d7432fd..062470b 100644 --- a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc +++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc @@ -314,7 +314,7 @@ void BalloonViewImpl::Show(Balloon* balloon) { gtk_box_pack_end(GTK_BOX(hbox_), options_alignment, FALSE, FALSE, 0); notification_registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); // We don't do InitThemesFor() because it just forces a redraw. gtk_util::ActAsRoundedWindow(frame_container_, gtk_util::kGdkBlack, 3, diff --git a/chrome/browser/ui/gtk/overflow_button.cc b/chrome/browser/ui/gtk/overflow_button.cc index d1e57bd..b37005c 100644 --- a/chrome/browser/ui/gtk/overflow_button.cc +++ b/chrome/browser/ui/gtk/overflow_button.cc @@ -17,9 +17,10 @@ OverflowButton::OverflowButton(Profile* profile) : profile_(profile) { widget_.Own(GtkThemeService::GetFrom(profile)->BuildChromeButton()); gtk_widget_set_no_show_all(widget_.get(), TRUE); + GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); - GtkThemeService::GetFrom(profile)->InitThemesFor(this); + Source<ThemeService>(theme_service)); + theme_service->InitThemesFor(this); } OverflowButton::~OverflowButton() { diff --git a/chrome/browser/ui/gtk/status_bubble_gtk.cc b/chrome/browser/ui/gtk/status_bubble_gtk.cc index 059329f..de16765 100644 --- a/chrome/browser/ui/gtk/status_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/status_bubble_gtk.cc @@ -50,7 +50,7 @@ StatusBubbleGtk::StatusBubbleGtk(Profile* profile) theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); } StatusBubbleGtk::~StatusBubbleGtk() { diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index a883702..1ca5784 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -707,7 +707,7 @@ TabStripGtk::TabStripGtk(TabStripModel* model, BrowserWindowGtk* window) hover_tab_selector_(model) { theme_service_->InitThemesFor(this); registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>(theme_service_)); } TabStripGtk::~TabStripGtk() { diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc index 2f52548..f070b153 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc @@ -409,7 +409,8 @@ NewTabUI::NewTabUI(TabContents* contents) // Listen for theme installation. registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>( + ThemeServiceFactory::GetForProfile(GetProfile()))); // Listen for bookmark bar visibility changes. registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, NotificationService::AllSources()); diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index 2b093de..959295c 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc @@ -155,7 +155,8 @@ bool InDateRange(double begin, double end) { NTPResourceCache::NTPResourceCache(Profile* profile) : profile_(profile) { registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, - NotificationService::AllSources()); + Source<ThemeService>( + ThemeServiceFactory::GetForProfile(profile))); registrar_.Add(this, NotificationType::PROMO_RESOURCE_STATE_CHANGED, NotificationService::AllSources()); diff --git a/content/common/notification_type.h b/content/common/notification_type.h index 957da92..50e6f76 100644 --- a/content/common/notification_type.h +++ b/content/common/notification_type.h @@ -274,7 +274,8 @@ class NotificationType { // the actual snapshot. TAB_SNAPSHOT_TAKEN, - // The user has changed the browser theme. There are no details. + // The user has changed the browser theme. The source is a + // Source<ThemeService>. There are no details. BROWSER_THEME_CHANGED, // Sent when the renderer returns focus to the browser, as part of focus |