| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Sources.AddSourceMapURLDialog = class extends UI.HBox { | 7 Sources.AddSourceMapURLDialog = class extends UI.HBox { |
| 8 /** | 8 /** |
| 9 * @param {function(string)} callback | 9 * @param {function(string)} callback |
| 10 */ | 10 */ |
| 11 constructor(callback) { | 11 constructor(callback) { |
| 12 super(true); | 12 super(true); |
| 13 this.registerRequiredCSS('sources/dialog.css'); | 13 this.registerRequiredCSS('sources/dialog.css'); |
| 14 this.contentElement.createChild('label').textContent = Common.UIString('Sour
ce map URL: '); | 14 this.contentElement.createChild('label').textContent = Common.UIString('Sour
ce map URL: '); |
| 15 | 15 |
| 16 this._input = this.contentElement.createChild('input'); | 16 this._input = UI.createInput(); |
| 17 this.contentElement.appendChild(this._input); |
| 17 this._input.setAttribute('type', 'text'); | 18 this._input.setAttribute('type', 'text'); |
| 18 this._input.addEventListener('keydown', this._onKeyDown.bind(this), false); | 19 this._input.addEventListener('keydown', this._onKeyDown.bind(this), false); |
| 19 | 20 |
| 20 var addButton = this.contentElement.createChild('button'); | 21 var addButton = this.contentElement.createChild('button'); |
| 21 addButton.textContent = Common.UIString('Add'); | 22 addButton.textContent = Common.UIString('Add'); |
| 22 addButton.addEventListener('click', this._apply.bind(this), false); | 23 addButton.addEventListener('click', this._apply.bind(this), false); |
| 23 | 24 |
| 24 this.setDefaultFocusedElement(this._input); | 25 this.setDefaultFocusedElement(this._input); |
| 25 this._callback = callback; | 26 this._callback = callback; |
| 26 this.contentElement.tabIndex = 0; | 27 this.contentElement.tabIndex = 0; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 52 /** | 53 /** |
| 53 * @param {!Event} event | 54 * @param {!Event} event |
| 54 */ | 55 */ |
| 55 _onKeyDown(event) { | 56 _onKeyDown(event) { |
| 56 if (event.keyCode === UI.KeyboardShortcut.Keys.Enter.code) { | 57 if (event.keyCode === UI.KeyboardShortcut.Keys.Enter.code) { |
| 57 event.preventDefault(); | 58 event.preventDefault(); |
| 58 this._apply(); | 59 this._apply(); |
| 59 } | 60 } |
| 60 } | 61 } |
| 61 }; | 62 }; |
| OLD | NEW |