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

Unified Diff: chrome/browser/resources/downloads/focus_row.js

Issue 1000163002: downloads: put [column-type] in HTML template instead of JS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@undo-order
Patch Set: hcarmona@ review Created 5 years, 9 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 | « chrome/browser/resources/downloads/downloads.html ('k') | chrome/browser/resources/downloads/item_view.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/downloads/focus_row.js
diff --git a/chrome/browser/resources/downloads/focus_row.js b/chrome/browser/resources/downloads/focus_row.js
index 71f7b85dafe5b1d9c0dfbc353e5d24c36d219ff8..063b8ccfb400cb3fbaf317bb92aafe750a29b40b 100644
--- a/chrome/browser/resources/downloads/focus_row.js
+++ b/chrome/browser/resources/downloads/focus_row.js
@@ -20,21 +20,7 @@ cr.define('downloads', function() {
FocusRow.decorate = function(focusRow, itemView, boundary) {
focusRow.__proto__ = FocusRow.prototype;
focusRow.decorate(boundary);
-
- // Add all clickable elements as a row into the grid.
- focusRow.addElementIfFocusable_(itemView.fileLink, 'name');
- focusRow.addElementIfFocusable_(itemView.srcUrl, 'url');
- focusRow.addElementIfFocusable_(itemView.show, 'show');
- focusRow.addElementIfFocusable_(itemView.retry, 'retry');
- focusRow.addElementIfFocusable_(itemView.pause, 'pause');
- focusRow.addElementIfFocusable_(itemView.resume, 'resume');
- focusRow.addElementIfFocusable_(itemView.safeRemove, 'remove');
- focusRow.addElementIfFocusable_(itemView.cancel, 'cancel');
- focusRow.addElementIfFocusable_(itemView.restore, 'save');
- focusRow.addElementIfFocusable_(itemView.save, 'save');
- focusRow.addElementIfFocusable_(itemView.dangerRemove, 'discard');
- focusRow.addElementIfFocusable_(itemView.discard, 'discard');
- focusRow.addElementIfFocusable_(itemView.controlledBy, 'extension');
+ focusRow.addFocusableElements_();
};
FocusRow.prototype = {
@@ -50,6 +36,7 @@ cr.define('downloads', function() {
var equivalent = this.querySelector('[column-type=' + columnType + ']');
if (this.focusableElements.indexOf(equivalent) < 0) {
+ equivalent = null;
var equivalentTypes =
['show', 'retry', 'pause', 'resume', 'remove', 'cancel'];
if (equivalentTypes.indexOf(columnType) != -1) {
@@ -64,15 +51,13 @@ cr.define('downloads', function() {
return assert(equivalent || this.focusableElements[0]);
},
- /**
- * @param {Element} element The element that should be added.
- * @param {string} type The column type to use for the element.
- * @private
- */
- addElementIfFocusable_: function(element, type) {
- if (this.shouldFocus_(element)) {
- this.addFocusableElement(element);
- element.setAttribute('column-type', type);
+ /** @private */
+ addFocusableElements_: function() {
+ var possiblyFocusableElements = this.querySelectorAll('[column-type]');
+ for (var i = 0; i < possiblyFocusableElements.length; ++i) {
+ var possiblyFocusableElement = possiblyFocusableElements[i];
+ if (this.shouldFocus_(possiblyFocusableElement))
+ this.addFocusableElement(possiblyFocusableElement);
}
},
« no previous file with comments | « chrome/browser/resources/downloads/downloads.html ('k') | chrome/browser/resources/downloads/item_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698