OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The Chromium Authors. All rights reserved. | 2 * Copyright 2016 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 /** | 6 /** |
7 * @implements {UI.ListWidget.Delegate} | 7 * @implements {UI.ListWidget.Delegate} |
8 * @unrestricted | 8 * @unrestricted |
9 */ | 9 */ |
10 Network.NetworkManageCustomHeadersView = class extends UI.VBox { | 10 Network.NetworkManageCustomHeadersView = class extends UI.VBox { |
(...skipping 11 matching lines...) Expand all Loading... |
22 this.contentElement.createChild('div', 'header').textContent = Common.UIStri
ng('Manage Header Columns'); | 22 this.contentElement.createChild('div', 'header').textContent = Common.UIStri
ng('Manage Header Columns'); |
23 | 23 |
24 this._list = new UI.ListWidget(this); | 24 this._list = new UI.ListWidget(this); |
25 this._list.element.classList.add('custom-headers-list'); | 25 this._list.element.classList.add('custom-headers-list'); |
26 this._list.registerRequiredCSS('network/networkManageCustomHeadersView.css')
; | 26 this._list.registerRequiredCSS('network/networkManageCustomHeadersView.css')
; |
27 | 27 |
28 var placeholder = createElementWithClass('div', 'custom-headers-list-list-em
pty'); | 28 var placeholder = createElementWithClass('div', 'custom-headers-list-list-em
pty'); |
29 placeholder.textContent = Common.UIString('No custom headers'); | 29 placeholder.textContent = Common.UIString('No custom headers'); |
30 this._list.setEmptyPlaceholder(placeholder); | 30 this._list.setEmptyPlaceholder(placeholder); |
31 this._list.show(this.contentElement); | 31 this._list.show(this.contentElement); |
32 this.contentElement.appendChild( | 32 this.contentElement.appendChild(UI.createTextButton( |
33 createTextButton(Common.UIString('Add custom header\u2026'), this._addBu
ttonClicked.bind(this), 'add-button')); | 33 Common.UIString('Add custom header\u2026'), this._addButtonClicked.bind(
this), 'add-button')); |
34 | 34 |
35 /** @type {!Map.<string, !{title: string, editable: boolean}>} */ | 35 /** @type {!Map.<string, !{title: string, editable: boolean}>} */ |
36 this._columnConfigs = new Map(); | 36 this._columnConfigs = new Map(); |
37 columnData.forEach(columnData => this._columnConfigs.set(columnData.title.to
LowerCase(), columnData)); | 37 columnData.forEach(columnData => this._columnConfigs.set(columnData.title.to
LowerCase(), columnData)); |
38 | 38 |
39 this._addHeaderColumnCallback = addHeaderColumnCallback; | 39 this._addHeaderColumnCallback = addHeaderColumnCallback; |
40 this._changeHeaderColumnCallback = changeHeaderColumnCallback; | 40 this._changeHeaderColumnCallback = changeHeaderColumnCallback; |
41 this._removeHeaderColumnCallback = removeHeaderColumnCallback; | 41 this._removeHeaderColumnCallback = removeHeaderColumnCallback; |
42 | 42 |
43 this.contentElement.tabIndex = 0; | 43 this.contentElement.tabIndex = 0; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 * @return {boolean} | 145 * @return {boolean} |
146 */ | 146 */ |
147 function validateHeader(item, index, input) { | 147 function validateHeader(item, index, input) { |
148 var headerId = editor.control('header').value.trim().toLowerCase(); | 148 var headerId = editor.control('header').value.trim().toLowerCase(); |
149 if (this._columnConfigs.has(headerId) && item.header !== headerId) | 149 if (this._columnConfigs.has(headerId) && item.header !== headerId) |
150 return false; | 150 return false; |
151 return true; | 151 return true; |
152 } | 152 } |
153 } | 153 } |
154 }; | 154 }; |
OLD | NEW |