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

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

Issue 2311093002: MD WebUI: Use dom-if to control hidden elements in <cr-toolbar> (Closed)
Patch Set: Fix tests 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
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..afe15cb8ee1042e9ed8565c8c5415171f21cd4d1 100644
--- a/chrome/browser/resources/md_history/app.crisper.js
+++ b/chrome/browser/resources/md_history/app.crisper.js
@@ -4452,7 +4452,11 @@ Polymer({
type: Boolean,
reflectToAttribute: true
},
- hasSearchText_: Boolean
+ hasSearchText_: Boolean,
+ isSpinnerShown_: {
+ type: Boolean,
+ computed: 'computeIsSpinnerShown_(spinnerActive, showingSearch)'
+ }
},
listeners: {
tap: 'showSearch_',
@@ -4467,8 +4471,8 @@ Polymer({
computeIconTabIndex_: function(narrow) {
return narrow ? 0 : -1;
},
- isSpinnerShown_: function(spinnerActive, showingSearch) {
- return spinnerActive && showingSearch;
+ computeIsSpinnerShown_: function() {
+ return this.spinnerActive && this.showingSearch;
},
onInputBlur_: function() {
if (!this.hasSearchText_) this.showingSearch = false;
@@ -6685,20 +6689,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 +6712,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 +6849,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 +7098,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 +8352,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 | « chrome/browser/resources/md_downloads/vulcanized.html ('k') | chrome/browser/resources/md_history/app.vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698