OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Controller to handle naming. | 6 * Controller to handle naming. |
7 * | 7 * |
8 * @param {!ListContainer} listContainer | 8 * @param {!ListContainer} listContainer |
9 * @param {!cr.ui.dialogs.AlertDialog} alertDialog | 9 * @param {!cr.ui.dialogs.AlertDialog} alertDialog |
10 * @param {!cr.ui.dialogs.ConfirmDialog} confirmDialog | 10 * @param {!cr.ui.dialogs.ConfirmDialog} confirmDialog |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 /** | 210 /** |
211 * @param {Event} event Key event. | 211 * @param {Event} event Key event. |
212 * @private | 212 * @private |
213 */ | 213 */ |
214 NamingController.prototype.onRenameInputKeyDown_ = function(event) { | 214 NamingController.prototype.onRenameInputKeyDown_ = function(event) { |
215 if (!this.isRenamingInProgress()) | 215 if (!this.isRenamingInProgress()) |
216 return; | 216 return; |
217 | 217 |
218 // Do not move selection or lead item in list during rename. | 218 // Do not move selection or lead item in list during rename. |
219 if (event.keyIdentifier == 'Up' || event.keyIdentifier == 'Down') { | 219 if (event.key === 'ArrowUp' || event.key === 'ArrowDown') { |
220 event.stopPropagation(); | 220 event.stopPropagation(); |
221 } | 221 } |
222 | 222 |
223 switch (util.getKeyModifiers(event) + event.keyIdentifier) { | 223 switch (util.getKeyModifiers(event) + event.key) { |
224 case 'U+001B': // Escape | 224 case 'Escape': |
225 this.cancelRename_(); | 225 this.cancelRename_(); |
226 event.preventDefault(); | 226 event.preventDefault(); |
227 break; | 227 break; |
228 | 228 |
229 case 'Enter': | 229 case 'Enter': |
230 this.commitRename_(); | 230 this.commitRename_(); |
231 event.preventDefault(); | 231 event.preventDefault(); |
232 break; | 232 break; |
233 } | 233 } |
234 }; | 234 }; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 var parent = this.listContainer_.renameInput.parentNode; | 337 var parent = this.listContainer_.renameInput.parentNode; |
338 if (parent) | 338 if (parent) |
339 parent.removeChild(this.listContainer_.renameInput); | 339 parent.removeChild(this.listContainer_.renameInput); |
340 | 340 |
341 this.listContainer_.endBatchUpdates(); | 341 this.listContainer_.endBatchUpdates(); |
342 | 342 |
343 // Focus may go out of the list. Back it to the list. | 343 // Focus may go out of the list. Back it to the list. |
344 this.listContainer_.currentList.focus(); | 344 this.listContainer_.currentList.focus(); |
345 }; | 345 }; |
OLD | NEW |