summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_theme_provider_gtk.cc
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 23:36:34 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-13 23:36:34 +0000
commitba7a68dfbf6f30e5b3efc3f5034499a952463d96 (patch)
treea90622682db23e4983778a96512995378f5ca284 /chrome/browser/browser_theme_provider_gtk.cc
parent4a560eddc550fbe5761aceb1461ff91e9097a3d3 (diff)
downloadchromium_src-ba7a68dfbf6f30e5b3efc3f5034499a952463d96.zip
chromium_src-ba7a68dfbf6f30e5b3efc3f5034499a952463d96.tar.gz
chromium_src-ba7a68dfbf6f30e5b3efc3f5034499a952463d96.tar.bz2
Restore RTL icons to CustomDrawButtonBase.
Since moving from ResourceBundle to ThemeProvider, we needed to plumb through GetRTLEnabledPixbufNamed in ThemeProvider. Review URL: http://codereview.chromium.org/149483 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20568 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_theme_provider_gtk.cc')
-rw-r--r--chrome/browser/browser_theme_provider_gtk.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/chrome/browser/browser_theme_provider_gtk.cc b/chrome/browser/browser_theme_provider_gtk.cc
index 9605344..2787dce 100644
--- a/chrome/browser/browser_theme_provider_gtk.cc
+++ b/chrome/browser/browser_theme_provider_gtk.cc
@@ -4,14 +4,25 @@
#include "chrome/browser/browser_theme_provider.h"
+#include "app/l10n_util.h"
#include "base/gfx/gtk_util.h"
#include "base/logging.h"
GdkPixbuf* BrowserThemeProvider::GetPixbufNamed(int id) {
+ return GetPixbufImpl(id, false);
+}
+
+GdkPixbuf* BrowserThemeProvider::GetRTLEnabledPixbufNamed(int id) {
+ return GetPixbufImpl(id, true);
+}
+
+GdkPixbuf* BrowserThemeProvider::GetPixbufImpl(int id, bool rtl_enabled) {
DCHECK(CalledOnValidThread());
+ // Use the negative |resource_id| for the key for BIDI-aware images.
+ int key = rtl_enabled ? -id : id;
// Check to see if we already have the pixbuf in the cache.
- GdkPixbufMap::const_iterator found = gdk_pixbufs_.find(id);
+ GdkPixbufMap::const_iterator found = gdk_pixbufs_.find(key);
if (found != gdk_pixbufs_.end())
return found->second;
@@ -20,7 +31,14 @@ GdkPixbuf* BrowserThemeProvider::GetPixbufNamed(int id) {
// We loaded successfully. Cache the pixbuf.
if (pixbuf) {
- gdk_pixbufs_[id] = pixbuf;
+ if ((l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) &&
+ rtl_enabled) {
+ GdkPixbuf* original_pixbuf = pixbuf;
+ pixbuf = gdk_pixbuf_flip(pixbuf, TRUE);
+ g_object_unref(original_pixbuf);
+ }
+
+ gdk_pixbufs_[key] = pixbuf;
return pixbuf;
}