| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview The section of the history page that shows tabs from sessions | 6 * @fileoverview The section of the history page that shows tabs from sessions |
| 7 on other devices. | 7 on other devices. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /////////////////////////////////////////////////////////////////////////////// | 10 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // which element to apply the command to. | 182 // which element to apply the command to. |
| 183 var session = this.session_; | 183 var session = this.session_; |
| 184 function handleDropDownFocus(e) { | 184 function handleDropDownFocus(e) { |
| 185 DeviceContextMenuController.getInstance().setSession(session); | 185 DeviceContextMenuController.getInstance().setSession(session); |
| 186 } | 186 } |
| 187 heading.addEventListener('contextmenu', handleDropDownFocus); | 187 heading.addEventListener('contextmenu', handleDropDownFocus); |
| 188 | 188 |
| 189 var dropDownButton = new cr.ui.ContextMenuButton; | 189 var dropDownButton = new cr.ui.ContextMenuButton; |
| 190 dropDownButton.tabIndex = 0; | 190 dropDownButton.tabIndex = 0; |
| 191 dropDownButton.classList.add('drop-down'); | 191 dropDownButton.classList.add('drop-down'); |
| 192 dropDownButton.title = loadTimeData.getString('actionMenuDescription'); |
| 192 dropDownButton.addEventListener('mousedown', function(event) { | 193 dropDownButton.addEventListener('mousedown', function(event) { |
| 193 handleDropDownFocus(event); | 194 handleDropDownFocus(event); |
| 194 // Mousedown handling of cr.ui.MenuButton.handleEvent calls | 195 // Mousedown handling of cr.ui.MenuButton.handleEvent calls |
| 195 // preventDefault, which prevents blur of the focused element. We need to | 196 // preventDefault, which prevents blur of the focused element. We need to |
| 196 // do blur manually. | 197 // do blur manually. |
| 197 document.activeElement.blur(); | 198 document.activeElement.blur(); |
| 198 }); | 199 }); |
| 199 dropDownButton.addEventListener('focus', handleDropDownFocus); | 200 dropDownButton.addEventListener('focus', handleDropDownFocus); |
| 200 heading.appendChild(dropDownButton); | 201 heading.appendChild(dropDownButton); |
| 201 | 202 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 236 |
| 236 // Device, Private ------------------------------------------------------------ | 237 // Device, Private ------------------------------------------------------------ |
| 237 | 238 |
| 238 /** | 239 /** |
| 239 * Create the DOM tree representing the tabs and windows of this device. | 240 * Create the DOM tree representing the tabs and windows of this device. |
| 240 * @param {int} maxNumTabs The maximum number of tabs to display. | 241 * @param {int} maxNumTabs The maximum number of tabs to display. |
| 241 * @return {Element} A single div containing the list of tabs & windows. | 242 * @return {Element} A single div containing the list of tabs & windows. |
| 242 * @private | 243 * @private |
| 243 */ | 244 */ |
| 244 Device.prototype.createSessionContents_ = function(maxNumTabs) { | 245 Device.prototype.createSessionContents_ = function(maxNumTabs) { |
| 245 var contents = createElementWithClassName('div', 'device-contents'); | 246 var contents = createElementWithClassName('ol', 'device-contents'); |
| 246 | 247 |
| 247 var sessionTag = this.session_.tag; | 248 var sessionTag = this.session_.tag; |
| 248 var numTabsShown = 0; | 249 var numTabsShown = 0; |
| 249 var numTabsHidden = 0; | 250 var numTabsHidden = 0; |
| 250 for (var i = 0; i < this.session_.windows.length; i++) { | 251 for (var i = 0; i < this.session_.windows.length; i++) { |
| 251 var win = this.session_.windows[i]; | 252 var win = this.session_.windows[i]; |
| 252 if (win.hidden) | 253 if (win.hidden) |
| 253 continue; | 254 continue; |
| 254 | 255 |
| 255 // Show a separator between multiple windows in the same session. | 256 // Show a separator between multiple windows in the same session. |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 551 |
| 551 var doSearch = function(e) { | 552 var doSearch = function(e) { |
| 552 devicesView.setSearchText($('search-field').value); | 553 devicesView.setSearchText($('search-field').value); |
| 553 }; | 554 }; |
| 554 $('search-field').addEventListener('search', doSearch); | 555 $('search-field').addEventListener('search', doSearch); |
| 555 $('search-button').addEventListener('click', doSearch); | 556 $('search-button').addEventListener('click', doSearch); |
| 556 } | 557 } |
| 557 | 558 |
| 558 // Add handlers to HTML elements. | 559 // Add handlers to HTML elements. |
| 559 document.addEventListener('DOMContentLoaded', load); | 560 document.addEventListener('DOMContentLoaded', load); |
| OLD | NEW |