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

Side by Side Diff: chrome/browser/ui/gtk/gtk_theme_service.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/global_menu_bar.cc ('k') | chrome/browser/ui/gtk/gtk_theme_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/prefs/public/pref_change_registrar.h" 14 #include "base/prefs/public/pref_change_registrar.h"
15 #include "base/prefs/public/pref_observer.h"
15 #include "chrome/browser/themes/theme_service.h" 16 #include "chrome/browser/themes/theme_service.h"
16 #include "content/public/browser/notification_observer.h"
17 #include "ui/base/glib/glib_integers.h" 17 #include "ui/base/glib/glib_integers.h"
18 #include "ui/base/gtk/gtk_signal.h" 18 #include "ui/base/gtk/gtk_signal.h"
19 #include "ui/base/gtk/owned_widget_gtk.h" 19 #include "ui/base/gtk/owned_widget_gtk.h"
20 #include "ui/gfx/color_utils.h" 20 #include "ui/gfx/color_utils.h"
21 21
22 class Profile; 22 class Profile;
23 23
24 namespace extensions { 24 namespace extensions {
25 class Extension; 25 class Extension;
26 } 26 }
27 27
28 namespace gfx { 28 namespace gfx {
29 class CairoCachedSurface; 29 class CairoCachedSurface;
30 } 30 }
31 31
32 namespace ui { 32 namespace ui {
33 class GtkSignalRegistrar; 33 class GtkSignalRegistrar;
34 } 34 }
35 35
36 typedef struct _GdkDisplay GdkDisplay; 36 typedef struct _GdkDisplay GdkDisplay;
37 typedef struct _GdkEventExpose GdkEventExpose; 37 typedef struct _GdkEventExpose GdkEventExpose;
38 typedef struct _GdkPixbuf GdkPixbuf; 38 typedef struct _GdkPixbuf GdkPixbuf;
39 typedef struct _GtkIconSet GtkIconSet; 39 typedef struct _GtkIconSet GtkIconSet;
40 typedef struct _GtkStyle GtkStyle; 40 typedef struct _GtkStyle GtkStyle;
41 typedef struct _GtkWidget GtkWidget; 41 typedef struct _GtkWidget GtkWidget;
42 42
43 // Specialization of ThemeService which supplies system colors. 43 // Specialization of ThemeService which supplies system colors.
44 class GtkThemeService : public ThemeService { 44 class GtkThemeService : public ThemeService, public PrefObserver {
45 public: 45 public:
46 // A list of integer keys for a separate PerDisplaySurfaceMap that keeps 46 // A list of integer keys for a separate PerDisplaySurfaceMap that keeps
47 // what would otherwise be static icons on the X11 server. 47 // what would otherwise be static icons on the X11 server.
48 enum CairoDefaultIcon { 48 enum CairoDefaultIcon {
49 NATIVE_FAVICON = 1, 49 NATIVE_FAVICON = 1,
50 CHROME_FAVICON, 50 CHROME_FAVICON,
51 NATIVE_FOLDER, 51 NATIVE_FOLDER,
52 CHROME_FOLDER 52 CHROME_FOLDER
53 }; 53 };
54 54
(...skipping 15 matching lines...) Expand all
70 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const OVERRIDE; 70 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const OVERRIDE;
71 virtual gfx::Image GetImageNamed(int id) const OVERRIDE; 71 virtual gfx::Image GetImageNamed(int id) const OVERRIDE;
72 virtual SkColor GetColor(int id) const OVERRIDE; 72 virtual SkColor GetColor(int id) const OVERRIDE;
73 virtual bool HasCustomImage(int id) const OVERRIDE; 73 virtual bool HasCustomImage(int id) const OVERRIDE;
74 virtual void SetTheme(const extensions::Extension* extension) OVERRIDE; 74 virtual void SetTheme(const extensions::Extension* extension) OVERRIDE;
75 virtual void UseDefaultTheme() OVERRIDE; 75 virtual void UseDefaultTheme() OVERRIDE;
76 virtual void SetNativeTheme() OVERRIDE; 76 virtual void SetNativeTheme() OVERRIDE;
77 virtual bool UsingDefaultTheme() const OVERRIDE; 77 virtual bool UsingDefaultTheme() const OVERRIDE;
78 virtual bool UsingNativeTheme() const OVERRIDE; 78 virtual bool UsingNativeTheme() const OVERRIDE;
79 79
80 // Overridden from ThemeService, content::NotificationObserver: 80 // Overridden from PrefObserver:
81 virtual void Observe(int type, 81 virtual void OnPreferenceChanged(PrefServiceBase* service,
82 const content::NotificationSource& source, 82 const std::string& pref_name) OVERRIDE;
83 const content::NotificationDetails& details) OVERRIDE;
84 83
85 // Creates a GtkChromeButton instance, registered with this theme provider, 84 // Creates a GtkChromeButton instance, registered with this theme provider,
86 // with a "destroy" signal to remove it from our internal list when it goes 85 // with a "destroy" signal to remove it from our internal list when it goes
87 // away. 86 // away.
88 GtkWidget* BuildChromeButton(); 87 GtkWidget* BuildChromeButton();
89 88
90 // Creates a GtkChromeLinkButton instance. We update its state as theme 89 // Creates a GtkChromeLinkButton instance. We update its state as theme
91 // changes, and listen for its destruction. 90 // changes, and listen for its destruction.
92 GtkWidget* BuildChromeLinkButton(const std::string& text); 91 GtkWidget* BuildChromeLinkButton(const std::string& text);
93 92
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 304
306 // The default folder icon and default bookmark icon for the GTK theme. 305 // The default folder icon and default bookmark icon for the GTK theme.
307 // These are static because the system can only have one theme at a time. 306 // These are static because the system can only have one theme at a time.
308 // They are cached when they are requested the first time, and cleared when 307 // They are cached when they are requested the first time, and cleared when
309 // the system theme changes. 308 // the system theme changes.
310 static base::LazyInstance<gfx::Image> default_folder_icon_; 309 static base::LazyInstance<gfx::Image> default_folder_icon_;
311 static base::LazyInstance<gfx::Image> default_bookmark_icon_; 310 static base::LazyInstance<gfx::Image> default_bookmark_icon_;
312 }; 311 };
313 312
314 #endif // CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ 313 #endif // CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/global_menu_bar.cc ('k') | chrome/browser/ui/gtk/gtk_theme_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698