| OLD | NEW |
| 1 // Copyright (c) 2012 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_THEME_SERVICE_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_THEME_SERVICE_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_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 ThemeServiceGtk : public ThemeService { | 40 class GtkThemeService : 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 ThemeServiceGtk, casted from our superclass. | 51 // Returns GtkThemeService, casted from our superclass. |
| 52 static ThemeServiceGtk* GetFrom(Profile* profile); | 52 static GtkThemeService* GetFrom(Profile* profile); |
| 53 | 53 |
| 54 ThemeServiceGtk(); | 54 GtkThemeService(); |
| 55 virtual ~ThemeServiceGtk(); | 55 virtual ~GtkThemeService(); |
| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 void GetNormalButtonTintHSL(color_utils::HSL* tint) const; | 216 void GetNormalButtonTintHSL(color_utils::HSL* tint) const; |
| 217 | 217 |
| 218 // Returns a tint that's the color of the current normal text in an entry. | 218 // Returns a tint that's the color of the current normal text in an entry. |
| 219 void GetNormalEntryForegroundHSL(color_utils::HSL* tint) const; | 219 void GetNormalEntryForegroundHSL(color_utils::HSL* tint) const; |
| 220 | 220 |
| 221 // Returns a tint that's the color of the current highlighted text in an | 221 // Returns a tint that's the color of the current highlighted text in an |
| 222 // entry. | 222 // entry. |
| 223 void GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const; | 223 void GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const; |
| 224 | 224 |
| 225 // Handles signal from GTK that our theme has been changed. | 225 // Handles signal from GTK that our theme has been changed. |
| 226 CHROMEGTK_CALLBACK_1(ThemeServiceGtk, void, OnStyleSet, GtkStyle*); | 226 CHROMEGTK_CALLBACK_1(GtkThemeService, void, OnStyleSet, GtkStyle*); |
| 227 | 227 |
| 228 // A notification from various GObject destructors that we should | 228 // A notification from various GObject destructors that we should |
| 229 // remove it from our internal list. | 229 // remove it from our internal list. |
| 230 CHROMEGTK_CALLBACK_0(ThemeServiceGtk, void, OnDestroyChromeButton); | 230 CHROMEGTK_CALLBACK_0(GtkThemeService, void, OnDestroyChromeButton); |
| 231 CHROMEGTK_CALLBACK_0(ThemeServiceGtk, void, OnDestroyChromeLinkButton); | 231 CHROMEGTK_CALLBACK_0(GtkThemeService, void, OnDestroyChromeLinkButton); |
| 232 CHROMEGTK_CALLBACK_0(ThemeServiceGtk, void, OnDestroyLabel); | 232 CHROMEGTK_CALLBACK_0(GtkThemeService, void, OnDestroyLabel); |
| 233 | 233 |
| 234 CHROMEGTK_CALLBACK_1(ThemeServiceGtk, gboolean, OnSeparatorExpose, | 234 CHROMEGTK_CALLBACK_1(GtkThemeService, gboolean, OnSeparatorExpose, |
| 235 GdkEventExpose*); | 235 GdkEventExpose*); |
| 236 | 236 |
| 237 // Whether we should be using gtk rendering. | 237 // Whether we should be using gtk rendering. |
| 238 bool use_gtk_; | 238 bool use_gtk_; |
| 239 | 239 |
| 240 // GtkWidgets that exist only so we can look at their properties (and take | 240 // GtkWidgets that exist only so we can look at their properties (and take |
| 241 // their colors). | 241 // their colors). |
| 242 GtkWidget* fake_window_; | 242 GtkWidget* fake_window_; |
| 243 GtkWidget* fake_frame_; | 243 GtkWidget* fake_frame_; |
| 244 ui::OwnedWidgetGtk fake_label_; | 244 ui::OwnedWidgetGtk fake_label_; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 static GtkWidget* icon_widget_; | 292 static GtkWidget* icon_widget_; |
| 293 | 293 |
| 294 // The default folder icon and default bookmark icon for the GTK theme. | 294 // The default folder icon and default bookmark icon for the GTK theme. |
| 295 // These are static because the system can only have one theme at a time. | 295 // These are static because the system can only have one theme at a time. |
| 296 // They are cached when they are requested the first time, and cleared when | 296 // They are cached when they are requested the first time, and cleared when |
| 297 // the system theme changes. | 297 // the system theme changes. |
| 298 static gfx::Image* default_folder_icon_; | 298 static gfx::Image* default_folder_icon_; |
| 299 static gfx::Image* default_bookmark_icon_; | 299 static gfx::Image* default_bookmark_icon_; |
| 300 }; | 300 }; |
| 301 | 301 |
| 302 #endif // CHROME_BROWSER_UI_GTK_THEME_SERVICE_GTK_H_ | 302 #endif // CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ |
| OLD | NEW |