diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-13 23:23:08 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-13 23:23:08 +0000 |
commit | 5fdafb2f68bd61ef92d10194402348d1e5839015 (patch) | |
tree | fb8583216c733e2a2218501646cf8c72fec35bb1 /chrome/browser/gtk/status_bubble_gtk.h | |
parent | 0735266658f996210b6f43142ce7f4c55f47ae13 (diff) | |
download | chromium_src-5fdafb2f68bd61ef92d10194402348d1e5839015.zip chromium_src-5fdafb2f68bd61ef92d10194402348d1e5839015.tar.gz chromium_src-5fdafb2f68bd61ef92d10194402348d1e5839015.tar.bz2 |
GTK Themes: Refactored to use notifications instead of manual plumbing.
- Removes large amounts of plumbing because:
- All GtkChromeButtons are constructed from GtkThemeProvider which keeps a reference to all live buttons and sends them theme change notifications.
- CustomDrawButtons now subscribe themselves to the BROWSER_THEME_CHANGED notification; this gets rid of a LOT of plubming.
- Removes the GtkThemeProperties struct; just pass the theme provider around.
- Move all the constants from the themes namespace to class statics, per tony's suggestion
Review URL: http://codereview.chromium.org/149547
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/status_bubble_gtk.h')
-rw-r--r-- | chrome/browser/gtk/status_bubble_gtk.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/chrome/browser/gtk/status_bubble_gtk.h b/chrome/browser/gtk/status_bubble_gtk.h index 0ede1f9..f5847aa 100644 --- a/chrome/browser/gtk/status_bubble_gtk.h +++ b/chrome/browser/gtk/status_bubble_gtk.h @@ -12,9 +12,11 @@ #include "base/scoped_ptr.h" #include "base/task.h" #include "chrome/browser/status_bubble.h" +#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" #include "chrome/common/owned_widget_gtk.h" -class GtkThemeProperties; +class GtkThemeProvider; class GURL; class Profile; @@ -22,9 +24,10 @@ class Profile; // doesn't have the nice leave-the-window effect since we can't rely on the // window manager to not try to be "helpful" and center our popups, etc. // We therefore position it absolutely in a GtkFixed, that we don't own. -class StatusBubbleGtk : public StatusBubble { +class StatusBubbleGtk : public StatusBubble, + public NotificationObserver { public: - StatusBubbleGtk(Profile* profile); + explicit StatusBubbleGtk(Profile* profile); virtual ~StatusBubbleGtk(); // StatusBubble implementation. @@ -38,14 +41,16 @@ class StatusBubbleGtk : public StatusBubble { // the download shelf, when it is visible. virtual void UpdateDownloadShelfVisibility(bool visible) { } + // Overridden from NotificationObserver: + void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + // Top of the widget hierarchy for a StatusBubble. This top level widget is // guarenteed to have its gtk_widget_name set to "status-bubble" for // identification. GtkWidget* widget() { return container_.get(); } - // Notification from the window that we should retheme ourself. - void UserChangedTheme(GtkThemeProperties* properties); - private: // Sets the text of the label widget and controls visibility. (As contrasted // with setting the current status or URL text, which may be ignored for now). @@ -61,6 +66,14 @@ class StatusBubbleGtk : public StatusBubble { // Builds the widgets, containers, etc. void InitWidgets(); + // Notification from the window that we should retheme ourself. + void UserChangedTheme(); + + NotificationRegistrar registrar_; + + // Provides colors. + GtkThemeProvider* theme_provider_; + // A GtkAlignment that is the child of |slide_widget_|. OwnedWidgetGtk container_; |