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

Unified Diff: chrome/browser/resources/history/other_devices.js

Issue 807593005: Make downloads list keyboard shortcuts more consistent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply feedback after talk Created 5 years, 11 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/history/other_devices.js
diff --git a/chrome/browser/resources/history/other_devices.js b/chrome/browser/resources/history/other_devices.js
index 33e4bd46f33ae04f6c3853b023a0732a187630db..a885195ecd3125afc61d21cfcd6adce9c72f89db 100644
--- a/chrome/browser/resources/history/other_devices.js
+++ b/chrome/browser/resources/history/other_devices.js
@@ -427,6 +427,26 @@ DevicesView.prototype.increaseRowHeight = function(row, height) {
// DevicesView, Private -------------------------------------------------------
/**
+ * Provides an implementation for a single column grid.
+ * @param {Node} boundary Focus events are ignored outside of this node.
+ * @param {Element} rowElement The element representing this row.
+ * @extends {cr.ui.FocusRow}
+ */
+DevicesView.SingleColumnFocusRow = function(boundary, rowElement) {
+ cr.ui.FocusRow.apply(this, arguments);
+ this.setFocusableElement(rowElement);
+};
+
+DevicesView.SingleColumnFocusRow.prototype = {
+ __proto__: cr.ui.FocusRow.prototype,
+
+ /** @override */
+ getEquivalentElement: function(element) {
+ return this.rowElement_;
+ },
+};
+
+/**
* Update the page with results.
* @private
*/
@@ -479,16 +499,15 @@ DevicesView.prototype.displayResults_ = function() {
this.focusGrids_.forEach(function(grid) { grid.destroy(); });
this.focusGrids_.length = 0;
- var singleColumn = function(e) { return [e]; };
-
var devices = this.resultDiv_.querySelectorAll('.device-contents');
for (var i = 0; i < devices.length; ++i) {
var rows = devices[i].querySelectorAll('.device-tab-entry, button');
if (!rows.length)
continue;
- var grid = new cr.ui.FocusGrid(devices[i]);
- grid.setGrid(Array.prototype.map.call(rows, singleColumn));
+ var grid = new cr.ui.FocusGrid();
+ for (var i = 0; i < rows.length; ++i)
+ grid.addRow(new DevicesView.SingleColumnFocusRow(devices[i], rows[i]));
this.focusGrids_.push(grid);
}
};

Powered by Google App Engine
This is Rietveld 408576698