Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/settings/EditFileSystemDialog.js

Issue 1369063002: DevTools: merge excluded folder manager into isolated file system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 29 matching lines...) Expand all
40 this._fileSystemPath = fileSystemPath; 40 this._fileSystemPath = fileSystemPath;
41 41
42 var header = this.element.createChild("div", "header"); 42 var header = this.element.createChild("div", "header");
43 var headerText = header.createChild("span"); 43 var headerText = header.createChild("span");
44 headerText.textContent = WebInspector.UIString("Edit file system"); 44 headerText.textContent = WebInspector.UIString("Edit file system");
45 45
46 var contents = this.element.createChild("div", "contents"); 46 var contents = this.element.createChild("div", "contents");
47 47
48 WebInspector.fileSystemMapping.addEventListener(WebInspector.FileSystemMappi ng.Events.FileMappingAdded, this._fileMappingAdded, this); 48 WebInspector.fileSystemMapping.addEventListener(WebInspector.FileSystemMappi ng.Events.FileMappingAdded, this._fileMappingAdded, this);
49 WebInspector.fileSystemMapping.addEventListener(WebInspector.FileSystemMappi ng.Events.FileMappingRemoved, this._fileMappingRemoved, this); 49 WebInspector.fileSystemMapping.addEventListener(WebInspector.FileSystemMappi ng.Events.FileMappingRemoved, this._fileMappingRemoved, this);
50 WebInspector.isolatedFileSystemManager.excludedFolderManager().addEventListe ner(WebInspector.ExcludedFolderManager.Events.ExcludedFolderAdded, this._exclude dFolderAdded, this); 50 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.ExcludedFolderAdded, this._excludedFolderAdded, this);
51 WebInspector.isolatedFileSystemManager.excludedFolderManager().addEventListe ner(WebInspector.ExcludedFolderManager.Events.ExcludedFolderRemoved, this._exclu dedFolderRemoved, this); 51 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.ExcludedFolderRemoved, this._excludedFolderRemoved, th is);
52 52
53 var blockHeader = contents.createChild("div", "block-header"); 53 var blockHeader = contents.createChild("div", "block-header");
54 blockHeader.textContent = WebInspector.UIString("Mappings"); 54 blockHeader.textContent = WebInspector.UIString("Mappings");
55 this._fileMappingsSection = contents.createChild("div", "section"); 55 this._fileMappingsSection = contents.createChild("div", "section");
56 this._fileMappingsListContainer = this._fileMappingsSection.createChild("div ", "settings-list-container"); 56 this._fileMappingsListContainer = this._fileMappingsSection.createChild("div ", "settings-list-container");
57 var entries = WebInspector.fileSystemMapping.mappingEntries(this._fileSystem Path); 57 var entries = WebInspector.fileSystemMapping.mappingEntries(this._fileSystem Path);
58 58
59 var urlColumn = { id: "url", placeholder: WebInspector.UIString("URL prefix" ) }; 59 var urlColumn = { id: "url", placeholder: WebInspector.UIString("URL prefix" ) };
60 var pathColumn = { id: "path", placeholder: WebInspector.UIString("Folder pa th") }; 60 var pathColumn = { id: "path", placeholder: WebInspector.UIString("Folder pa th") };
61 61
62 this._fileMappingsList = new WebInspector.EditableSettingsList([urlColumn, p athColumn], this._fileMappingValuesProvider.bind(this), this._fileMappingValidat e.bind(this), this._fileMappingEdit.bind(this)); 62 this._fileMappingsList = new WebInspector.EditableSettingsList([urlColumn, p athColumn], this._fileMappingValuesProvider.bind(this), this._fileMappingValidat e.bind(this), this._fileMappingEdit.bind(this));
63 this._fileMappingsList.addEventListener(WebInspector.SettingsList.Events.Rem oved, this._fileMappingRemovedfromList.bind(this)); 63 this._fileMappingsList.addEventListener(WebInspector.SettingsList.Events.Rem oved, this._fileMappingRemovedfromList.bind(this));
64 64
65 this._fileMappingsList.element.classList.add("file-mappings-list"); 65 this._fileMappingsList.element.classList.add("file-mappings-list");
66 this._fileMappingsListContainer.appendChild(this._fileMappingsList.element); 66 this._fileMappingsListContainer.appendChild(this._fileMappingsList.element);
67 67
68 this._entries = {}; 68 this._entries = {};
69 for (var i = 0; i < entries.length; ++i) 69 for (var i = 0; i < entries.length; ++i)
70 this._addMappingRow(entries[i]); 70 this._addMappingRow(entries[i]);
71 71
72 blockHeader = contents.createChild("div", "block-header"); 72 blockHeader = contents.createChild("div", "block-header");
73 blockHeader.textContent = WebInspector.UIString("Excluded folders"); 73 blockHeader.textContent = WebInspector.UIString("Excluded folders");
74 this._excludedFolderListSection = contents.createChild("div", "section exclu ded-folders-section"); 74 this._excludedFolderListSection = contents.createChild("div", "section exclu ded-folders-section");
75 this._excludedFolderListContainer = this._excludedFolderListSection.createCh ild("div", "settings-list-container"); 75 this._excludedFolderListContainer = this._excludedFolderListSection.createCh ild("div", "settings-list-container");
76 var excludedFolderEntries = WebInspector.isolatedFileSystemManager.excludedF olderManager().excludedFolders(fileSystemPath);
77 76
78 this._excludedFolderList = new WebInspector.EditableSettingsList([pathColumn ], this._excludedFolderValueProvider.bind(this), this._excludedFolderValidate.bi nd(this), this._excludedFolderEdit.bind(this)); 77 this._excludedFolderList = new WebInspector.EditableSettingsList([pathColumn ], this._excludedFolderValueProvider.bind(this), this._excludedFolderValidate.bi nd(this), this._excludedFolderEdit.bind(this));
79 this._excludedFolderList.addEventListener(WebInspector.SettingsList.Events.R emoved, this._excludedFolderRemovedfromList.bind(this)); 78 this._excludedFolderList.addEventListener(WebInspector.SettingsList.Events.R emoved, this._excludedFolderRemovedfromList.bind(this));
80 this._excludedFolderList.element.classList.add("excluded-folders-list"); 79 this._excludedFolderList.element.classList.add("excluded-folders-list");
81 this._excludedFolderListContainer.appendChild(this._excludedFolderList.eleme nt); 80 this._excludedFolderListContainer.appendChild(this._excludedFolderList.eleme nt);
82 this._excludedFolderEntries = new Map(); 81 /** @type {!Set<string>} */
83 for (var i = 0; i < excludedFolderEntries.length; ++i) 82 this._excludedFolderEntries = new Set();
84 this._addExcludedFolderRow(excludedFolderEntries[i]); 83 var excludedFolders = WebInspector.isolatedFileSystemManager.fileSystem(file SystemPath).excludedFolders();
84 for (var i = 0; i < excludedFolders.length; ++i)
85 this._addExcludedFolderRow(excludedFolders[i]);
85 86
86 this.element.tabIndex = 0; 87 this.element.tabIndex = 0;
87 this._hasMappingChanges = false; 88 this._hasMappingChanges = false;
88 } 89 }
89 90
90 WebInspector.EditFileSystemDialog.show = function(fileSystemPath) 91 WebInspector.EditFileSystemDialog.show = function(fileSystemPath)
91 { 92 {
92 var dialog = new WebInspector.EditFileSystemDialog(fileSystemPath); 93 var dialog = new WebInspector.EditFileSystemDialog(fileSystemPath);
93 WebInspector.Dialog.show(dialog, false, true); 94 WebInspector.Dialog.show(dialog, false, true);
94 var glassPane = dialog.element.ownerDocument.getElementById("glass-pane"); 95 var glassPane = dialog.element.ownerDocument.getElementById("glass-pane");
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 var fileSystemPath = entry.fileSystemPath; 268 var fileSystemPath = entry.fileSystemPath;
268 var urlPrefix = entry.urlPrefix; 269 var urlPrefix = entry.urlPrefix;
269 if (!this._fileSystemPath || this._fileSystemPath !== fileSystemPath) 270 if (!this._fileSystemPath || this._fileSystemPath !== fileSystemPath)
270 return; 271 return;
271 272
272 this._entries[urlPrefix] = entry; 273 this._entries[urlPrefix] = entry;
273 this._fileMappingsList.addItem(urlPrefix, null); 274 this._fileMappingsList.addItem(urlPrefix, null);
274 this._resize(); 275 this._resize();
275 }, 276 },
276 277
278 /**
279 * @param {!WebInspector.Event} event
280 */
277 _excludedFolderAdded: function(event) 281 _excludedFolderAdded: function(event)
278 { 282 {
279 var entry = /** @type {!WebInspector.ExcludedFolderManager.Entry} */ (ev ent.data); 283 var path = /** @type {string} */ (event.data);
280 this._addExcludedFolderRow(entry); 284 this._addExcludedFolderRow(path);
281 },
282
283 _excludedFolderRemoved: function(event)
284 {
285 var entry = /** @type {!WebInspector.ExcludedFolderManager.Entry} */ (ev ent.data);
286 var fileSystemPath = entry.fileSystemPath;
287 if (!fileSystemPath || this._fileSystemPath !== fileSystemPath)
288 return;
289 delete this._excludedFolderEntries[entry.path];
290 if (this._excludedFolderList.itemForId(entry.path))
291 this._excludedFolderList.removeItem(entry.path);
292 }, 285 },
293 286
294 /** 287 /**
288 * @param {!WebInspector.Event} event
289 */
290 _excludedFolderRemoved: function(event)
291 {
292 var path = /** @type {string} */ (event.data);
293 delete this._excludedFolderEntries[path];
294 if (this._excludedFolderList.itemForId(path))
295 this._excludedFolderList.removeItem(path);
296 },
297
298 /**
295 * @param {string} itemId 299 * @param {string} itemId
296 * @param {string} columnId 300 * @param {string} columnId
297 * @return {string} 301 * @return {string}
298 */ 302 */
299 _excludedFolderValueProvider: function(itemId, columnId) 303 _excludedFolderValueProvider: function(itemId, columnId)
300 { 304 {
301 return itemId; 305 return itemId;
302 }, 306 },
303 307
304 /** 308 /**
(...skipping 17 matching lines...) Expand all
322 { 326 {
323 return !!path && (path === allowedPath || !this._excludedFolderEntries.h as(path)); 327 return !!path && (path === allowedPath || !this._excludedFolderEntries.h as(path));
324 }, 328 },
325 329
326 /** 330 /**
327 * @param {?string} itemId 331 * @param {?string} itemId
328 * @param {!Object} data 332 * @param {!Object} data
329 */ 333 */
330 _excludedFolderEdit: function(itemId, data) 334 _excludedFolderEdit: function(itemId, data)
331 { 335 {
332 var fileSystemPath = this._fileSystemPath;
333 if (itemId) 336 if (itemId)
334 WebInspector.isolatedFileSystemManager.excludedFolderManager().remov eExcludedFolder(fileSystemPath, itemId); 337 WebInspector.isolatedFileSystemManager.fileSystem(this._fileSystemPa th).removeExcludedFolder(itemId);
335 var excludedFolderPath = data["path"]; 338 var excludedFolderPath = data["path"];
336 WebInspector.isolatedFileSystemManager.excludedFolderManager().addExclud edFolder(fileSystemPath, excludedFolderPath); 339 WebInspector.isolatedFileSystemManager.fileSystem(this._fileSystemPath). addExcludedFolder(excludedFolderPath);
337 }, 340 },
338 341
339 /** 342 /**
340 * @param {!WebInspector.Event} event 343 * @param {!WebInspector.Event} event
341 */ 344 */
342 _excludedFolderRemovedfromList: function(event) 345 _excludedFolderRemovedfromList: function(event)
343 { 346 {
344 var itemId = /** @type{?string} */ (event.data); 347 var itemId = /** @type{?string} */ (event.data);
345 if (!itemId) 348 if (!itemId)
346 return; 349 return;
347 WebInspector.isolatedFileSystemManager.excludedFolderManager().removeExc ludedFolder(this._fileSystemPath, itemId); 350 WebInspector.isolatedFileSystemManager.fileSystem(this._fileSystemPath). removeExcludedFolder(itemId);
348 }, 351 },
349 352
350 /** 353 /**
351 * @param {!WebInspector.ExcludedFolderManager.Entry} entry 354 * @param {string} path
352 */ 355 */
353 _addExcludedFolderRow: function(entry) 356 _addExcludedFolderRow: function(path)
354 { 357 {
355 var fileSystemPath = entry.fileSystemPath; 358 this._excludedFolderEntries.add(path);
356 if (!fileSystemPath || this._fileSystemPath !== fileSystemPath)
357 return;
358 var path = entry.path;
359 this._excludedFolderEntries.set(path, entry);
360 this._excludedFolderList.addItem(path, null); 359 this._excludedFolderList.addItem(path, null);
361 this._resize(); 360 this._resize();
362 }, 361 },
363 362
364 /** 363 /**
365 * @param {string} value 364 * @param {string} value
366 * @param {?string} allowedPrefix 365 * @param {?string} allowedPrefix
367 * @return {boolean} 366 * @return {boolean}
368 */ 367 */
369 _checkURLPrefix: function(value, allowedPrefix) 368 _checkURLPrefix: function(value, allowedPrefix)
(...skipping 26 matching lines...) Expand all
396 { 395 {
397 WebInspector.setCurrentFocusElement(this.element); 396 WebInspector.setCurrentFocusElement(this.element);
398 }, 397 },
399 398
400 onEnter: function() 399 onEnter: function()
401 { 400 {
402 }, 401 },
403 402
404 __proto__: WebInspector.DialogDelegate.prototype 403 __proto__: WebInspector.DialogDelegate.prototype
405 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698