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 /** |
| 5 * @unrestricted |
| 6 */ |
| 7 WebInspector.DataSaverInfobar = class extends WebInspector.Infobar { |
| 8 constructor() { |
| 9 super( |
| 10 WebInspector.Infobar.Type.Warning, |
| 11 WebInspector.UIString('Consider disabling Chrome Data Saver while debugg
ing.'), |
| 12 WebInspector.settings.moduleSetting('disableDataSaverInfobar')); |
| 13 var message = this.createDetailsRowMessage(); |
| 14 message.createTextChild('More information about '); |
| 15 message.appendChild(WebInspector.linkifyURLAsNode( |
| 16 'https://support.google.com/chrome/answer/2392284?hl=en', 'Chrome Data S
aver', undefined, true)); |
| 17 message.createTextChild('.'); |
| 18 } |
4 | 19 |
5 /** | 20 /** |
6 * @constructor | 21 * @param {!WebInspector.Panel} panel |
7 * @extends {WebInspector.Infobar} | 22 */ |
8 */ | 23 static maybeShowInPanel(panel) { |
9 WebInspector.DataSaverInfobar = function() | 24 if (Runtime.queryParam('remoteFrontend')) { |
10 { | 25 var infobar = new WebInspector.DataSaverInfobar(); |
11 WebInspector.Infobar.call(this, WebInspector.Infobar.Type.Warning, WebInspec
tor.UIString("Consider disabling Chrome Data Saver while debugging."), WebInspec
tor.settings.moduleSetting("disableDataSaverInfobar")); | 26 WebInspector.DataSaverInfobar._infobars.push(infobar); |
12 var message = this.createDetailsRowMessage(); | 27 panel.showInfobar(infobar); |
13 message.createTextChild("More information about "); | 28 } |
14 message.appendChild(WebInspector.linkifyURLAsNode("https://support.google.co
m/chrome/answer/2392284?hl=en", "Chrome Data Saver", undefined, true)); | 29 } |
15 message.createTextChild("."); | 30 |
| 31 /** |
| 32 * @override |
| 33 */ |
| 34 dispose() { |
| 35 for (var infobar of WebInspector.DataSaverInfobar._infobars) |
| 36 infobar.dispose(); |
| 37 } |
16 }; | 38 }; |
17 | 39 |
18 WebInspector.DataSaverInfobar._infobars = []; | 40 WebInspector.DataSaverInfobar._infobars = []; |
19 | 41 |
20 /** | |
21 * @param {!WebInspector.Panel} panel | |
22 */ | |
23 WebInspector.DataSaverInfobar.maybeShowInPanel = function(panel) | |
24 { | |
25 if (Runtime.queryParam("remoteFrontend")) { | |
26 var infobar = new WebInspector.DataSaverInfobar(); | |
27 WebInspector.DataSaverInfobar._infobars.push(infobar); | |
28 panel.showInfobar(infobar); | |
29 } | |
30 }; | |
31 | 42 |
32 WebInspector.DataSaverInfobar.prototype = { | |
33 /** | |
34 * @override | |
35 */ | |
36 dispose: function() | |
37 { | |
38 for (var infobar of WebInspector.DataSaverInfobar._infobars) | |
39 WebInspector.Infobar.prototype.dispose.call(infobar); | |
40 }, | |
41 | |
42 __proto__: WebInspector.Infobar.prototype | |
43 }; | |
OLD | NEW |