| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 headerText.textContent = WebInspector.UIString("Edit file system"); | 44 headerText.textContent = WebInspector.UIString("Edit file system"); |
| 45 | 45 |
| 46 var closeButton = header.createChild("div", "done-button", "dt-close-button"
); | 46 var closeButton = header.createChild("div", "done-button", "dt-close-button"
); |
| 47 closeButton.gray = true; | 47 closeButton.gray = true; |
| 48 closeButton.addEventListener("click", this._onDoneClick.bind(this), false); | 48 closeButton.addEventListener("click", this._onDoneClick.bind(this), false); |
| 49 | 49 |
| 50 var contents = this.element.createChild("div", "contents"); | 50 var contents = this.element.createChild("div", "contents"); |
| 51 | 51 |
| 52 WebInspector.fileSystemMapping.addEventListener(WebInspector.FileSystemMappi
ng.Events.FileMappingAdded, this._fileMappingAdded, this); | 52 WebInspector.fileSystemMapping.addEventListener(WebInspector.FileSystemMappi
ng.Events.FileMappingAdded, this._fileMappingAdded, this); |
| 53 WebInspector.fileSystemMapping.addEventListener(WebInspector.FileSystemMappi
ng.Events.FileMappingRemoved, this._fileMappingRemoved, this); | 53 WebInspector.fileSystemMapping.addEventListener(WebInspector.FileSystemMappi
ng.Events.FileMappingRemoved, this._fileMappingRemoved, this); |
| 54 WebInspector.isolatedFileSystemManager.excludedFolderManager().addEventListe
ner(WebInspector.ExcludedFolderManager.Events.ExcludedFolderAdded, this._exclude
dFolderAdded, this); | 54 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate
dFileSystemManager.Events.ExcludedFolderAdded, this._excludedFolderAdded, this); |
| 55 WebInspector.isolatedFileSystemManager.excludedFolderManager().addEventListe
ner(WebInspector.ExcludedFolderManager.Events.ExcludedFolderRemoved, this._exclu
dedFolderRemoved, this); | 55 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate
dFileSystemManager.Events.ExcludedFolderRemoved, this._excludedFolderRemoved, th
is); |
| 56 | 56 |
| 57 var blockHeader = contents.createChild("div", "block-header"); | 57 var blockHeader = contents.createChild("div", "block-header"); |
| 58 blockHeader.textContent = WebInspector.UIString("Mappings"); | 58 blockHeader.textContent = WebInspector.UIString("Mappings"); |
| 59 this._fileMappingsSection = contents.createChild("div", "section"); | 59 this._fileMappingsSection = contents.createChild("div", "section"); |
| 60 this._fileMappingsListContainer = this._fileMappingsSection.createChild("div
", "settings-list-container"); | 60 this._fileMappingsListContainer = this._fileMappingsSection.createChild("div
", "settings-list-container"); |
| 61 var entries = WebInspector.fileSystemMapping.mappingEntries(this._fileSystem
Path); | 61 var entries = WebInspector.fileSystemMapping.mappingEntries(this._fileSystem
Path); |
| 62 | 62 |
| 63 var urlColumn = { id: "url", placeholder: WebInspector.UIString("URL prefix"
) }; | 63 var urlColumn = { id: "url", placeholder: WebInspector.UIString("URL prefix"
) }; |
| 64 var pathColumn = { id: "path", placeholder: WebInspector.UIString("Folder pa
th") }; | 64 var pathColumn = { id: "path", placeholder: WebInspector.UIString("Folder pa
th") }; |
| 65 | 65 |
| 66 this._fileMappingsList = new WebInspector.EditableSettingsList([urlColumn, p
athColumn], this._fileMappingValuesProvider.bind(this), this._fileMappingValidat
e.bind(this), this._fileMappingEdit.bind(this)); | 66 this._fileMappingsList = new WebInspector.EditableSettingsList([urlColumn, p
athColumn], this._fileMappingValuesProvider.bind(this), this._fileMappingValidat
e.bind(this), this._fileMappingEdit.bind(this)); |
| 67 this._fileMappingsList.addEventListener(WebInspector.SettingsList.Events.Rem
oved, this._fileMappingRemovedfromList.bind(this)); | 67 this._fileMappingsList.addEventListener(WebInspector.SettingsList.Events.Rem
oved, this._fileMappingRemovedfromList.bind(this)); |
| 68 | 68 |
| 69 this._fileMappingsList.element.classList.add("file-mappings-list"); | 69 this._fileMappingsList.element.classList.add("file-mappings-list"); |
| 70 this._fileMappingsListContainer.appendChild(this._fileMappingsList.element); | 70 this._fileMappingsListContainer.appendChild(this._fileMappingsList.element); |
| 71 | 71 |
| 72 this._entries = {}; | 72 this._entries = {}; |
| 73 for (var i = 0; i < entries.length; ++i) | 73 for (var i = 0; i < entries.length; ++i) |
| 74 this._addMappingRow(entries[i]); | 74 this._addMappingRow(entries[i]); |
| 75 | 75 |
| 76 blockHeader = contents.createChild("div", "block-header"); | 76 blockHeader = contents.createChild("div", "block-header"); |
| 77 blockHeader.textContent = WebInspector.UIString("Excluded folders"); | 77 blockHeader.textContent = WebInspector.UIString("Excluded folders"); |
| 78 this._excludedFolderListSection = contents.createChild("div", "section exclu
ded-folders-section"); | 78 this._excludedFolderListSection = contents.createChild("div", "section exclu
ded-folders-section"); |
| 79 this._excludedFolderListContainer = this._excludedFolderListSection.createCh
ild("div", "settings-list-container"); | 79 this._excludedFolderListContainer = this._excludedFolderListSection.createCh
ild("div", "settings-list-container"); |
| 80 var excludedFolderEntries = WebInspector.isolatedFileSystemManager.excludedF
olderManager().excludedFolders(fileSystemPath); | |
| 81 | 80 |
| 82 this._excludedFolderList = new WebInspector.EditableSettingsList([pathColumn
], this._excludedFolderValueProvider.bind(this), this._excludedFolderValidate.bi
nd(this), this._excludedFolderEdit.bind(this)); | 81 this._excludedFolderList = new WebInspector.EditableSettingsList([pathColumn
], this._excludedFolderValueProvider.bind(this), this._excludedFolderValidate.bi
nd(this), this._excludedFolderEdit.bind(this)); |
| 83 this._excludedFolderList.addEventListener(WebInspector.SettingsList.Events.R
emoved, this._excludedFolderRemovedfromList.bind(this)); | 82 this._excludedFolderList.addEventListener(WebInspector.SettingsList.Events.R
emoved, this._excludedFolderRemovedfromList.bind(this)); |
| 84 this._excludedFolderList.element.classList.add("excluded-folders-list"); | 83 this._excludedFolderList.element.classList.add("excluded-folders-list"); |
| 85 this._excludedFolderListContainer.appendChild(this._excludedFolderList.eleme
nt); | 84 this._excludedFolderListContainer.appendChild(this._excludedFolderList.eleme
nt); |
| 86 this._excludedFolderEntries = new Map(); | 85 /** @type {!Set<string>} */ |
| 87 for (var i = 0; i < excludedFolderEntries.length; ++i) | 86 this._excludedFolderEntries = new Set(); |
| 88 this._addExcludedFolderRow(excludedFolderEntries[i]); | 87 var excludedFolders = WebInspector.isolatedFileSystemManager.fileSystem(file
SystemPath).excludedFolders(); |
| 88 for (var i = 0; i < excludedFolders.length; ++i) |
| 89 this._addExcludedFolderRow(excludedFolders[i]); |
| 89 | 90 |
| 90 this.element.tabIndex = 0; | 91 this.element.tabIndex = 0; |
| 91 this._hasMappingChanges = false; | 92 this._hasMappingChanges = false; |
| 92 } | 93 } |
| 93 | 94 |
| 94 WebInspector.EditFileSystemDialog.show = function(fileSystemPath) | 95 WebInspector.EditFileSystemDialog.show = function(fileSystemPath) |
| 95 { | 96 { |
| 96 var dialog = new WebInspector.EditFileSystemDialog(fileSystemPath); | 97 var dialog = new WebInspector.EditFileSystemDialog(fileSystemPath); |
| 97 WebInspector.Dialog.show(dialog); | 98 WebInspector.Dialog.show(dialog); |
| 98 var glassPane = dialog.element.ownerDocument.getElementById("glass-pane"); | 99 var glassPane = dialog.element.ownerDocument.getElementById("glass-pane"); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 var fileSystemPath = entry.fileSystemPath; | 272 var fileSystemPath = entry.fileSystemPath; |
| 272 var urlPrefix = entry.urlPrefix; | 273 var urlPrefix = entry.urlPrefix; |
| 273 if (!this._fileSystemPath || this._fileSystemPath !== fileSystemPath) | 274 if (!this._fileSystemPath || this._fileSystemPath !== fileSystemPath) |
| 274 return; | 275 return; |
| 275 | 276 |
| 276 this._entries[urlPrefix] = entry; | 277 this._entries[urlPrefix] = entry; |
| 277 this._fileMappingsList.addItem(urlPrefix, null); | 278 this._fileMappingsList.addItem(urlPrefix, null); |
| 278 this._resize(); | 279 this._resize(); |
| 279 }, | 280 }, |
| 280 | 281 |
| 282 /** |
| 283 * @param {!WebInspector.Event} event |
| 284 */ |
| 281 _excludedFolderAdded: function(event) | 285 _excludedFolderAdded: function(event) |
| 282 { | 286 { |
| 283 var entry = /** @type {!WebInspector.ExcludedFolderManager.Entry} */ (ev
ent.data); | 287 var path = /** @type {string} */ (event.data); |
| 284 this._addExcludedFolderRow(entry); | 288 this._addExcludedFolderRow(path); |
| 285 }, | |
| 286 | |
| 287 _excludedFolderRemoved: function(event) | |
| 288 { | |
| 289 var entry = /** @type {!WebInspector.ExcludedFolderManager.Entry} */ (ev
ent.data); | |
| 290 var fileSystemPath = entry.fileSystemPath; | |
| 291 if (!fileSystemPath || this._fileSystemPath !== fileSystemPath) | |
| 292 return; | |
| 293 delete this._excludedFolderEntries[entry.path]; | |
| 294 if (this._excludedFolderList.itemForId(entry.path)) | |
| 295 this._excludedFolderList.removeItem(entry.path); | |
| 296 }, | 289 }, |
| 297 | 290 |
| 298 /** | 291 /** |
| 292 * @param {!WebInspector.Event} event |
| 293 */ |
| 294 _excludedFolderRemoved: function(event) |
| 295 { |
| 296 var path = /** @type {string} */ (event.data); |
| 297 delete this._excludedFolderEntries[path]; |
| 298 if (this._excludedFolderList.itemForId(path)) |
| 299 this._excludedFolderList.removeItem(path); |
| 300 }, |
| 301 |
| 302 /** |
| 299 * @param {string} itemId | 303 * @param {string} itemId |
| 300 * @param {string} columnId | 304 * @param {string} columnId |
| 301 * @return {string} | 305 * @return {string} |
| 302 */ | 306 */ |
| 303 _excludedFolderValueProvider: function(itemId, columnId) | 307 _excludedFolderValueProvider: function(itemId, columnId) |
| 304 { | 308 { |
| 305 return itemId; | 309 return itemId; |
| 306 }, | 310 }, |
| 307 | 311 |
| 308 /** | 312 /** |
| (...skipping 17 matching lines...) Expand all Loading... |
| 326 { | 330 { |
| 327 return !!path && (path === allowedPath || !this._excludedFolderEntries.h
as(path)); | 331 return !!path && (path === allowedPath || !this._excludedFolderEntries.h
as(path)); |
| 328 }, | 332 }, |
| 329 | 333 |
| 330 /** | 334 /** |
| 331 * @param {?string} itemId | 335 * @param {?string} itemId |
| 332 * @param {!Object} data | 336 * @param {!Object} data |
| 333 */ | 337 */ |
| 334 _excludedFolderEdit: function(itemId, data) | 338 _excludedFolderEdit: function(itemId, data) |
| 335 { | 339 { |
| 336 var fileSystemPath = this._fileSystemPath; | |
| 337 if (itemId) | 340 if (itemId) |
| 338 WebInspector.isolatedFileSystemManager.excludedFolderManager().remov
eExcludedFolder(fileSystemPath, itemId); | 341 WebInspector.isolatedFileSystemManager.fileSystem(this._fileSystemPa
th).removeExcludedFolder(itemId); |
| 339 var excludedFolderPath = data["path"]; | 342 var excludedFolderPath = data["path"]; |
| 340 WebInspector.isolatedFileSystemManager.excludedFolderManager().addExclud
edFolder(fileSystemPath, excludedFolderPath); | 343 WebInspector.isolatedFileSystemManager.fileSystem(this._fileSystemPath).
addExcludedFolder(excludedFolderPath); |
| 341 }, | 344 }, |
| 342 | 345 |
| 343 /** | 346 /** |
| 344 * @param {!WebInspector.Event} event | 347 * @param {!WebInspector.Event} event |
| 345 */ | 348 */ |
| 346 _excludedFolderRemovedfromList: function(event) | 349 _excludedFolderRemovedfromList: function(event) |
| 347 { | 350 { |
| 348 var itemId = /** @type{?string} */ (event.data); | 351 var itemId = /** @type{?string} */ (event.data); |
| 349 if (!itemId) | 352 if (!itemId) |
| 350 return; | 353 return; |
| 351 WebInspector.isolatedFileSystemManager.excludedFolderManager().removeExc
ludedFolder(this._fileSystemPath, itemId); | 354 WebInspector.isolatedFileSystemManager.fileSystem(this._fileSystemPath).
removeExcludedFolder(itemId); |
| 352 }, | 355 }, |
| 353 | 356 |
| 354 /** | 357 /** |
| 355 * @param {!WebInspector.ExcludedFolderManager.Entry} entry | 358 * @param {string} path |
| 356 */ | 359 */ |
| 357 _addExcludedFolderRow: function(entry) | 360 _addExcludedFolderRow: function(path) |
| 358 { | 361 { |
| 359 var fileSystemPath = entry.fileSystemPath; | 362 this._excludedFolderEntries.add(path); |
| 360 if (!fileSystemPath || this._fileSystemPath !== fileSystemPath) | |
| 361 return; | |
| 362 var path = entry.path; | |
| 363 this._excludedFolderEntries.set(path, entry); | |
| 364 this._excludedFolderList.addItem(path, null); | 363 this._excludedFolderList.addItem(path, null); |
| 365 this._resize(); | 364 this._resize(); |
| 366 }, | 365 }, |
| 367 | 366 |
| 368 /** | 367 /** |
| 369 * @param {string} value | 368 * @param {string} value |
| 370 * @param {?string} allowedPrefix | 369 * @param {?string} allowedPrefix |
| 371 * @return {boolean} | 370 * @return {boolean} |
| 372 */ | 371 */ |
| 373 _checkURLPrefix: function(value, allowedPrefix) | 372 _checkURLPrefix: function(value, allowedPrefix) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 { | 404 { |
| 406 WebInspector.Dialog.hide(); | 405 WebInspector.Dialog.hide(); |
| 407 }, | 406 }, |
| 408 | 407 |
| 409 onEnter: function() | 408 onEnter: function() |
| 410 { | 409 { |
| 411 }, | 410 }, |
| 412 | 411 |
| 413 __proto__: WebInspector.DialogDelegate.prototype | 412 __proto__: WebInspector.DialogDelegate.prototype |
| 414 } | 413 } |
| OLD | NEW |