Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ec46701c6aadbcebcae85dd47bbc2c896172b04a |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js |
| @@ -0,0 +1,39 @@ |
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
|
dgozman
2016/10/14 03:14:58
Wrong copyright.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @constructor |
| + * @extends {WebInspector.Panel} |
| + */ |
| +WebInspector.Audits2Panel = function() |
| +{ |
| + WebInspector.Panel.call(this, "audits2"); |
| + this.contentElement.classList.add("vbox"); |
| + this.contentElement.appendChild(createTextButton(WebInspector.UIString("Start"), this._start.bind(this))); |
| + this.contentElement.appendChild(createTextButton(WebInspector.UIString("Stop"), this._stop.bind(this))); |
| +} |
| + |
| +WebInspector.Audits2Panel.prototype = { |
| + _start: function() |
| + { |
| + return this._backend().then(backend => backend ? backend.send("start") : undefined).then(console.error.bind(console, "STARTED")); |
| + }, |
| + |
| + _stop: function() |
| + { |
| + return this._backend().then(backend => backend ? backend.send("stop") : undefined).then(console.error.bind(console, "STOPPED")); |
| + }, |
| + |
| + /** |
| + * @param {?WebInspector.ServiceManager.Service} backend |
| + */ |
| + _backend: function(backend) |
| + { |
| + if (!this._backendPromise) |
| + this._backendPromise = WebInspector.serviceManager.createAppService("audits2_worker", "Audits2Service"); |
| + return this._backendPromise; |
| + }, |
| + |
| + __proto__: WebInspector.Panel.prototype |
| +} |