| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 this._excludedFolders.push(folder); | 101 this._excludedFolders.push(folder); |
| 102 this._excludedFoldersList.appendItem(folder, true); | 102 this._excludedFoldersList.appendItem(folder, true); |
| 103 } | 103 } |
| 104 | 104 |
| 105 if (Runtime.experiments.isEnabled('persistence2')) | 105 if (Runtime.experiments.isEnabled('persistence2')) |
| 106 return; | 106 return; |
| 107 | 107 |
| 108 this._mappingsList.clear(); | 108 this._mappingsList.clear(); |
| 109 var mappings = Workspace.fileSystemMapping.mappingEntries(this._fileSystemPa
th); | 109 var mappings = Workspace.fileSystemMapping.mappingEntries(this._fileSystemPa
th); |
| 110 for (var entry of mappings) { | 110 for (var entry of mappings) { |
| 111 if (entry.configurable) { | 111 this._mappingsList.appendItem(entry, true); |
| 112 this._mappingsList.appendItem(entry, true); | 112 this._mappings.push(entry); |
| 113 this._mappings.push(entry); | |
| 114 } | |
| 115 } | |
| 116 for (var entry of mappings) { | |
| 117 if (!entry.configurable) { | |
| 118 this._mappingsList.appendItem(entry, false); | |
| 119 this._mappings.push(entry); | |
| 120 } | |
| 121 } | |
| 122 | |
| 123 for (var folder of Workspace.isolatedFileSystemManager.fileSystem(this._file
SystemPath) | |
| 124 .nonConfigurableExcludedFolders() | |
| 125 .values()) { | |
| 126 this._excludedFolders.push(folder); | |
| 127 this._excludedFoldersList.appendItem(folder, false); | |
| 128 } | 113 } |
| 129 } | 114 } |
| 130 | 115 |
| 131 _addMappingButtonClicked() { | 116 _addMappingButtonClicked() { |
| 132 var entry = new Workspace.FileSystemMapping.Entry(this._fileSystemPath, '',
'', true); | 117 var entry = new Workspace.FileSystemMapping.Entry(this._fileSystemPath, '',
''); |
| 133 this._mappingsList.addNewItem(0, entry); | 118 this._mappingsList.addNewItem(0, entry); |
| 134 } | 119 } |
| 135 | 120 |
| 136 _addExcludedFolderButtonClicked() { | 121 _addExcludedFolderButtonClicked() { |
| 137 this._excludedFoldersList.addNewItem(0, ''); | 122 this._excludedFoldersList.addNewItem(0, ''); |
| 138 } | 123 } |
| 139 | 124 |
| 140 /** | 125 /** |
| 141 * @override | 126 * @override |
| 142 * @param {*} item | 127 * @param {*} item |
| 143 * @param {boolean} editable | 128 * @param {boolean} editable |
| 144 * @return {!Element} | 129 * @return {!Element} |
| 145 */ | 130 */ |
| 146 renderItem(item, editable) { | 131 renderItem(item, editable) { |
| 147 var element = createElementWithClass('div', 'file-system-list-item'); | 132 var element = createElementWithClass('div', 'file-system-list-item'); |
| 148 if (!editable) | |
| 149 element.classList.add('locked'); | |
| 150 if (item instanceof Workspace.FileSystemMapping.Entry) { | 133 if (item instanceof Workspace.FileSystemMapping.Entry) { |
| 151 var entry = /** @type {!Workspace.FileSystemMapping.Entry} */ (item); | 134 var entry = /** @type {!Workspace.FileSystemMapping.Entry} */ (item); |
| 152 var urlPrefix = entry.configurable ? entry.urlPrefix : Common.UIString('%s
(via .devtools)', entry.urlPrefix); | |
| 153 var urlPrefixElement = element.createChild('div', 'file-system-value'); | 135 var urlPrefixElement = element.createChild('div', 'file-system-value'); |
| 154 urlPrefixElement.textContent = urlPrefix; | 136 urlPrefixElement.textContent = entry.urlPrefix; |
| 155 urlPrefixElement.title = urlPrefix; | 137 urlPrefixElement.title = entry.urlPrefix; |
| 156 element.createChild('div', 'file-system-separator'); | 138 element.createChild('div', 'file-system-separator'); |
| 157 var pathPrefixElement = element.createChild('div', 'file-system-value'); | 139 var pathPrefixElement = element.createChild('div', 'file-system-value'); |
| 158 pathPrefixElement.textContent = entry.pathPrefix; | 140 pathPrefixElement.textContent = entry.pathPrefix; |
| 159 pathPrefixElement.title = entry.pathPrefix; | 141 pathPrefixElement.title = entry.pathPrefix; |
| 160 } else { | 142 } else { |
| 161 var pathPrefix = /** @type {string} */ (editable ? item : Common.UIString(
'%s (via .devtools)', item)); | 143 var pathPrefix = /** @type {string} */ (editable ? item : Common.UIString(
'%s (via .devtools)', item)); |
| 162 var pathPrefixElement = element.createChild('div', 'file-system-value'); | 144 var pathPrefixElement = element.createChild('div', 'file-system-value'); |
| 163 pathPrefixElement.textContent = pathPrefix; | 145 pathPrefixElement.textContent = pathPrefix; |
| 164 pathPrefixElement.title = pathPrefix; | 146 pathPrefixElement.title = pathPrefix; |
| 165 } | 147 } |
| 166 element.createChild('div', 'file-system-locked').title = Common.UIString('Fr
om .devtools file'); | |
| 167 return element; | 148 return element; |
| 168 } | 149 } |
| 169 | 150 |
| 170 /** | 151 /** |
| 171 * @override | 152 * @override |
| 172 * @param {*} item | 153 * @param {*} item |
| 173 * @param {number} index | 154 * @param {number} index |
| 174 */ | 155 */ |
| 175 removeItemRequested(item, index) { | 156 removeItemRequested(item, index) { |
| 176 if (item instanceof Workspace.FileSystemMapping.Entry) { | 157 if (item instanceof Workspace.FileSystemMapping.Entry) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 /** | 238 /** |
| 258 * @param {*} item | 239 * @param {*} item |
| 259 * @param {number} index | 240 * @param {number} index |
| 260 * @param {!HTMLInputElement|!HTMLSelectElement} input | 241 * @param {!HTMLInputElement|!HTMLSelectElement} input |
| 261 * @return {boolean} | 242 * @return {boolean} |
| 262 * @this {Settings.EditFileSystemView} | 243 * @this {Settings.EditFileSystemView} |
| 263 */ | 244 */ |
| 264 function urlPrefixValidator(item, index, input) { | 245 function urlPrefixValidator(item, index, input) { |
| 265 var prefix = this._normalizePrefix(input.value); | 246 var prefix = this._normalizePrefix(input.value); |
| 266 for (var i = 0; i < this._mappings.length; ++i) { | 247 for (var i = 0; i < this._mappings.length; ++i) { |
| 267 if (i !== index && this._mappings[i].configurable && this._mappings[i].u
rlPrefix === prefix) | 248 if (i !== index && this._mappings[i].urlPrefix === prefix) |
| 268 return false; | 249 return false; |
| 269 } | 250 } |
| 270 return !!prefix; | 251 return !!prefix; |
| 271 } | 252 } |
| 272 | 253 |
| 273 /** | 254 /** |
| 274 * @param {*} item | 255 * @param {*} item |
| 275 * @param {number} index | 256 * @param {number} index |
| 276 * @param {!HTMLInputElement|!HTMLSelectElement} input | 257 * @param {!HTMLInputElement|!HTMLSelectElement} input |
| 277 * @return {boolean} | 258 * @return {boolean} |
| 278 * @this {Settings.EditFileSystemView} | 259 * @this {Settings.EditFileSystemView} |
| 279 */ | 260 */ |
| 280 function pathPrefixValidator(item, index, input) { | 261 function pathPrefixValidator(item, index, input) { |
| 281 var prefix = this._normalizePrefix(input.value); | 262 var prefix = this._normalizePrefix(input.value); |
| 282 for (var i = 0; i < this._mappings.length; ++i) { | 263 for (var i = 0; i < this._mappings.length; ++i) { |
| 283 if (i !== index && this._mappings[i].configurable && this._mappings[i].p
athPrefix === prefix) | 264 if (i !== index && this._mappings[i].pathPrefix === prefix) |
| 284 return false; | 265 return false; |
| 285 } | 266 } |
| 286 return !!prefix; | 267 return !!prefix; |
| 287 } | 268 } |
| 288 } | 269 } |
| 289 | 270 |
| 290 /** | 271 /** |
| 291 * @return {!UI.ListWidget.Editor} | 272 * @return {!UI.ListWidget.Editor} |
| 292 */ | 273 */ |
| 293 _createExcludedFolderEditor() { | 274 _createExcludedFolderEditor() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 /** | 310 /** |
| 330 * @param {string} prefix | 311 * @param {string} prefix |
| 331 * @return {string} | 312 * @return {string} |
| 332 */ | 313 */ |
| 333 _normalizePrefix(prefix) { | 314 _normalizePrefix(prefix) { |
| 334 if (!prefix) | 315 if (!prefix) |
| 335 return ''; | 316 return ''; |
| 336 return prefix + (prefix[prefix.length - 1] === '/' ? '' : '/'); | 317 return prefix + (prefix[prefix.length - 1] === '/' ? '' : '/'); |
| 337 } | 318 } |
| 338 }; | 319 }; |
| OLD | NEW |