summaryrefslogtreecommitdiffstats
path: root/ui/gfx/mac/nsimage_cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gfx/mac/nsimage_cache.h')
-rw-r--r--ui/gfx/mac/nsimage_cache.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/ui/gfx/mac/nsimage_cache.h b/ui/gfx/mac/nsimage_cache.h
new file mode 100644
index 0000000..83179d2
--- /dev/null
+++ b/ui/gfx/mac/nsimage_cache.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_GFX_MAC_NSIMAGE_CACHE_H_
+#define UI_GFX_MAC_NSIMAGE_CACHE_H_
+#pragma once
+
+#ifdef __OBJC__
+@class NSImage;
+@class NSString;
+#else
+class NSImage;
+class NSString;
+#endif
+
+namespace gfx {
+
+// Returns an autoreleased image from the main app bundle
+// (mac_util::MainAppBundle()) with the given name, and keeps it in memory so
+// future fetches are fast.
+// NOTE:
+// - This should only be called on the main thread.
+// - The caller should retain the image if they want to keep it around, as
+// the cache could have limit on size/lifetime, etc.
+NSImage* GetCachedImageWithName(NSString* name);
+
+// Clears the image cache.
+void ClearCachedImages(void);
+
+} // namespace gfx
+
+#endif // UI_GFX_MAC_NSIMAGE_CACHE_H_