| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 UI.ListWidget = class extends UI.VBox { | 7 UI.ListWidget = class extends UI.VBox { |
| 8 /** | 8 /** |
| 9 * @param {!UI.ListWidget.Delegate} delegate | 9 * @param {!UI.ListWidget.Delegate} delegate |
| 10 */ | 10 */ |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 */ | 253 */ |
| 254 UI.ListWidget.Editor = class { | 254 UI.ListWidget.Editor = class { |
| 255 constructor() { | 255 constructor() { |
| 256 this.element = createElementWithClass('div', 'editor-container'); | 256 this.element = createElementWithClass('div', 'editor-container'); |
| 257 this.element.addEventListener('keydown', onKeyDown.bind(null, isEscKey, this
._cancelClicked.bind(this)), false); | 257 this.element.addEventListener('keydown', onKeyDown.bind(null, isEscKey, this
._cancelClicked.bind(this)), false); |
| 258 this.element.addEventListener('keydown', onKeyDown.bind(null, isEnterKey, th
is._commitClicked.bind(this)), false); | 258 this.element.addEventListener('keydown', onKeyDown.bind(null, isEnterKey, th
is._commitClicked.bind(this)), false); |
| 259 | 259 |
| 260 this._contentElement = this.element.createChild('div', 'editor-content'); | 260 this._contentElement = this.element.createChild('div', 'editor-content'); |
| 261 | 261 |
| 262 var buttonsRow = this.element.createChild('div', 'editor-buttons'); | 262 var buttonsRow = this.element.createChild('div', 'editor-buttons'); |
| 263 this._commitButton = createTextButton('', this._commitClicked.bind(this)); | 263 this._commitButton = UI.createTextButton('', this._commitClicked.bind(this))
; |
| 264 buttonsRow.appendChild(this._commitButton); | 264 buttonsRow.appendChild(this._commitButton); |
| 265 this._cancelButton = createTextButton(Common.UIString('Cancel'), this._cance
lClicked.bind(this)); | 265 this._cancelButton = UI.createTextButton(Common.UIString('Cancel'), this._ca
ncelClicked.bind(this)); |
| 266 this._cancelButton.addEventListener( | 266 this._cancelButton.addEventListener( |
| 267 'keydown', onKeyDown.bind(null, isEnterKey, this._cancelClicked.bind(thi
s)), false); | 267 'keydown', onKeyDown.bind(null, isEnterKey, this._cancelClicked.bind(thi
s)), false); |
| 268 buttonsRow.appendChild(this._cancelButton); | 268 buttonsRow.appendChild(this._cancelButton); |
| 269 | 269 |
| 270 /** | 270 /** |
| 271 * @param {function(!Event):boolean} predicate | 271 * @param {function(!Event):boolean} predicate |
| 272 * @param {function()} callback | 272 * @param {function()} callback |
| 273 * @param {!Event} event | 273 * @param {!Event} event |
| 274 */ | 274 */ |
| 275 function onKeyDown(predicate, callback, event) { | 275 function onKeyDown(predicate, callback, event) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 399 |
| 400 _cancelClicked() { | 400 _cancelClicked() { |
| 401 var cancel = this._cancel; | 401 var cancel = this._cancel; |
| 402 this._commit = null; | 402 this._commit = null; |
| 403 this._cancel = null; | 403 this._cancel = null; |
| 404 this._item = null; | 404 this._item = null; |
| 405 this._index = -1; | 405 this._index = -1; |
| 406 cancel(); | 406 cancel(); |
| 407 } | 407 } |
| 408 }; | 408 }; |
| OLD | NEW |