summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 18:34:10 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 18:34:10 +0000
commit1279d5f395182c6fa783da0d85216777d931af6b (patch)
tree65eac9c68a5896e0fb3b39bc62344d8a8fb6b03d /app
parent3e3f0eb47762a85110fb11b850df776b59073f8d (diff)
downloadchromium_src-1279d5f395182c6fa783da0d85216777d931af6b.zip
chromium_src-1279d5f395182c6fa783da0d85216777d931af6b.tar.gz
chromium_src-1279d5f395182c6fa783da0d85216777d931af6b.tar.bz2
Theme image support for the Mac.
BUG=none TEST=none Review URL: http://codereview.chromium.org/140007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/app.gyp1
-rw-r--r--app/theme_provider.cc12
-rw-r--r--app/theme_provider.h18
3 files changed, 29 insertions, 2 deletions
diff --git a/app/app.gyp b/app/app.gyp
index e316d41d..faced76 100644
--- a/app/app.gyp
+++ b/app/app.gyp
@@ -101,6 +101,7 @@
'resource_bundle_mac.mm',
'slide_animation.cc',
'slide_animation.h',
+ 'theme_provider.cc',
'theme_provider.h',
'throb_animation.cc',
'throb_animation.h',
diff --git a/app/theme_provider.cc b/app/theme_provider.cc
new file mode 100644
index 0000000..7593e15
--- /dev/null
+++ b/app/theme_provider.cc
@@ -0,0 +1,12 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "app/theme_provider.h"
+
+// We have the destructor here because GCC puts the vtable in the first file
+// that includes a virtual function of the class. Leaving it just in the .h file
+// means that GCC will fail to link.
+
+ThemeProvider::~ThemeProvider() {
+}
diff --git a/app/theme_provider.h b/app/theme_provider.h
index 774810e..75e9255 100644
--- a/app/theme_provider.h
+++ b/app/theme_provider.h
@@ -10,7 +10,13 @@
#if defined(OS_LINUX)
#include <gdk/gdk.h>
-#endif
+#elif defined(OS_MACOSX)
+#ifdef __OBJC__
+@class NSImage;
+#else
+class NSImage;
+#endif // __OBJC__
+#endif // OS_*
class SkBitmap;
@@ -25,7 +31,7 @@ class SkBitmap;
class ThemeProvider {
public:
- virtual ~ThemeProvider() { }
+ virtual ~ThemeProvider();
// Get the bitmap specified by |id|. An implementation of ThemeProvider should
// have its own source of ids (e.g. an enum, or external resource bundle).
@@ -56,6 +62,14 @@ class ThemeProvider {
// pointer to a shared empty placeholder bitmap so it will be visible what
// is missing.
virtual GdkPixbuf* GetPixbufNamed(int id) = 0;
+#elif defined(OS_MACOSX)
+ // Gets the NSImage with the specified |id|. Returns a pointer to a shared
+ // instance of the NSImage. This shared NSImage is owned by the theme
+ // provider and should not be freed.
+ //
+ // The bitmap is not assumed to exist. If a theme does not provide an image,
+ // this function will return nil.
+ virtual NSImage* GetNSImageNamed(int id) = 0;
#endif
};