OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 6 * @fileoverview |
7 * Class representing an entry in the host-list portion of the home screen. | 7 * Class representing an entry in the host-list portion of the home screen. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Create the host icon cell. | 73 // Create the host icon cell. |
74 var hostIcon = /** @type {HTMLElement} */ document.createElement('img'); | 74 var hostIcon = /** @type {HTMLElement} */ document.createElement('img'); |
75 hostIcon.src = 'icon_host.png'; | 75 hostIcon.src = 'icon_host.png'; |
76 hostIcon.classList.add('host-list-main-icon'); | 76 hostIcon.classList.add('host-list-main-icon'); |
77 tableRow.appendChild(hostIcon); | 77 tableRow.appendChild(hostIcon); |
78 // Create the host name cell. | 78 // Create the host name cell. |
79 var hostNameCell = /** @type {HTMLElement} */ document.createElement('div'); | 79 var hostNameCell = /** @type {HTMLElement} */ document.createElement('div'); |
80 hostNameCell.classList.add('box-spacer'); | 80 hostNameCell.classList.add('box-spacer'); |
81 tableRow.appendChild(hostNameCell); | 81 tableRow.appendChild(hostNameCell); |
82 // Create the host rename cell. | 82 // Create the host rename cell. |
83 var editButton = /** @type {HTMLElement} */ document.createElement('img'); | 83 var editButton = /** @type {HTMLElement} */ document.createElement('span'); |
84 editButton.title = chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_RENAME'); | 84 var editButtonImg = /** @type {HTMLElement} */ document.createElement('img'); |
85 editButton.src = 'icon_pencil.png'; | 85 editButtonImg.title = chrome.i18n.getMessage( |
| 86 /*i18n-content*/'TOOLTIP_RENAME'); |
| 87 editButtonImg.src = 'icon_pencil.png'; |
86 editButton.tabIndex = 0; | 88 editButton.tabIndex = 0; |
87 editButton.classList.add('clickable'); | 89 editButton.classList.add('clickable'); |
88 editButton.classList.add('host-list-edit'); | 90 editButton.classList.add('host-list-edit'); |
89 editButton.classList.add('host-list-rename-icon'); | 91 editButtonImg.classList.add('host-list-rename-icon'); |
| 92 editButton.appendChild(editButtonImg); |
90 tableRow.appendChild(editButton); | 93 tableRow.appendChild(editButton); |
91 // Create the host delete cell. | 94 // Create the host delete cell. |
92 var deleteButton = /** @type {HTMLElement} */ document.createElement('img'); | 95 var deleteButton = /** @type {HTMLElement} */ document.createElement('span'); |
93 deleteButton.title = chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_DELETE'); | 96 var deleteButtonImg = |
94 deleteButton.src = 'icon_cross.png'; | 97 /** @type {HTMLElement} */ document.createElement('img'); |
| 98 deleteButtonImg.title = |
| 99 chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_DELETE'); |
| 100 deleteButtonImg.src = 'icon_cross.png'; |
95 deleteButton.tabIndex = 0; | 101 deleteButton.tabIndex = 0; |
96 deleteButton.classList.add('clickable'); | 102 deleteButton.classList.add('clickable'); |
97 deleteButton.classList.add('host-list-edit'); | 103 deleteButton.classList.add('host-list-edit'); |
98 deleteButton.classList.add('host-list-remove-icon'); | 104 deleteButtonImg.classList.add('host-list-remove-icon'); |
| 105 deleteButton.appendChild(deleteButtonImg); |
99 tableRow.appendChild(deleteButton); | 106 tableRow.appendChild(deleteButton); |
100 | 107 |
101 this.init(host, tableRow, hostNameCell, editButton, onRename, | 108 this.init(host, tableRow, hostNameCell, editButton, onRename, |
102 deleteButton, onDelete); | 109 deleteButton, onDelete); |
103 }; | 110 }; |
104 | 111 |
105 | 112 |
106 /** | 113 /** |
107 * Associate the table row with the specified elements and callbacks, and set | 114 * Associate the table row with the specified elements and callbacks, and set |
108 * up event handlers. | 115 * up event handlers. |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 var element = document.activeElement; | 393 var element = document.activeElement; |
387 while (element) { | 394 while (element) { |
388 if (element == this.tableRow) { | 395 if (element == this.tableRow) { |
389 this.tableRow.classList.add('child-focused'); | 396 this.tableRow.classList.add('child-focused'); |
390 return; | 397 return; |
391 } | 398 } |
392 element = element.parentNode; | 399 element = element.parentNode; |
393 } | 400 } |
394 this.tableRow.classList.remove('child-focused'); | 401 this.tableRow.classList.remove('child-focused'); |
395 }; | 402 }; |
OLD | NEW |