summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/dom_ui_util.h
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 19:18:10 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 19:18:10 +0000
commit48a76bb620e8638dc2979e0a3554b402d168f8f9 (patch)
tree222b7542091f2e809b84bfd1a783d6912f4bd0d8 /chrome/browser/dom_ui/dom_ui_util.h
parent484ae5911b6176cad930d9242f8f91914a8165db (diff)
downloadchromium_src-48a76bb620e8638dc2979e0a3554b402d168f8f9.zip
chromium_src-48a76bb620e8638dc2979e0a3554b402d168f8f9.tar.gz
chromium_src-48a76bb620e8638dc2979e0a3554b402d168f8f9.tar.bz2
Refactored GetIamgeDataUrlFromResource from system notification code so that it can be reused.
Added GeImageDataUrl(SkBitmap& bitmap) that convert SkBitmap to data url. This will be used in DOMUI based menu. BUG=none TEST=none Review URL: http://codereview.chromium.org/3561001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60970 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/dom_ui_util.h')
-rw-r--r--chrome/browser/dom_ui/dom_ui_util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/dom_ui_util.h b/chrome/browser/dom_ui/dom_ui_util.h
index 2219d18..335ef05 100644
--- a/chrome/browser/dom_ui/dom_ui_util.h
+++ b/chrome/browser/dom_ui/dom_ui_util.h
@@ -9,6 +9,7 @@
#include <string>
class ListValue;
+class SkBitmap;
namespace dom_ui_util {
@@ -30,6 +31,19 @@ std::string GetJsonResponseFromFirstArgumentInList(const ListValue* args);
std::string GetJsonResponseFromArgumentList(const ListValue* args,
size_t list_index);
+
+// Convenience routine to convert SkBitmap object to data url
+// so that it can be used in DOMUI.
+std::string GetImageDataUrl(const SkBitmap& bitmap);
+
+// Convenience routine to get data url that corresponds to given
+// resource_id as an image. This function does not check if the
+// resource for the |resource_id| is an image, therefore it is the
+// caller's responsibility to make sure the resource is indeed an
+// image. Returns empty string if a resource does not exist for given
+// |resource_id|.
+std::string GetImageDataUrlFromResource(int resource_id);
+
} // end of namespace
#endif // CHROME_BROWSER_DOM_UI_DOM_UI_UTIL_H_