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 f0ebe8005b63ee5711e1c3b007643b62da3c57ac..a4f41e9a78c2aa56adaf8ff14cb7e2a0e3b4a89d 100644 |
| --- a/chrome/browser/resources/history/other_devices.js |
| +++ b/chrome/browser/resources/history/other_devices.js |
| @@ -167,6 +167,7 @@ function Device(session, view) { |
| */ |
| Device.prototype.getDOMNode = function(maxNumTabs, row) { |
| var deviceDiv = createElementWithClassName('div', 'device'); |
| + this.focusGrid_ = new cr.ui.FocusGrid(); |
| this.row_ = row; |
| if (!this.session_) |
| return deviceDiv; |
| @@ -244,7 +245,11 @@ Device.prototype.setSearchText = function(searchText) { |
| * @private |
| */ |
| Device.prototype.createSessionContents_ = function(maxNumTabs) { |
| - var contents = createElementWithClassName('ol', 'device-contents'); |
| + var contents = createElementWithClassName('div', ''); |
| + |
| + // |list| will be used as the boundary for the DevicesViewFocusRows. |
| + var list = createElementWithClassName('ol', 'device-contents'); |
| + contents.appendChild(list); |
| var sessionTag = this.session_.tag; |
| var numTabsShown = 0; |
| @@ -256,7 +261,7 @@ Device.prototype.createSessionContents_ = function(maxNumTabs) { |
| // Show a separator between multiple windows in the same session. |
| if (i > 0 && numTabsShown < maxNumTabs) |
| - contents.appendChild(document.createElement('hr')); |
| + list.appendChild(document.createElement('hr')); |
| for (var j = 0; j < win.tabs.length; j++) { |
| var tab = win.tabs[j]; |
| @@ -287,7 +292,9 @@ Device.prototype.createSessionContents_ = function(maxNumTabs) { |
| a.addEventListener('click', makeClickHandler(sessionTag, |
| String(win.sessionId), |
| String(tab.sessionId))); |
| - contents.appendChild(a); |
| + list.appendChild(a); |
| + DevicesViewFocusRow.decorate(a, list); |
| + this.focusGrid_.addRow(a); |
| } else { |
| numTabsHidden++; |
| } |
| @@ -352,7 +359,6 @@ function DevicesView() { |
| this.resultDiv_ = $('other-devices'); |
| this.searchText_ = ''; |
| this.rowHeights_ = [NB_ENTRIES_FIRST_ROW_COLUMN]; |
| - this.focusGrids_ = []; |
| this.updateSignInState(loadTimeData.getBoolean('isUserSignedIn')); |
| recordUmaEvent_(HISTOGRAM_EVENT.INITIALIZED); |
| } |
| @@ -502,23 +508,6 @@ DevicesView.prototype.displayResults_ = function() { |
| this.resultDiv_.appendChild( |
| createElementWithClassName('div', 'other-devices-bottom')); |
| - |
| - this.focusGrids_.forEach(function(grid) { grid.destroy(); }); |
| - this.focusGrids_.length = 0; |
| - |
| - 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(); |
| - for (var i = 0; i < rows.length; ++i) { |
|
Dan Beam
2015/03/05 02:25:56
oh, this is the problem? i'd just change i -> j h
|
| - DevicesViewFocusRow.decorate(rows[i], devices[i]); |
| - grid.addRow(rows[i]); |
| - } |
| - this.focusGrids_.push(grid); |
| - } |
| }; |
| /** |