Chromium Code Reviews| 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..375726a9d0438a6e2ed5cc322579626b1d975efd 100644 |
| --- a/chrome/browser/resources/history/other_devices.js |
| +++ b/chrome/browser/resources/history/other_devices.js |
| @@ -427,6 +427,34 @@ DevicesView.prototype.increaseRowHeight = function(row, height) { |
| // DevicesView, Private ------------------------------------------------------- |
| /** |
| + * Provides an implementation for a single column grid. |
| + * @constructor |
| + * @extends {cr.ui.FocusRow} |
| + */ |
| +function DevicesView.SingleColumnFocusRow() {} |
|
Dan Beam
2015/01/29 18:46:46
this isn't valid JavaScript. please try your code
hcarmona
2015/01/31 02:45:49
Updated.
|
| + |
| +/** |
| + * Decorates |rowElement| so that it can be treated as a SingleColumnFocusRow |
| + * item. |
| + * @param {Element} rowElement The element representing this row. |
| + * @param {Node} boundary Focus events are ignored outside of this node. |
| + */ |
| +DevicesView.SingleColumnFocusRow.decorate = function(rowElement, boundary) { |
| + rowElement.__proto__ = DevicesView.SingleColumnFocusRow.prototype; |
| + rowElement.decorate(boundary); |
| + rowElement.addFocusableElement(rowElement); |
| +}; |
| + |
| +DevicesView.SingleColumnFocusRow.prototype = { |
| + __proto__: cr.ui.FocusRow.prototype, |
| + |
| + /** @override */ |
| + getEquivalentElement: function(element) { |
| + return this; |
| + }, |
| +}; |
| + |
| +/** |
| * Update the page with results. |
| * @private |
| */ |
| @@ -479,16 +507,17 @@ 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) { |
| + DevicesView.SingleColumnFocusRow.decorate(rows[i], devices[i]); |
| + grid.addRow(rows[i]); |
| + } |
| this.focusGrids_.push(grid); |
| } |
| }; |