Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / devtools / front_end / components / DataSaverInfobar.js
blobb4a79e0bc25b626a0190cbcb6b19304d9485b87f
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
3 // found in the LICENSE file.
5 /**
6  * @constructor
7  * @extends {WebInspector.Infobar}
8  */
9 WebInspector.DataSaverInfobar = function()
11     WebInspector.Infobar.call(this, WebInspector.Infobar.Type.Warning, WebInspector.settings.moduleSetting("disableDataSaverInfobar"));
12     this.element.createTextChild(WebInspector.UIString("Consider disabling "));
13     this.element.appendChild(WebInspector.linkifyURLAsNode("https://support.google.com/chrome/answer/2392284?hl=en", "Chrome Data Saver", undefined, true));
14     this.element.createTextChild(WebInspector.UIString(" while debugging."));
17 WebInspector.DataSaverInfobar._infobars = [];
19 /**
20  * @param {!WebInspector.Panel} panel
21  */
22 WebInspector.DataSaverInfobar.maybeShowInPanel = function(panel)
24     if (Runtime.queryParam("remoteFrontend")) {
25         var infobar = new WebInspector.DataSaverInfobar();
26         WebInspector.DataSaverInfobar._infobars.push(infobar);
27         panel.showInfobar(infobar);
28     }
31 WebInspector.DataSaverInfobar.prototype = {
32     /**
33      * @override
34      */
35     close: function()
36     {
37         for (var infobar of WebInspector.DataSaverInfobar._infobars)
38             WebInspector.Infobar.prototype.close.call(infobar);
39     },
41     __proto__: WebInspector.Infobar.prototype