Chromium Code Reviews| 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 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 */ | 8 */ |
| 9 WebInspector.PromisesPanel = function() | 9 WebInspector.PromisePane = function() |
| 10 { | 10 { |
| 11 WebInspector.VBox.call(this); | 11 WebInspector.VBox.call(this); |
| 12 this.registerRequiredCSS("promisesPanel.css"); | 12 this.registerRequiredCSS("promisePane.css"); |
| 13 this.element.classList.add("promises"); | 13 this.element.classList.add("promises"); |
| 14 | 14 |
| 15 var buttonsBar = this.element.createChild("div"); | 15 var buttonsBar = this.element.createChild("div"); |
| 16 buttonsBar.classList.add("promise-tracker-controls"); | |
|
aandrey
2014/09/24 14:51:39
var buttonsBar = this.element.createChild("div", "
Alexandra Mikhaylova
2014/09/24 15:20:46
Done.
| |
| 16 var enableButton = buttonsBar.createChild("button"); | 17 var enableButton = buttonsBar.createChild("button"); |
| 17 enableButton.textContent = WebInspector.UIString("Enable Promises tracking") ; | 18 enableButton.textContent = WebInspector.UIString("Enable Promises tracking") ; |
| 18 enableButton.addEventListener("click", this._enableButtonClicked.bind(this)) ; | 19 enableButton.addEventListener("click", this._enableButtonClicked.bind(this)) ; |
| 19 var disableButton = buttonsBar.createChild("button"); | 20 var disableButton = buttonsBar.createChild("button"); |
| 20 disableButton.textContent = WebInspector.UIString("Disable Promises tracking "); | 21 disableButton.textContent = WebInspector.UIString("Disable Promises tracking "); |
| 21 disableButton.addEventListener("click", this._disableButtonClicked.bind(this )); | 22 disableButton.addEventListener("click", this._disableButtonClicked.bind(this )); |
| 22 var refreshButton = buttonsBar.createChild("button"); | 23 var refreshButton = buttonsBar.createChild("button"); |
| 23 refreshButton.textContent = WebInspector.UIString("Refresh"); | 24 refreshButton.textContent = WebInspector.UIString("Refresh"); |
| 24 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this )); | 25 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this )); |
| 25 var clearButton = buttonsBar.createChild("button"); | 26 var clearButton = buttonsBar.createChild("button"); |
| 26 clearButton.textContent = WebInspector.UIString("Clear"); | 27 clearButton.textContent = WebInspector.UIString("Clear"); |
| 27 clearButton.addEventListener("click", this._clearButtonClicked.bind(this)); | 28 clearButton.addEventListener("click", this._clearButtonClicked.bind(this)); |
| 28 | 29 |
| 29 this._dataGridContainer = new WebInspector.VBox(); | 30 this._dataGridContainer = new WebInspector.VBox(); |
| 30 this._dataGridContainer.show(this.element); | 31 this._dataGridContainer.show(this.element); |
| 31 var columns = [ | 32 var columns = [ |
| 32 { id: "promiseId", title: WebInspector.UIString("Promise ID"), disclosur e: true }, | 33 { id: "promiseId", title: WebInspector.UIString("Promise ID"), disclosur e: true }, |
| 33 { id: "status", title: WebInspector.UIString("Status") }, | 34 { id: "status", title: WebInspector.UIString("Status") }, |
| 34 { id: "location", title: WebInspector.UIString("Location") } | 35 { id: "location", title: WebInspector.UIString("Location") } |
| 35 ]; | 36 ]; |
| 36 this._dataGrid = new WebInspector.DataGrid(columns); | 37 this._dataGrid = new WebInspector.DataGrid(columns); |
| 37 this._dataGrid.show(this._dataGridContainer.element); | 38 this._dataGrid.show(this._dataGridContainer.element); |
| 38 | 39 |
| 39 this._linkifier = new WebInspector.Linkifier(); | 40 this._linkifier = new WebInspector.Linkifier(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 WebInspector.PromisesPanel.prototype = { | 43 WebInspector.PromisePane.prototype = { |
| 43 _refreshButtonClicked: function(event) | 44 _refreshButtonClicked: function(event) |
| 44 { | 45 { |
| 45 this._updateData(); | 46 this._updateData(); |
| 46 }, | 47 }, |
| 47 | 48 |
| 48 _clearButtonClicked: function(event) | 49 _clearButtonClicked: function(event) |
| 49 { | 50 { |
| 50 this._clear(); | 51 this._clear(); |
| 51 }, | 52 }, |
| 52 | 53 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 82 if (p1.id > p2.id) | 83 if (p1.id > p2.id) |
| 83 return 1; | 84 return 1; |
| 84 return 0; | 85 return 0; |
| 85 }, | 86 }, |
| 86 | 87 |
| 87 _updateData: function() | 88 _updateData: function() |
| 88 { | 89 { |
| 89 /** | 90 /** |
| 90 * @param {?Protocol.Error} error | 91 * @param {?Protocol.Error} error |
| 91 * @param {?Array.<!DebuggerAgent.PromiseDetails>} promiseData | 92 * @param {?Array.<!DebuggerAgent.PromiseDetails>} promiseData |
| 92 * @this {WebInspector.PromisesPanel} | 93 * @this {WebInspector.PromisePane} |
| 93 */ | 94 */ |
| 94 function callback(error, promiseData) | 95 function callback(error, promiseData) |
| 95 { | 96 { |
| 96 if (error || !promiseData) | 97 if (error || !promiseData) |
| 97 return; | 98 return; |
| 98 | 99 |
| 99 promiseData.sort(this._comparePromises); | 100 promiseData.sort(this._comparePromises); |
| 100 var nodesToInsert = { __proto__: null }; | 101 var nodesToInsert = { __proto__: null }; |
| 101 for (var i = 0; i < promiseData.length; i++) { | 102 for (var i = 0; i < promiseData.length; i++) { |
| 102 var promise = promiseData[i]; | 103 var promise = promiseData[i]; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 127 | 128 |
| 128 _clear: function() | 129 _clear: function() |
| 129 { | 130 { |
| 130 this._dataGrid.rootNode().removeChildren(); | 131 this._dataGrid.rootNode().removeChildren(); |
| 131 this._linkifier.reset(); | 132 this._linkifier.reset(); |
| 132 }, | 133 }, |
| 133 | 134 |
| 134 __proto__: WebInspector.VBox.prototype | 135 __proto__: WebInspector.VBox.prototype |
| 135 } | 136 } |
| 136 | 137 |
| OLD | NEW |