OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ |
6 #define CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ | 6 #define CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 // Load theme data from preferences, possibly picking colors from GTK. | 124 // Load theme data from preferences, possibly picking colors from GTK. |
125 virtual void LoadThemePrefs(); | 125 virtual void LoadThemePrefs(); |
126 | 126 |
127 // Let all the browser views know that themes have changed. | 127 // Let all the browser views know that themes have changed. |
128 virtual void NotifyThemeChanged(Extension* extension); | 128 virtual void NotifyThemeChanged(Extension* extension); |
129 | 129 |
130 // Additionally frees the CairoCachedSurfaces. | 130 // Additionally frees the CairoCachedSurfaces. |
131 virtual void FreePlatformCaches(); | 131 virtual void FreePlatformCaches(); |
132 | 132 |
133 // Handles signal from GTK that our theme has been changed. | |
134 static void OnStyleSet(GtkWidget* widget, | |
135 GtkStyle* previous_style, | |
136 GtkThemeProvider* provider); | |
137 | |
138 // Extracts colors and tints from the GTK theme, both for the | 133 // Extracts colors and tints from the GTK theme, both for the |
139 // BrowserThemeProvider interface and the colors we send to webkit. | 134 // BrowserThemeProvider interface and the colors we send to webkit. |
140 void LoadGtkValues(); | 135 void LoadGtkValues(); |
141 | 136 |
142 // Sets the values that we send to webkit to safe defaults. | 137 // Sets the values that we send to webkit to safe defaults. |
143 void LoadDefaultValues(); | 138 void LoadDefaultValues(); |
144 | 139 |
145 // Sets the underlying theme colors/tints from a GTK color. | 140 // Sets the underlying theme colors/tints from a GTK color. |
146 void SetThemeColorFromGtk(int id, const GdkColor* color); | 141 void SetThemeColorFromGtk(int id, const GdkColor* color); |
147 void SetThemeTintFromGtk(int id, const GdkColor* color); | 142 void SetThemeTintFromGtk(int id, const GdkColor* color); |
(...skipping 23 matching lines...) Expand all Loading... |
171 // background color. | 166 // background color. |
172 void GetNormalButtonTintHSL(color_utils::HSL* tint) const; | 167 void GetNormalButtonTintHSL(color_utils::HSL* tint) const; |
173 | 168 |
174 // Returns a tint that's the color of the current normal text in an entry. | 169 // Returns a tint that's the color of the current normal text in an entry. |
175 void GetNormalEntryForegroundHSL(color_utils::HSL* tint) const; | 170 void GetNormalEntryForegroundHSL(color_utils::HSL* tint) const; |
176 | 171 |
177 // Returns a tint that's the color of the current highlighted text in an | 172 // Returns a tint that's the color of the current highlighted text in an |
178 // entry. | 173 // entry. |
179 void GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const; | 174 void GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const; |
180 | 175 |
| 176 // Handles signal from GTK that our theme has been changed. |
| 177 CHROMEGTK_CALLBACK_1(GtkThemeProvider, void, OnStyleSet, GtkStyle*); |
| 178 |
181 // A notification from the GtkChromeButton GObject destructor that we should | 179 // A notification from the GtkChromeButton GObject destructor that we should |
182 // remove it from our internal list. | 180 // remove it from our internal list. |
183 CHROMEGTK_CALLBACK_0(GtkThemeProvider, void, OnDestroyChromeButton); | 181 CHROMEGTK_CALLBACK_0(GtkThemeProvider, void, OnDestroyChromeButton); |
184 | 182 |
185 CHROMEGTK_CALLBACK_1(GtkThemeProvider, gboolean, OnSeparatorExpose, | 183 CHROMEGTK_CALLBACK_1(GtkThemeProvider, gboolean, OnSeparatorExpose, |
186 GdkEventExpose*); | 184 GdkEventExpose*); |
187 | 185 |
188 // Whether we should be using gtk rendering. | 186 // Whether we should be using gtk rendering. |
189 bool use_gtk_; | 187 bool use_gtk_; |
190 | 188 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 236 |
239 // The default folder icon and default bookmark icon for the GTK theme. | 237 // The default folder icon and default bookmark icon for the GTK theme. |
240 // These are static because the system can only have one theme at a time. | 238 // These are static because the system can only have one theme at a time. |
241 // They are cached when they are requested the first time, and cleared when | 239 // They are cached when they are requested the first time, and cleared when |
242 // the system theme changes. | 240 // the system theme changes. |
243 static GdkPixbuf* default_folder_icon_; | 241 static GdkPixbuf* default_folder_icon_; |
244 static GdkPixbuf* default_bookmark_icon_; | 242 static GdkPixbuf* default_bookmark_icon_; |
245 }; | 243 }; |
246 | 244 |
247 #endif // CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ | 245 #endif // CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ |
OLD | NEW |