Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / devtools / front_end / sources / AddSourceMapURLDialog.js
blob9403e850e5aea3658e109664ece3a741ff380930
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
3 // found in the LICENSE file.
5 /**
6  * @constructor
7  * @extends {WebInspector.DialogDelegate}
8  * @param {function(string)} callback
9  */
10 WebInspector.AddSourceMapURLDialog = function(callback)
12     WebInspector.DialogDelegate.call(this);
13     this.element.classList.add("go-to-line-dialog");
14     this.element.createChild("label").textContent = WebInspector.UIString("Source map URL: ");
16     this._input = this.element.createChild("input");
17     this._input.setAttribute("type", "text");
19     this._goButton = this.element.createChild("button");
20     this._goButton.textContent = WebInspector.UIString("Go");
21     this._goButton.addEventListener("click", this._onGoClick.bind(this), false);
23     this._callback = callback;
26 /**
27  * @param {!Element} element
28  * @param {function(string)} callback
29  */
30 WebInspector.AddSourceMapURLDialog.show = function(element, callback)
32     WebInspector.Dialog.show(element, new WebInspector.AddSourceMapURLDialog(callback));
35 WebInspector.AddSourceMapURLDialog.prototype = {
36     focus: function()
37     {
38         WebInspector.setCurrentFocusElement(this._input);
39         this._input.select();
40     },
42     _onGoClick: function()
43     {
44         this._apply();
45         WebInspector.Dialog.hide();
46     },
48     _apply: function()
49     {
50         var value = this._input.value;
51         this._callback(value);
52     },
54     onEnter: function()
55     {
56         this._apply();
57     },
59     __proto__: WebInspector.DialogDelegate.prototype