Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(862)

Unified Diff: chrome/browser/resources/md_downloads/crisper.js

Issue 1947533002: Material WebUI: create shared icon file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase fix Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/md_downloads/toolbar.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_downloads/crisper.js
diff --git a/chrome/browser/resources/md_downloads/crisper.js b/chrome/browser/resources/md_downloads/crisper.js
index 39d9b3d1b7df8ba15c8db64ba931372d2eac9b3e..11e1afeeae44ee03a31830ab02adf2ea2978bbdc 100644
--- a/chrome/browser/resources/md_downloads/crisper.js
+++ b/chrome/browser/resources/md_downloads/crisper.js
@@ -1468,8 +1468,17 @@ function appendParam(url, key, value) {
}
/**
+ * A regular expression for identifying favicon URLs.
+ * @const {!RegExp}
+ * TODO(dpapad): Move all favicon related methods to a new favicon_util.js file
+ * and make this RegExp private.
+ */
+var FAVICON_URL_REGEX = /\.ico$/i;
+
+/**
* Creates a CSS -webkit-image-set for a favicon request.
- * @param {string} url The url for the favicon.
+ * @param {string} url Either the URL of the original page or of the favicon
+ * itself.
* @param {number=} opt_size Optional preferred size of the favicon.
* @param {string=} opt_type Optional type of favicon to request. Valid values
* are 'favicon' and 'touch-icon'. Default is 'favicon'.
@@ -1478,26 +1487,12 @@ function appendParam(url, key, value) {
function getFaviconImageSet(url, opt_size, opt_type) {
var size = opt_size || 16;
var type = opt_type || 'favicon';
- return imageset(
- 'chrome://' + type + '/size/' + size + '@scalefactorx/' + url);
-}
-/**
- * Creates a new URL for a favicon request for the current device pixel ratio.
- * The URL must be updated when the user moves the browser to a screen with a
- * different device pixel ratio. Use getFaviconImageSet() for the updating to
- * occur automatically.
- * @param {string} url The url for the favicon.
- * @param {number=} opt_size Optional preferred size of the favicon.
- * @param {string=} opt_type Optional type of favicon to request. Valid values
- * are 'favicon' and 'touch-icon'. Default is 'favicon'.
- * @return {string} Updated URL for the favicon.
- */
-function getFaviconUrlForCurrentDevicePixelRatio(url, opt_size, opt_type) {
- var size = opt_size || 16;
- var type = opt_type || 'favicon';
- return 'chrome://' + type + '/size/' + size + '@' +
- window.devicePixelRatio + 'x/' + url;
+ return imageset(
+ 'chrome://' + type + '/size/' + size + '@scalefactorx/' +
+ // Note: Literal 'iconurl' must match |kIconURLParameter| in
+ // components/favicon_base/favicon_url_parser.cc.
+ (FAVICON_URL_REGEX.test(url) ? 'iconurl/' : '') + url);
}
/**
« no previous file with comments | « no previous file | chrome/browser/resources/md_downloads/toolbar.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698