| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GTK_THEME_SERVICE_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_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> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 typedef struct _GdkDisplay GdkDisplay; | 28 typedef struct _GdkDisplay GdkDisplay; |
| 29 typedef struct _GdkEventExpose GdkEventExpose; | 29 typedef struct _GdkEventExpose GdkEventExpose; |
| 30 typedef struct _GdkPixbuf GdkPixbuf; | 30 typedef struct _GdkPixbuf GdkPixbuf; |
| 31 typedef struct _GtkIconSet GtkIconSet; | 31 typedef struct _GtkIconSet GtkIconSet; |
| 32 typedef struct _GtkStyle GtkStyle; | 32 typedef struct _GtkStyle GtkStyle; |
| 33 typedef struct _GtkWidget GtkWidget; | 33 typedef struct _GtkWidget GtkWidget; |
| 34 | 34 |
| 35 // Specialization of ThemeService which supplies system colors. | 35 // Specialization of ThemeService which supplies system colors. |
| 36 class GtkThemeService : public ThemeService, | 36 class GtkThemeService : public ThemeService { |
| 37 public NotificationObserver { | |
| 38 public: | 37 public: |
| 39 // Returns GtkThemeService, casted from our superclass. | 38 // Returns GtkThemeService, casted from our superclass. |
| 40 static GtkThemeService* GetFrom(Profile* profile); | 39 static GtkThemeService* GetFrom(Profile* profile); |
| 41 | 40 |
| 42 GtkThemeService(); | 41 GtkThemeService(); |
| 43 virtual ~GtkThemeService(); | 42 virtual ~GtkThemeService(); |
| 44 | 43 |
| 45 // Calls |observer|.Observe() for the browser theme with this provider as the | 44 // Calls |observer|.Observe() for the browser theme with this provider as the |
| 46 // source. | 45 // source. |
| 47 void InitThemesFor(NotificationObserver* observer); | 46 void InitThemesFor(NotificationObserver* observer); |
| 48 | 47 |
| 49 // Overridden from ThemeService: | 48 // Overridden from ThemeService: |
| 50 // | 49 // |
| 51 // Sets that we aren't using the system theme, then calls | 50 // Sets that we aren't using the system theme, then calls |
| 52 // ThemeService's implementation. | 51 // ThemeService's implementation. |
| 53 virtual void Init(Profile* profile); | 52 virtual void Init(Profile* profile); |
| 54 virtual SkBitmap* GetBitmapNamed(int id) const; | 53 virtual SkBitmap* GetBitmapNamed(int id) const; |
| 55 virtual SkColor GetColor(int id) const; | 54 virtual SkColor GetColor(int id) const; |
| 56 virtual bool HasCustomImage(int id) const; | 55 virtual bool HasCustomImage(int id) const; |
| 57 virtual void SetTheme(const Extension* extension); | 56 virtual void SetTheme(const Extension* extension); |
| 58 virtual void UseDefaultTheme(); | 57 virtual void UseDefaultTheme(); |
| 59 virtual void SetNativeTheme(); | 58 virtual void SetNativeTheme(); |
| 60 virtual bool UsingDefaultTheme(); | 59 virtual bool UsingDefaultTheme(); |
| 61 | 60 |
| 62 // Overridden from NotificationObserver: | 61 // Overridden from ThemeService, NotificationObserver: |
| 63 virtual void Observe(NotificationType type, | 62 virtual void Observe(NotificationType type, |
| 64 const NotificationSource& source, | 63 const NotificationSource& source, |
| 65 const NotificationDetails& details); | 64 const NotificationDetails& details); |
| 66 | 65 |
| 67 // Creates a GtkChromeButton instance, registered with this theme provider, | 66 // Creates a GtkChromeButton instance, registered with this theme provider, |
| 68 // with a "destroy" signal to remove it from our internal list when it goes | 67 // with a "destroy" signal to remove it from our internal list when it goes |
| 69 // away. | 68 // away. |
| 70 GtkWidget* BuildChromeButton(); | 69 GtkWidget* BuildChromeButton(); |
| 71 | 70 |
| 72 // Creates a theme-aware vertical separator widget. | 71 // Creates a theme-aware vertical separator widget. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 303 |
| 305 // The default folder icon and default bookmark icon for the GTK theme. | 304 // The default folder icon and default bookmark icon for the GTK theme. |
| 306 // These are static because the system can only have one theme at a time. | 305 // These are static because the system can only have one theme at a time. |
| 307 // They are cached when they are requested the first time, and cleared when | 306 // They are cached when they are requested the first time, and cleared when |
| 308 // the system theme changes. | 307 // the system theme changes. |
| 309 static GdkPixbuf* default_folder_icon_; | 308 static GdkPixbuf* default_folder_icon_; |
| 310 static GdkPixbuf* default_bookmark_icon_; | 309 static GdkPixbuf* default_bookmark_icon_; |
| 311 }; | 310 }; |
| 312 | 311 |
| 313 #endif // CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ | 312 #endif // CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ |
| OLD | NEW |