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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {!WebInspector.Infobar.Type} type | 7 * @param {!WebInspector.Infobar.Type} type |
8 * @param {string} text | 8 * @param {string} text |
9 * @param {!WebInspector.Setting=} disableSetting | 9 * @param {!WebInspector.Setting=} disableSetting |
10 */ | 10 */ |
(...skipping 19 matching lines...) Expand all Loading... |
30 var disableButton = this._mainRow.createChild("div", "infobar-toggle"); | 30 var disableButton = this._mainRow.createChild("div", "infobar-toggle"); |
31 disableButton.textContent = WebInspector.UIString("never show"); | 31 disableButton.textContent = WebInspector.UIString("never show"); |
32 disableButton.addEventListener("click", this._onDisable.bind(this), fals
e); | 32 disableButton.addEventListener("click", this._onDisable.bind(this), fals
e); |
33 } | 33 } |
34 | 34 |
35 this._closeButton = this._contentElement.createChild("div", "close-button",
"dt-close-button"); | 35 this._closeButton = this._contentElement.createChild("div", "close-button",
"dt-close-button"); |
36 this._closeButton.addEventListener("click", this.dispose.bind(this), false); | 36 this._closeButton.addEventListener("click", this.dispose.bind(this), false); |
37 | 37 |
38 /** @type {?function()} */ | 38 /** @type {?function()} */ |
39 this._closeCallback = null; | 39 this._closeCallback = null; |
40 } | 40 }; |
41 | 41 |
42 /** | 42 /** |
43 * @param {!WebInspector.Infobar.Type} type | 43 * @param {!WebInspector.Infobar.Type} type |
44 * @param {string} text | 44 * @param {string} text |
45 * @param {!WebInspector.Setting=} disableSetting | 45 * @param {!WebInspector.Setting=} disableSetting |
46 * @return {?WebInspector.Infobar} | 46 * @return {?WebInspector.Infobar} |
47 */ | 47 */ |
48 WebInspector.Infobar.create = function(type, text, disableSetting) | 48 WebInspector.Infobar.create = function(type, text, disableSetting) |
49 { | 49 { |
50 if (disableSetting && disableSetting.get()) | 50 if (disableSetting && disableSetting.get()) |
51 return null; | 51 return null; |
52 return new WebInspector.Infobar(type, text, disableSetting); | 52 return new WebInspector.Infobar(type, text, disableSetting); |
53 } | 53 }; |
54 | 54 |
55 | 55 |
56 /** @enum {string} */ | 56 /** @enum {string} */ |
57 WebInspector.Infobar.Type = { | 57 WebInspector.Infobar.Type = { |
58 Warning: "warning", | 58 Warning: "warning", |
59 Info: "info" | 59 Info: "info" |
60 } | 60 }; |
61 | 61 |
62 WebInspector.Infobar.prototype = { | 62 WebInspector.Infobar.prototype = { |
63 dispose: function() | 63 dispose: function() |
64 { | 64 { |
65 this.element.remove(); | 65 this.element.remove(); |
66 this._onResize(); | 66 this._onResize(); |
67 if (this._closeCallback) | 67 if (this._closeCallback) |
68 this._closeCallback.call(null); | 68 this._closeCallback.call(null); |
69 }, | 69 }, |
70 | 70 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 * @return {!Element} | 117 * @return {!Element} |
118 */ | 118 */ |
119 createDetailsRowMessage: function(message) | 119 createDetailsRowMessage: function(message) |
120 { | 120 { |
121 this._toggleElement.classList.remove("hidden"); | 121 this._toggleElement.classList.remove("hidden"); |
122 var infobarDetailsRow = this._detailsRows.createChild("div", "infobar-de
tails-row"); | 122 var infobarDetailsRow = this._detailsRows.createChild("div", "infobar-de
tails-row"); |
123 var detailsRowMessage = infobarDetailsRow.createChild("span", "infobar-r
ow-message"); | 123 var detailsRowMessage = infobarDetailsRow.createChild("span", "infobar-r
ow-message"); |
124 detailsRowMessage.textContent = message || ""; | 124 detailsRowMessage.textContent = message || ""; |
125 return detailsRowMessage; | 125 return detailsRowMessage; |
126 } | 126 } |
127 } | 127 }; |
OLD | NEW |