Index: ui/webui/resources/js/util.js |
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js |
index ebcf90c12d5adae6ae4a0cd98df9e1d2abca9d1e..56e2d2d283c0334f0dd4c6dd5f31bf0957deb38d 100644 |
--- a/ui/webui/resources/js/util.js |
+++ b/ui/webui/resources/js/util.js |
@@ -75,6 +75,21 @@ function url(s) { |
} |
/** |
+ * Returns the URL of the image, or an image set of URLs for the profile avatar. |
+ * Default avatars have resources available for multiple scalefactors, whereas |
+ * the GAIA profile image only comes in one size. |
+ |
+ * @param {string} url The path of the image. |
+ * @return {string} The url, or an image set of URLs of the avatar image. |
+ */ |
+function getProfileAvatarIcon(path) { |
+ var chromeThemePath = 'chrome://theme'; |
+ var isDefaultAvatar = |
+ (path.slice(0, chromeThemePath.length) == chromeThemePath); |
+ return isDefaultAvatar ? imageset(path + '@scalefactorx'): url(path); |
+} |
+ |
+/** |
* Generates a CSS -webkit-image-set for a chrome:// url. |
* An entry in the image set is added for each of getSupportedScaleFactors(). |
* The scale-factor-specific url is generated by replacing the first instance of |