diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-05 21:31:42 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-05 21:31:42 +0000 |
commit | 7664efd2db984d94dfe4ad7c92441bc881cae632 (patch) | |
tree | ef3609c7d22ea7fb7be917e1343fbe1419dd57cb /chrome/browser/themes | |
parent | ca20f09b7647dbebe2d869521856fae502753f40 (diff) | |
download | chromium_src-7664efd2db984d94dfe4ad7c92441bc881cae632.zip chromium_src-7664efd2db984d94dfe4ad7c92441bc881cae632.tar.gz chromium_src-7664efd2db984d94dfe4ad7c92441bc881cae632.tar.bz2 |
GTK: Port omnibox drawing from GdkGC interface to cairo.
(Now with a fix for the crash from Friday; we need to copy the bitmap into a different format first for ownership reasons.)
GdkGC is deprecated and will be removed in gtk3 and cairo should be faster anyway. This uses the new CairoCachedSurface in gfx::Image.
BUG=79722
TEST=none
First commit: http://src.chromium.org/viewvc/chrome?view=rev&revision=112839
Review URL: http://codereview.chromium.org/8781001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113033 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/themes')
-rw-r--r-- | chrome/browser/themes/theme_service.cc | 14 | ||||
-rw-r--r-- | chrome/browser/themes/theme_service.h | 11 |
2 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index 34a36e5..210e663 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -220,6 +220,20 @@ void ThemeService::Init(Profile* profile) { LoadThemePrefs(); } +const gfx::Image* ThemeService::GetImageNamed(int id) const { + DCHECK(CalledOnValidThread()); + + const gfx::Image* image = NULL; + + if (theme_pack_.get()) + image = theme_pack_->GetImageNamed(id); + + if (!image) + image = &rb_.GetNativeImageNamed(id); + + return image; +} + SkBitmap* ThemeService::GetBitmapNamed(int id) const { DCHECK(CalledOnValidThread()); diff --git a/chrome/browser/themes/theme_service.h b/chrome/browser/themes/theme_service.h index 2534f71..a6c01c4 100644 --- a/chrome/browser/themes/theme_service.h +++ b/chrome/browser/themes/theme_service.h @@ -28,6 +28,10 @@ namespace color_utils { struct HSL; } +namespace gfx { +class Image; +} + namespace ui { class ResourceBundle; } @@ -140,6 +144,13 @@ class ThemeService : public base::NonThreadSafe, REPEAT = 3 } Tiling; + // Returns a cross platform image for an id. + // + // TODO(erg): Make this a virtual, exposed through ui::ThemeProvider and the + // main way to get theme properties out of the theme provider since it's + // cross platform. + const gfx::Image* GetImageNamed(int id) const; + // ui::ThemeProvider implementation. virtual void Init(Profile* profile) OVERRIDE; virtual SkBitmap* GetBitmapNamed(int id) const OVERRIDE; |