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/bookmark_bar_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/bookmark_bar_gtk.h')
-rw-r--r-- | chrome/browser/gtk/bookmark_bar_gtk.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.h b/chrome/browser/gtk/bookmark_bar_gtk.h index f179b15..102a646 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk.h +++ b/chrome/browser/gtk/bookmark_bar_gtk.h @@ -10,8 +10,10 @@ #include <string> #include "app/slide_animation.h" -#include "chrome/common/owned_widget_gtk.h" #include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" +#include "chrome/common/owned_widget_gtk.h" class BookmarkContextMenu; class BookmarkMenuController; @@ -21,10 +23,11 @@ class CustomContainerButton; class NineBox; class PageNavigator; class Profile; -struct GtkThemeProperties; +struct GtkThemeProvider; class BookmarkBarGtk : public AnimationDelegate, - public BookmarkModelObserver { + public BookmarkModelObserver, + public NotificationObserver { public: explicit BookmarkBarGtk(Profile* profile, Browser* browser, BrowserWindowGtk* window); @@ -68,9 +71,6 @@ class BookmarkBarGtk : public AnimationDelegate, // Returns true if the bookmarks bar preference is set to 'always show'. bool IsAlwaysShown(); - // Alerts us that the theme changed, and we might need to change theme images. - void UserChangedTheme(GtkThemeProperties* properties); - // AnimationDelegate implementation ------------------------------------------ virtual void AnimationProgressed(const Animation* animation); virtual void AnimationEnded(const Animation* animation); @@ -120,6 +120,11 @@ class BookmarkBarGtk : public AnimationDelegate, virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, const BookmarkNode* node); + // Overridden from NotificationObserver: + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + GtkWidget* CreateBookmarkButton(const BookmarkNode* node); GtkToolItem* CreateBookmarkToolItem(const BookmarkNode* node); @@ -228,6 +233,9 @@ class BookmarkBarGtk : public AnimationDelegate, // We create a GtkToolbarItem from |dragged_node_| for display. GtkToolItem* toolbar_drop_item_; + // Theme provider for building buttons. + GtkThemeProvider* theme_provider_; + // Whether we should show the instructional text in the bookmark bar. bool show_instructions_; @@ -243,6 +251,8 @@ class BookmarkBarGtk : public AnimationDelegate, scoped_ptr<NineBox> background_ninebox_; scoped_ptr<SlideAnimation> slide_animation_; + + NotificationRegistrar registrar_; }; #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ |