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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/persistence/EditFileSystemView.js

Issue 2867783003: DevTools: move IsolatedFileSystem/IsolatedFileSystemManager into persistence/ (Closed)
Patch Set: fix order Created 3 years, 7 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 27 matching lines...) Expand all
38 constructor(fileSystemPath) { 38 constructor(fileSystemPath) {
39 super(true); 39 super(true);
40 this.registerRequiredCSS('persistence/editFileSystemView.css'); 40 this.registerRequiredCSS('persistence/editFileSystemView.css');
41 this._fileSystemPath = fileSystemPath; 41 this._fileSystemPath = fileSystemPath;
42 42
43 this._eventListeners = [ 43 this._eventListeners = [
44 Persistence.fileSystemMapping.addEventListener( 44 Persistence.fileSystemMapping.addEventListener(
45 Persistence.FileSystemMapping.Events.FileMappingAdded, this._update, t his), 45 Persistence.FileSystemMapping.Events.FileMappingAdded, this._update, t his),
46 Persistence.fileSystemMapping.addEventListener( 46 Persistence.fileSystemMapping.addEventListener(
47 Persistence.FileSystemMapping.Events.FileMappingRemoved, this._update, this), 47 Persistence.FileSystemMapping.Events.FileMappingRemoved, this._update, this),
48 Workspace.isolatedFileSystemManager.addEventListener( 48 Persistence.isolatedFileSystemManager.addEventListener(
49 Workspace.IsolatedFileSystemManager.Events.ExcludedFolderAdded, this._ update, this), 49 Persistence.IsolatedFileSystemManager.Events.ExcludedFolderAdded, this ._update, this),
50 Workspace.isolatedFileSystemManager.addEventListener( 50 Persistence.isolatedFileSystemManager.addEventListener(
51 Workspace.IsolatedFileSystemManager.Events.ExcludedFolderRemoved, this ._update, this) 51 Persistence.IsolatedFileSystemManager.Events.ExcludedFolderRemoved, th is._update, this)
52 ]; 52 ];
53 53
54 54
55 if (!Runtime.experiments.isEnabled('persistence2')) { 55 if (!Runtime.experiments.isEnabled('persistence2')) {
56 this._mappingsList = new UI.ListWidget(this); 56 this._mappingsList = new UI.ListWidget(this);
57 this._mappingsList.element.classList.add('file-system-list'); 57 this._mappingsList.element.classList.add('file-system-list');
58 this._mappingsList.registerRequiredCSS('persistence/editFileSystemView.css '); 58 this._mappingsList.registerRequiredCSS('persistence/editFileSystemView.css ');
59 var mappingsPlaceholder = createElementWithClass('div', 'file-system-list- empty'); 59 var mappingsPlaceholder = createElementWithClass('div', 'file-system-list- empty');
60 var mappingsHeader = this.contentElement.createChild('div', 'file-system-h eader'); 60 var mappingsHeader = this.contentElement.createChild('div', 'file-system-h eader');
61 mappingsHeader.createChild('div', 'file-system-header-text').textContent = Common.UIString('Mappings'); 61 mappingsHeader.createChild('div', 'file-system-header-text').textContent = Common.UIString('Mappings');
(...skipping 26 matching lines...) Expand all
88 } 88 }
89 89
90 _update() { 90 _update() {
91 if (this._muteUpdate) 91 if (this._muteUpdate)
92 return; 92 return;
93 93
94 this._mappings = []; 94 this._mappings = [];
95 95
96 this._excludedFoldersList.clear(); 96 this._excludedFoldersList.clear();
97 this._excludedFolders = []; 97 this._excludedFolders = [];
98 for (var folder of Workspace.isolatedFileSystemManager.fileSystem(this._file SystemPath) 98 for (var folder of Persistence.isolatedFileSystemManager.fileSystem(this._fi leSystemPath)
99 .excludedFolders() 99 .excludedFolders()
100 .values()) { 100 .values()) {
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();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 /** 151 /**
152 * @override 152 * @override
153 * @param {*} item 153 * @param {*} item
154 * @param {number} index 154 * @param {number} index
155 */ 155 */
156 removeItemRequested(item, index) { 156 removeItemRequested(item, index) {
157 if (item instanceof Persistence.FileSystemMapping.Entry) { 157 if (item instanceof Persistence.FileSystemMapping.Entry) {
158 var entry = this._mappings[index]; 158 var entry = this._mappings[index];
159 Persistence.fileSystemMapping.removeFileMapping(entry.fileSystemPath, entr y.urlPrefix, entry.pathPrefix); 159 Persistence.fileSystemMapping.removeFileMapping(entry.fileSystemPath, entr y.urlPrefix, entry.pathPrefix);
160 } else { 160 } else {
161 Workspace.isolatedFileSystemManager.fileSystem(this._fileSystemPath) 161 Persistence.isolatedFileSystemManager.fileSystem(this._fileSystemPath)
162 .removeExcludedFolder(this._excludedFolders[index]); 162 .removeExcludedFolder(this._excludedFolders[index]);
163 } 163 }
164 } 164 }
165 165
166 /** 166 /**
167 * @override 167 * @override
168 * @param {*} item 168 * @param {*} item
169 * @param {!UI.ListWidget.Editor} editor 169 * @param {!UI.ListWidget.Editor} editor
170 * @param {boolean} isNew 170 * @param {boolean} isNew
171 */ 171 */
172 commitEdit(item, editor, isNew) { 172 commitEdit(item, editor, isNew) {
173 this._muteUpdate = true; 173 this._muteUpdate = true;
174 if (item instanceof Persistence.FileSystemMapping.Entry) { 174 if (item instanceof Persistence.FileSystemMapping.Entry) {
175 var entry = /** @type {!Persistence.FileSystemMapping.Entry} */ (item); 175 var entry = /** @type {!Persistence.FileSystemMapping.Entry} */ (item);
176 if (!isNew) 176 if (!isNew)
177 Persistence.fileSystemMapping.removeFileMapping(this._fileSystemPath, en try.urlPrefix, entry.pathPrefix); 177 Persistence.fileSystemMapping.removeFileMapping(this._fileSystemPath, en try.urlPrefix, entry.pathPrefix);
178 Persistence.fileSystemMapping.addFileMapping( 178 Persistence.fileSystemMapping.addFileMapping(
179 this._fileSystemPath, this._normalizePrefix(editor.control('urlPrefix' ).value), 179 this._fileSystemPath, this._normalizePrefix(editor.control('urlPrefix' ).value),
180 this._normalizePrefix(editor.control('pathPrefix').value)); 180 this._normalizePrefix(editor.control('pathPrefix').value));
181 } else { 181 } else {
182 if (!isNew) { 182 if (!isNew) {
183 Workspace.isolatedFileSystemManager.fileSystem(this._fileSystemPath) 183 Persistence.isolatedFileSystemManager.fileSystem(this._fileSystemPath)
184 .removeExcludedFolder(/** @type {string} */ (item)); 184 .removeExcludedFolder(/** @type {string} */ (item));
185 } 185 }
186 Workspace.isolatedFileSystemManager.fileSystem(this._fileSystemPath) 186 Persistence.isolatedFileSystemManager.fileSystem(this._fileSystemPath)
187 .addExcludedFolder(this._normalizePrefix(editor.control('pathPrefix'). value)); 187 .addExcludedFolder(this._normalizePrefix(editor.control('pathPrefix'). value));
188 } 188 }
189 this._muteUpdate = false; 189 this._muteUpdate = false;
190 this._update(); 190 this._update();
191 } 191 }
192 192
193 /** 193 /**
194 * @override 194 * @override
195 * @param {*} item 195 * @param {*} item
196 * @return {!UI.ListWidget.Editor} 196 * @return {!UI.ListWidget.Editor}
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 /** 291 /**
292 * @param {*} item 292 * @param {*} item
293 * @param {number} index 293 * @param {number} index
294 * @param {!HTMLInputElement|!HTMLSelectElement} input 294 * @param {!HTMLInputElement|!HTMLSelectElement} input
295 * @return {boolean} 295 * @return {boolean}
296 * @this {Persistence.EditFileSystemView} 296 * @this {Persistence.EditFileSystemView}
297 */ 297 */
298 function pathPrefixValidator(item, index, input) { 298 function pathPrefixValidator(item, index, input) {
299 var prefix = this._normalizePrefix(input.value); 299 var prefix = this._normalizePrefix(input.value);
300 var configurableCount = 300 var configurableCount =
301 Workspace.isolatedFileSystemManager.fileSystem(this._fileSystemPath).e xcludedFolders().size; 301 Persistence.isolatedFileSystemManager.fileSystem(this._fileSystemPath) .excludedFolders().size;
302 for (var i = 0; i < configurableCount; ++i) { 302 for (var i = 0; i < configurableCount; ++i) {
303 if (i !== index && this._excludedFolders[i] === prefix) 303 if (i !== index && this._excludedFolders[i] === prefix)
304 return false; 304 return false;
305 } 305 }
306 return !!prefix; 306 return !!prefix;
307 } 307 }
308 } 308 }
309 309
310 /** 310 /**
311 * @param {string} prefix 311 * @param {string} prefix
312 * @return {string} 312 * @return {string}
313 */ 313 */
314 _normalizePrefix(prefix) { 314 _normalizePrefix(prefix) {
315 if (!prefix) 315 if (!prefix)
316 return ''; 316 return '';
317 return prefix + (prefix[prefix.length - 1] === '/' ? '' : '/'); 317 return prefix + (prefix[prefix.length - 1] === '/' ? '' : '/');
318 } 318 }
319 }; 319 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698