| 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 */ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 this._callback = callback; | 25 this._callback = callback; |
| 26 this.contentElement.tabIndex = 0; | 26 this.contentElement.tabIndex = 0; |
| 27 } | 27 } |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * @param {function(string)} callback | 30 * @param {function(string)} callback |
| 31 */ | 31 */ |
| 32 static show(callback) { | 32 static show(callback) { |
| 33 var dialog = new UI.Dialog(); | 33 var dialog = new UI.Dialog(); |
| 34 var addSourceMapURLDialog = new Sources.AddSourceMapURLDialog(done); | 34 var addSourceMapURLDialog = new Sources.AddSourceMapURLDialog(done); |
| 35 addSourceMapURLDialog.show(dialog.element); | 35 addSourceMapURLDialog.show(dialog.contentElement); |
| 36 dialog.setWrapsContent(true); | 36 dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent); |
| 37 dialog.show(); | 37 dialog.showDialog(); |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * @param {string} value | 40 * @param {string} value |
| 41 */ | 41 */ |
| 42 function done(value) { | 42 function done(value) { |
| 43 dialog.detach(); | 43 dialog.hideDialog(); |
| 44 callback(value); | 44 callback(value); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 _apply() { | 48 _apply() { |
| 49 this._callback(this._input.value); | 49 this._callback(this._input.value); |
| 50 } | 50 } |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * @param {!Event} event | 53 * @param {!Event} event |
| 54 */ | 54 */ |
| 55 _onKeyDown(event) { | 55 _onKeyDown(event) { |
| 56 if (event.keyCode === UI.KeyboardShortcut.Keys.Enter.code) { | 56 if (event.keyCode === UI.KeyboardShortcut.Keys.Enter.code) { |
| 57 event.preventDefault(); | 57 event.preventDefault(); |
| 58 this._apply(); | 58 this._apply(); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 }; | 61 }; |
| OLD | NEW |