Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: chrome/browser/gtk/nine_box.h

Issue 149102: Fix a crash that happens when changing themes. (Closed)
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/gtk/nine_box.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/nine_box.h
diff --git a/chrome/browser/gtk/nine_box.h b/chrome/browser/gtk/nine_box.h
index dfdfafb196b5fdea62fa4d0c505d60262358738f..4ceea5429fcef29865fe9faed34800f58f51626b 100644
--- a/chrome/browser/gtk/nine_box.h
+++ b/chrome/browser/gtk/nine_box.h
@@ -7,6 +7,10 @@
#include <gtk/gtk.h>
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_type.h"
+
class ThemeProvider;
// A NineBox manages a set of source images representing a 3x3 grid, where
@@ -20,7 +24,7 @@ class ThemeProvider;
//
// TODO(port): add support for caching server-side pixmaps of prerendered
// nineboxes.
-class NineBox {
+class NineBox : public NotificationObserver {
public:
// Construct a NineBox with nine images. Images are specified using resource
// ids that will be passed to the resource bundle. Use 0 for no image.
@@ -52,8 +56,20 @@ class NineBox {
// needed).
void ContourWidget(GtkWidget* widget) const;
+ // Provide NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
private:
GdkPixbuf* images_[9];
+
+ // We need to remember the image ids that the user passes in and the theme
+ // provider so we can reload images if the user changes theme.
+ int image_ids_[9];
+ ThemeProvider* theme_provider_;
+
+ // Used to listen for theme change notifications.
+ NotificationRegistrar registrar_;
};
#endif // CHROME_BROWSER_GTK_NINE_BOX_H_
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/gtk/nine_box.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698