| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_GTK_GTK_THEME_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_THEME_SERVICE_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ | 6 #define CHROME_BROWSER_UI_GTK_THEME_SERVICE_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/prefs/pref_change_registrar.h" | 14 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 15 #include "chrome/browser/themes/theme_service.h" | 15 #include "chrome/browser/themes/theme_service.h" |
| 16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 } | 30 } |
| 31 | 31 |
| 32 typedef struct _GdkDisplay GdkDisplay; | 32 typedef struct _GdkDisplay GdkDisplay; |
| 33 typedef struct _GdkEventExpose GdkEventExpose; | 33 typedef struct _GdkEventExpose GdkEventExpose; |
| 34 typedef struct _GdkPixbuf GdkPixbuf; | 34 typedef struct _GdkPixbuf GdkPixbuf; |
| 35 typedef struct _GtkIconSet GtkIconSet; | 35 typedef struct _GtkIconSet GtkIconSet; |
| 36 typedef struct _GtkStyle GtkStyle; | 36 typedef struct _GtkStyle GtkStyle; |
| 37 typedef struct _GtkWidget GtkWidget; | 37 typedef struct _GtkWidget GtkWidget; |
| 38 | 38 |
| 39 // Specialization of ThemeService which supplies system colors. | 39 // Specialization of ThemeService which supplies system colors. |
| 40 class GtkThemeService : public ThemeService { | 40 class ThemeServiceGtk : public ThemeService { |
| 41 public: | 41 public: |
| 42 // A list of integer keys for a separate PerDisplaySurfaceMap that keeps | 42 // A list of integer keys for a separate PerDisplaySurfaceMap that keeps |
| 43 // what would otherwise be static icons on the X11 server. | 43 // what would otherwise be static icons on the X11 server. |
| 44 enum CairoDefaultIcon { | 44 enum CairoDefaultIcon { |
| 45 NATIVE_FAVICON = 1, | 45 NATIVE_FAVICON = 1, |
| 46 CHROME_FAVICON, | 46 CHROME_FAVICON, |
| 47 NATIVE_FOLDER, | 47 NATIVE_FOLDER, |
| 48 CHROME_FOLDER | 48 CHROME_FOLDER |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // Returns GtkThemeService, casted from our superclass. | 51 // Returns ThemeServiceGtk, casted from our superclass. |
| 52 static GtkThemeService* GetFrom(Profile* profile); | 52 static ThemeServiceGtk* GetFrom(Profile* profile); |
| 53 | 53 |
| 54 GtkThemeService(); | 54 ThemeServiceGtk(); |
| 55 virtual ~GtkThemeService(); | 55 virtual ~ThemeServiceGtk(); |
| 56 | 56 |
| 57 // Calls |observer|.Observe() for the browser theme with this provider as the | 57 // Calls |observer|.Observe() for the browser theme with this provider as the |
| 58 // source. | 58 // source. |
| 59 void InitThemesFor(content::NotificationObserver* observer); | 59 void InitThemesFor(content::NotificationObserver* observer); |
| 60 | 60 |
| 61 // Overridden from ThemeService: | 61 // Overridden from ThemeService: |
| 62 // | 62 // |
| 63 // Sets that we aren't using the system theme, then calls | 63 // Sets that we aren't using the system theme, then calls |
| 64 // ThemeService's implementation. | 64 // ThemeService's implementation. |
| 65 virtual void Init(Profile* profile) OVERRIDE; | 65 virtual void Init(Profile* profile) OVERRIDE; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 void GetNormalButtonTintHSL(color_utils::HSL* tint) const; | 218 void GetNormalButtonTintHSL(color_utils::HSL* tint) const; |
| 219 | 219 |
| 220 // Returns a tint that's the color of the current normal text in an entry. | 220 // Returns a tint that's the color of the current normal text in an entry. |
| 221 void GetNormalEntryForegroundHSL(color_utils::HSL* tint) const; | 221 void GetNormalEntryForegroundHSL(color_utils::HSL* tint) const; |
| 222 | 222 |
| 223 // Returns a tint that's the color of the current highlighted text in an | 223 // Returns a tint that's the color of the current highlighted text in an |
| 224 // entry. | 224 // entry. |
| 225 void GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const; | 225 void GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const; |
| 226 | 226 |
| 227 // Handles signal from GTK that our theme has been changed. | 227 // Handles signal from GTK that our theme has been changed. |
| 228 CHROMEGTK_CALLBACK_1(GtkThemeService, void, OnStyleSet, GtkStyle*); | 228 CHROMEGTK_CALLBACK_1(ThemeServiceGtk, void, OnStyleSet, GtkStyle*); |
| 229 | 229 |
| 230 // A notification from various GObject destructors that we should | 230 // A notification from various GObject destructors that we should |
| 231 // remove it from our internal list. | 231 // remove it from our internal list. |
| 232 CHROMEGTK_CALLBACK_0(GtkThemeService, void, OnDestroyChromeButton); | 232 CHROMEGTK_CALLBACK_0(ThemeServiceGtk, void, OnDestroyChromeButton); |
| 233 CHROMEGTK_CALLBACK_0(GtkThemeService, void, OnDestroyChromeLinkButton); | 233 CHROMEGTK_CALLBACK_0(ThemeServiceGtk, void, OnDestroyChromeLinkButton); |
| 234 CHROMEGTK_CALLBACK_0(GtkThemeService, void, OnDestroyLabel); | 234 CHROMEGTK_CALLBACK_0(ThemeServiceGtk, void, OnDestroyLabel); |
| 235 | 235 |
| 236 CHROMEGTK_CALLBACK_1(GtkThemeService, gboolean, OnSeparatorExpose, | 236 CHROMEGTK_CALLBACK_1(ThemeServiceGtk, gboolean, OnSeparatorExpose, |
| 237 GdkEventExpose*); | 237 GdkEventExpose*); |
| 238 | 238 |
| 239 // Whether we should be using gtk rendering. | 239 // Whether we should be using gtk rendering. |
| 240 bool use_gtk_; | 240 bool use_gtk_; |
| 241 | 241 |
| 242 // GtkWidgets that exist only so we can look at their properties (and take | 242 // GtkWidgets that exist only so we can look at their properties (and take |
| 243 // their colors). | 243 // their colors). |
| 244 GtkWidget* fake_window_; | 244 GtkWidget* fake_window_; |
| 245 GtkWidget* fake_frame_; | 245 GtkWidget* fake_frame_; |
| 246 ui::OwnedWidgetGtk fake_label_; | 246 ui::OwnedWidgetGtk fake_label_; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 static GtkWidget* icon_widget_; | 294 static GtkWidget* icon_widget_; |
| 295 | 295 |
| 296 // The default folder icon and default bookmark icon for the GTK theme. | 296 // The default folder icon and default bookmark icon for the GTK theme. |
| 297 // These are static because the system can only have one theme at a time. | 297 // These are static because the system can only have one theme at a time. |
| 298 // They are cached when they are requested the first time, and cleared when | 298 // They are cached when they are requested the first time, and cleared when |
| 299 // the system theme changes. | 299 // the system theme changes. |
| 300 static gfx::Image* default_folder_icon_; | 300 static gfx::Image* default_folder_icon_; |
| 301 static gfx::Image* default_bookmark_icon_; | 301 static gfx::Image* default_bookmark_icon_; |
| 302 }; | 302 }; |
| 303 | 303 |
| 304 #endif // CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ | 304 #endif // CHROME_BROWSER_UI_GTK_THEME_SERVICE_GTK_H_ |
| OLD | NEW |