summaryrefslogtreecommitdiffstats
path: root/ui/base/resource
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-21 17:52:54 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-21 17:52:54 +0000
commitb6bb36e2e8c9a09b4fd733bf74b60a6f02a5a7e9 (patch)
tree91131329313e02e6c171e007707ab1cb0c3c2be0 /ui/base/resource
parent694cafac21aee4a18638d5dfb0e726d3f237be3d (diff)
downloadchromium_src-b6bb36e2e8c9a09b4fd733bf74b60a6f02a5a7e9.zip
chromium_src-b6bb36e2e8c9a09b4fd733bf74b60a6f02a5a7e9.tar.gz
chromium_src-b6bb36e2e8c9a09b4fd733bf74b60a6f02a5a7e9.tar.bz2
aura: Make 'ui' buildable without gtk.
BUG=97131 TEST=ui_unittests links and runs with use_aura=1 Review URL: http://codereview.chromium.org/7977025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/resource')
-rw-r--r--ui/base/resource/resource_bundle.h2
-rw-r--r--ui/base/resource/resource_bundle_linux.cc15
2 files changed, 14 insertions, 3 deletions
diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h
index 9f3705c..e739262 100644
--- a/ui/base/resource/resource_bundle.h
+++ b/ui/base/resource/resource_bundle.h
@@ -163,7 +163,7 @@ class UI_EXPORT ResourceBundle {
// Loads and returns a cursor from the app module.
HCURSOR LoadCursor(int cursor_id);
-#elif defined(USE_X11)
+#elif defined(TOOLKIT_USES_GTK)
// Gets the GdkPixbuf with the specified resource_id from the main data pak
// file. Returns a pointer to a shared instance of the GdkPixbuf. This
// shared GdkPixbuf is owned by the resource bundle and should not be freed.
diff --git a/ui/base/resource/resource_bundle_linux.cc b/ui/base/resource/resource_bundle_linux.cc
index 0ea8b0d..14000ce 100644
--- a/ui/base/resource/resource_bundle_linux.cc
+++ b/ui/base/resource/resource_bundle_linux.cc
@@ -4,8 +4,6 @@
#include "ui/base/resource/resource_bundle.h"
-#include <gtk/gtk.h>
-
#include "base/base_paths.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -21,8 +19,13 @@
#include "ui/gfx/gtk_util.h"
#include "ui/gfx/image/image.h"
+#if defined(TOOLKIT_USES_GTK)
+#include <gtk/gtk.h>
+#endif
+
namespace ui {
+#if defined(TOOLKIT_USES_GTK)
namespace {
// Convert the raw image data into a GdkPixbuf. The GdkPixbuf that is returned
@@ -57,6 +60,7 @@ GdkPixbuf* LoadPixbuf(RefCountedStaticMemory* data, bool rtl_enabled) {
}
} // namespace
+#endif // defined(TOOLKIT_USES_GTK)
// static
FilePath ResourceBundle::GetResourcesFilePath() {
@@ -72,9 +76,15 @@ FilePath ResourceBundle::GetLargeIconResourcesFilePath() {
}
gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) {
+#if defined(TOOLKIT_USES_GTK)
return *GetPixbufImpl(resource_id, false);
+#else
+ static gfx::Image image(NULL);
+ return image;
+#endif
}
+#if defined(TOOLKIT_USES_GTK)
gfx::Image* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) {
// Use the negative |resource_id| for the key for BIDI-aware images.
int key = rtl_enabled ? -resource_id : resource_id;
@@ -114,5 +124,6 @@ gfx::Image* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) {
GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) {
return *GetPixbufImpl(resource_id, true);
}
+#endif // defined(TOOLKIT_USES_GTK)
} // namespace ui