OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 Audits2.Audits2Panel = class extends UI.Panel { | 7 Audits2.Audits2Panel = class extends UI.Panel { |
8 constructor() { | 8 constructor() { |
9 super('audits2'); | 9 super('audits2'); |
10 this.contentElement.classList.add('vbox'); | 10 this.contentElement.classList.add('vbox'); |
11 this.contentElement.appendChild(createTextButton(Common.UIString('Start'), t
his._start.bind(this))); | 11 this.contentElement.appendChild(UI.createTextButton(Common.UIString('Start')
, this._start.bind(this))); |
12 this.contentElement.appendChild(createTextButton(Common.UIString('Stop'), th
is._stop.bind(this))); | 12 this.contentElement.appendChild(UI.createTextButton(Common.UIString('Stop'),
this._stop.bind(this))); |
13 this._resultElement = this.contentElement.createChild('div', 'overflow-auto'
); | 13 this._resultElement = this.contentElement.createChild('div', 'overflow-auto'
); |
14 } | 14 } |
15 | 15 |
16 _start() { | 16 _start() { |
17 SDK.targetManager.interceptMainConnection(this._dispatchProtocolMessage.bind
(this)).then(rawConnection => { | 17 SDK.targetManager.interceptMainConnection(this._dispatchProtocolMessage.bind
(this)).then(rawConnection => { |
18 this._rawConnection = rawConnection; | 18 this._rawConnection = rawConnection; |
19 this._send('start').then(result => { | 19 this._send('start').then(result => { |
20 var section = new Components.ObjectPropertiesSection( | 20 var section = new Components.ObjectPropertiesSection( |
21 SDK.RemoteObject.fromLocalObject(result), Common.UIString('Audit Res
ults')); | 21 SDK.RemoteObject.fromLocalObject(result), Common.UIString('Audit Res
ults')); |
22 this._resultElement.appendChild(section.element); | 22 this._resultElement.appendChild(section.element); |
(...skipping 27 matching lines...) Expand all Loading... |
50 if (!this._backendPromise) { | 50 if (!this._backendPromise) { |
51 this._backendPromise = | 51 this._backendPromise = |
52 Services.serviceManager.createAppService('audits2_worker', 'Audits2Ser
vice', false).then(backend => { | 52 Services.serviceManager.createAppService('audits2_worker', 'Audits2Ser
vice', false).then(backend => { |
53 this._backend = backend; | 53 this._backend = backend; |
54 this._backend.on('sendProtocolMessage', result => this._rawConnectio
n.sendMessage(result.message)); | 54 this._backend.on('sendProtocolMessage', result => this._rawConnectio
n.sendMessage(result.message)); |
55 }); | 55 }); |
56 } | 56 } |
57 return this._backendPromise.then(() => this._backend ? this._backend.send(me
thod, params) : undefined); | 57 return this._backendPromise.then(() => this._backend ? this._backend.send(me
thod, params) : undefined); |
58 } | 58 } |
59 }; | 59 }; |
OLD | NEW |