| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Devices.DevicesView = class extends UI.VBox { | 7 Devices.DevicesView = class extends UI.VBox { |
| 8 constructor() { | 8 constructor() { |
| 9 super(true); | 9 super(true); |
| 10 this.registerRequiredCSS('devices/devicesView.css'); | 10 this.registerRequiredCSS('devices/devicesView.css'); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 this._list.registerRequiredCSS('devices/devicesView.css'); | 474 this._list.registerRequiredCSS('devices/devicesView.css'); |
| 475 this._list.element.classList.add('network-discovery-list'); | 475 this._list.element.classList.add('network-discovery-list'); |
| 476 var placeholder = createElementWithClass('div', 'network-discovery-list-empt
y'); | 476 var placeholder = createElementWithClass('div', 'network-discovery-list-empt
y'); |
| 477 placeholder.textContent = | 477 placeholder.textContent = |
| 478 nodeFrontend ? Common.UIString('No connections specified') : Common.UISt
ring('No addresses defined'); | 478 nodeFrontend ? Common.UIString('No connections specified') : Common.UISt
ring('No addresses defined'); |
| 479 this._list.setEmptyPlaceholder(placeholder); | 479 this._list.setEmptyPlaceholder(placeholder); |
| 480 this._list.show(this.element); | 480 this._list.show(this.element); |
| 481 | 481 |
| 482 var addButton = UI.createTextButton( | 482 var addButton = UI.createTextButton( |
| 483 nodeFrontend ? Common.UIString('Add connection') : Common.UIString('Add
address'), | 483 nodeFrontend ? Common.UIString('Add connection') : Common.UIString('Add
address'), |
| 484 this._addNetworkTargetButtonClicked.bind(this), 'add-network-target-butt
on'); | 484 this._addNetworkTargetButtonClicked.bind(this), 'add-network-target-butt
on', true /* primary */); |
| 485 this.element.appendChild(addButton); | 485 this.element.appendChild(addButton); |
| 486 | 486 |
| 487 /** @type {!Array<{address: string}>} */ | 487 /** @type {!Array<{address: string}>} */ |
| 488 this._networkDiscoveryConfig = []; | 488 this._networkDiscoveryConfig = []; |
| 489 this._networkDiscoveryEnabled = false; | 489 this._networkDiscoveryEnabled = false; |
| 490 | 490 |
| 491 if (nodeFrontend) { | 491 if (nodeFrontend) { |
| 492 this.element.classList.add('node-frontend'); | 492 this.element.classList.add('node-frontend'); |
| 493 this._list.element.classList.add('node-frontend'); | 493 this._list.element.classList.add('node-frontend'); |
| 494 addButton.classList.add('material-button', 'default'); | |
| 495 } | 494 } |
| 496 } | 495 } |
| 497 | 496 |
| 498 _update() { | 497 _update() { |
| 499 var config = this._networkDiscoveryConfig.map(item => item.address); | 498 var config = this._networkDiscoveryConfig.map(item => item.address); |
| 500 this._callback.call(null, this._networkDiscoveryEnabled, config); | 499 this._callback.call(null, this._networkDiscoveryEnabled, config); |
| 501 } | 500 } |
| 502 | 501 |
| 503 _addNetworkTargetButtonClicked() { | 502 _addNetworkTargetButtonClicked() { |
| 504 this._list.addNewItem(this._networkDiscoveryConfig.length, {address: ''}); | 503 this._list.addNewItem(this._networkDiscoveryConfig.length, {address: ''}); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 } | 576 } |
| 578 | 577 |
| 579 /** | 578 /** |
| 580 * @return {!UI.ListWidget.Editor} | 579 * @return {!UI.ListWidget.Editor} |
| 581 */ | 580 */ |
| 582 _createEditor() { | 581 _createEditor() { |
| 583 if (this._editor) | 582 if (this._editor) |
| 584 return this._editor; | 583 return this._editor; |
| 585 | 584 |
| 586 var editor = new UI.ListWidget.Editor(); | 585 var editor = new UI.ListWidget.Editor(); |
| 587 editor.setMaterial(this._nodeFrontend); | |
| 588 this._editor = editor; | 586 this._editor = editor; |
| 589 var content = editor.contentElement(); | 587 var content = editor.contentElement(); |
| 590 var fields = content.createChild('div', 'network-discovery-edit-row'); | 588 var fields = content.createChild('div', 'network-discovery-edit-row'); |
| 591 var input = editor.createInput('address', 'text', 'Network address (e.g. loc
alhost:9229)', addressValidator); | 589 var input = editor.createInput('address', 'text', 'Network address (e.g. loc
alhost:9229)', addressValidator); |
| 592 fields.createChild('div', 'network-discovery-value network-discovery-address
').appendChild(input); | 590 fields.createChild('div', 'network-discovery-value network-discovery-address
').appendChild(input); |
| 593 return editor; | 591 return editor; |
| 594 | 592 |
| 595 /** | 593 /** |
| 596 * @param {*} item | 594 * @param {*} item |
| 597 * @param {number} index | 595 * @param {number} index |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 | 930 |
| 933 /** | 931 /** |
| 934 * @param {!Common.Event} event | 932 * @param {!Common.Event} event |
| 935 */ | 933 */ |
| 936 _devicesDiscoveryConfigChanged(event) { | 934 _devicesDiscoveryConfigChanged(event) { |
| 937 this._config = /** @type {!Adb.Config} */ (event.data); | 935 this._config = /** @type {!Adb.Config} */ (event.data); |
| 938 this._networkDiscoveryView.discoveryConfigChanged( | 936 this._networkDiscoveryView.discoveryConfigChanged( |
| 939 this._config.networkDiscoveryEnabled, this._config.networkDiscoveryConfi
g); | 937 this._config.networkDiscoveryEnabled, this._config.networkDiscoveryConfi
g); |
| 940 } | 938 } |
| 941 }; | 939 }; |
| OLD | NEW |