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

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

Issue 10451102: fix a memory leak and add a suppression (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 months 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
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 #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/lazy_instance.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/prefs/pref_change_registrar.h" 15 #include "chrome/browser/prefs/pref_change_registrar.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 "content/public/browser/notification_observer.h"
17 #include "ui/base/glib/glib_integers.h" 18 #include "ui/base/glib/glib_integers.h"
18 #include "ui/base/gtk/gtk_signal.h" 19 #include "ui/base/gtk/gtk_signal.h"
19 #include "ui/base/gtk/owned_widget_gtk.h" 20 #include "ui/base/gtk/owned_widget_gtk.h"
20 #include "ui/gfx/color_utils.h" 21 #include "ui/gfx/color_utils.h"
21 22
22 class Profile; 23 class Profile;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 SkColor get_inactive_selection_bg_color() const { 137 SkColor get_inactive_selection_bg_color() const {
137 return inactive_selection_bg_color_; 138 return inactive_selection_bg_color_;
138 } 139 }
139 SkColor get_inactive_selection_fg_color() const { 140 SkColor get_inactive_selection_fg_color() const {
140 return inactive_selection_fg_color_; 141 return inactive_selection_fg_color_;
141 } 142 }
142 143
143 // These functions return an image that is not owned by the caller and should 144 // These functions return an image that is not owned by the caller and should
144 // not be deleted. If |native| is true, get the GTK_STOCK version of the 145 // not be deleted. If |native| is true, get the GTK_STOCK version of the
145 // icon. 146 // icon.
146 static gfx::Image* GetFolderIcon(bool native); 147 static gfx::Image GetFolderIcon(bool native);
147 static gfx::Image* GetDefaultFavicon(bool native); 148 static gfx::Image GetDefaultFavicon(bool native);
148 149
149 // Whether we use the GTK theme by default in the current desktop 150 // Whether we use the GTK theme by default in the current desktop
150 // environment. Returns true when we GTK defaults to on. 151 // environment. Returns true when we GTK defaults to on.
151 static bool DefaultUsesSystemTheme(); 152 static bool DefaultUsesSystemTheme();
152 153
153 private: 154 private:
154 typedef std::map<int, SkColor> ColorMap; 155 typedef std::map<int, SkColor> ColorMap;
155 typedef std::map<int, color_utils::HSL> TintMap; 156 typedef std::map<int, color_utils::HSL> TintMap;
156 typedef std::map<int, gfx::Image*> ImageCache; 157 typedef std::map<int, gfx::Image*> ImageCache;
157 158
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 PrefChangeRegistrar registrar_; 294 PrefChangeRegistrar registrar_;
294 295
295 // This is a dummy widget that only exists so we have something to pass to 296 // This is a dummy widget that only exists so we have something to pass to
296 // gtk_widget_render_icon(). 297 // gtk_widget_render_icon().
297 static GtkWidget* icon_widget_; 298 static GtkWidget* icon_widget_;
298 299
299 // The default folder icon and default bookmark icon for the GTK theme. 300 // The default folder icon and default bookmark icon for the GTK theme.
300 // These are static because the system can only have one theme at a time. 301 // These are static because the system can only have one theme at a time.
301 // They are cached when they are requested the first time, and cleared when 302 // They are cached when they are requested the first time, and cleared when
302 // the system theme changes. 303 // the system theme changes.
303 static gfx::Image* default_folder_icon_; 304 static base::LazyInstance<gfx::Image> default_folder_icon_;
304 static gfx::Image* default_bookmark_icon_; 305 static base::LazyInstance<gfx::Image> default_bookmark_icon_;
305 }; 306 };
306 307
307 #endif // CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_ 308 #endif // CHROME_BROWSER_UI_GTK_GTK_THEME_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.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