diff options
Diffstat (limited to 'chrome/browser/resources/history/other_devices.js')
| -rw-r--r-- | chrome/browser/resources/history/other_devices.js | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/chrome/browser/resources/history/other_devices.js b/chrome/browser/resources/history/other_devices.js index 270f756..15d7d47 100644 --- a/chrome/browser/resources/history/other_devices.js +++ b/chrome/browser/resources/history/other_devices.js @@ -282,7 +282,9 @@ Device.prototype.createSessionContents_ = function(maxNumTabs) { a.addEventListener('click', makeClickHandler(sessionTag, String(win.sessionId), String(tab.sessionId))); - contents.appendChild(a); + var wrapper = createElementWithClassName('div', 'device-tab-wrapper'); + wrapper.appendChild(a); + contents.appendChild(wrapper); } else { numTabsHidden++; } @@ -295,7 +297,9 @@ Device.prototype.createSessionContents_ = function(maxNumTabs) { moreLink.addEventListener('click', this.view_.increaseRowHeight.bind( this.view_, this.row_, numTabsHidden)); moreLink.textContent = loadTimeData.getStringF('xMore', numTabsHidden); - contents.appendChild(moreLink); + var moreWrapper = createElementWithClassName('div', 'more-wrapper'); + moreWrapper.appendChild(moreLink); + contents.appendChild(moreWrapper); } return contents; @@ -422,31 +426,19 @@ DevicesView.prototype.increaseRowHeight = function(row, height) { // DevicesView, Private ------------------------------------------------------- /** - * Provides an implementation for a single column grid. + * @param {!Element} root + * @param {?Node} boundary * @constructor * @extends {cr.ui.FocusRow} */ -function DevicesViewFocusRow() {} - -/** - * Decorates |rowElement| so that it can be treated as a DevicesViewFocusRow. - * @param {Element} rowElement The element representing this row. - * @param {Node} boundary Focus events are ignored outside of this node. - */ -DevicesViewFocusRow.decorate = function(rowElement, boundary) { - rowElement.__proto__ = DevicesViewFocusRow.prototype; - rowElement.decorate(boundary); - rowElement.addFocusableElement(rowElement); -}; - -DevicesViewFocusRow.prototype = { - __proto__: cr.ui.FocusRow.prototype, +function DevicesViewFocusRow(root, boundary) { + cr.ui.FocusRow.call(this, root, boundary); + assert(this.addItem('menu-button', 'button.drop-down') || + this.addItem('device-tab', '.device-tab-entry') || + this.addItem('more-tabs', '.device-show-more-tabs')); +} - /** @override */ - getEquivalentElement: function(element) { - return this; - }, -}; +DevicesViewFocusRow.prototype = {__proto__: cr.ui.FocusRow.prototype}; /** * Update the page with results. @@ -503,14 +495,14 @@ DevicesView.prototype.displayResults_ = function() { var devices = this.resultDiv_.querySelectorAll('.device-contents'); for (var i = 0; i < devices.length; ++i) { - var rows = devices[i].querySelectorAll('.device-tab-entry, button'); + var rows = devices[i].querySelectorAll( + 'h3, .device-tab-wrapper, .more-wrapper'); if (!rows.length) continue; var grid = new cr.ui.FocusGrid(); for (var j = 0; j < rows.length; ++j) { - DevicesViewFocusRow.decorate(rows[j], devices[i]); - grid.addRow(rows[j]); + grid.addRow(new DevicesViewFocusRow(rows[j], devices[i])); } grid.ensureRowActive(); this.focusGrids_.push(grid); |
