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

Unified Diff: chrome/browser/resources/md_history/app.crisper.js

Issue 2278383002: [MD History] Use box-shadow to render card shadows everywhere. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@disable_test
Patch Set: add comments Created 4 years, 3 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_history/app.vulcanized.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_history/app.crisper.js
diff --git a/chrome/browser/resources/md_history/app.crisper.js b/chrome/browser/resources/md_history/app.crisper.js
index 91fc353a883ddcf1fbfa32dd667add7cebf88cc9..114855e9baa677e0fd47435805aaccf7f43e5a7e 100644
--- a/chrome/browser/resources/md_history/app.crisper.js
+++ b/chrome/browser/resources/md_history/app.crisper.js
@@ -6685,20 +6685,17 @@ Polymer({
cr.define('cr.icon', function() {
function getSupportedScaleFactors() {
var supportedScaleFactors = [];
- if (cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux) {
+ if (!cr.isIOS) {
supportedScaleFactors.push(1);
+ }
+ if (cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux) {
supportedScaleFactors.push(2);
} else {
supportedScaleFactors.push(window.devicePixelRatio);
}
return supportedScaleFactors;
}
- function getProfileAvatarIcon(path) {
- var chromeThemePath = 'chrome://theme';
- var isDefaultAvatar = path.slice(0, chromeThemePath.length) == chromeThemePath;
- return isDefaultAvatar ? imageset(path + '@scalefactorx') : url(path);
- }
- function imageset(path) {
+ function getImageSet(path) {
var supportedScaleFactors = getSupportedScaleFactors();
var replaceStartIndex = path.indexOf('scalefactor');
if (replaceStartIndex < 0) return url(path);
@@ -6711,16 +6708,20 @@ cr.define('cr.icon', function() {
}
return '-webkit-image-set(' + s + ')';
}
+ function getImage(path) {
+ var chromeThemePath = 'chrome://theme';
+ var isChromeThemeUrl = path.slice(0, chromeThemePath.length) == chromeThemePath;
+ return isChromeThemeUrl ? getImageSet(path + '@scalefactorx') : url(path);
+ }
var FAVICON_URL_REGEX = /\.ico$/i;
- function getFaviconImageSet(url, opt_size, opt_type) {
+ function getFavicon(url, opt_size, opt_type) {
var size = opt_size || 16;
var type = opt_type || 'favicon';
- return imageset('chrome://' + type + '/size/' + size + '@scalefactorx/' + (FAVICON_URL_REGEX.test(url) ? 'iconurl/' : '') + url);
+ return getImageSet('chrome://' + type + '/size/' + size + '@scalefactorx/' + (FAVICON_URL_REGEX.test(url) ? 'iconurl/' : '') + url);
}
return {
- getSupportedScaleFactors: getSupportedScaleFactors,
- getProfileAvatarIcon: getProfileAvatarIcon,
- getFaviconImageSet: getFaviconImageSet
+ getImage: getImage,
+ getFavicon: getFavicon
};
});
@@ -6844,7 +6845,7 @@ cr.define('md_history', function() {
md_history.BrowserService.getInstance().recordAction('EntryLinkRightClick');
},
showIcon_: function() {
- this.$.icon.style.backgroundImage = cr.icon.getFaviconImageSet(this.item.url);
+ this.$.icon.style.backgroundImage = cr.icon.getFavicon(this.item.url);
},
selectionNotAllowed_: function() {
return !loadTimeData.getBoolean('allowDeletingHistory');
@@ -7093,7 +7094,7 @@ Polymer({
return [ 'groupedHistoryData_', groupIndex, 'domains', domainIndex, 'visits', itemIndex ].join('.');
},
getWebsiteIconStyle_: function(domain) {
- return 'background-image: ' + cr.icon.getFaviconImageSet(domain.visits[0].url);
+ return 'background-image: ' + cr.icon.getFavicon(domain.visits[0].url);
},
getDropdownIcon_: function(expanded) {
return expanded ? 'cr:expand-less' : 'cr:expand-more';
@@ -8347,7 +8348,7 @@ Polymer({
this.async(function() {
var icons = Polymer.dom(this.root).querySelectorAll('.website-icon');
for (var i = 0; i < this.tabs.length; i++) {
- icons[i].style.backgroundImage = cr.icon.getFaviconImageSet(this.tabs[i].url);
+ icons[i].style.backgroundImage = cr.icon.getFavicon(this.tabs[i].url);
}
});
},
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/app.vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698