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

Side by Side Diff: Source/devtools/front_end/settings/SettingsScreen.js

Issue 340513003: DevTools: Add JSDoc for static methods, fix JSDoc types and induced errors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased patch Created 6 years, 6 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 | Annotate | Revision Log
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 */ 214 */
215 WebInspector.GenericSettingsTab = function() 215 WebInspector.GenericSettingsTab = function()
216 { 216 {
217 WebInspector.SettingsTab.call(this, WebInspector.UIString("General"), "gener al-tab-content"); 217 WebInspector.SettingsTab.call(this, WebInspector.UIString("General"), "gener al-tab-content");
218 218
219 this._populateSectionsFromExtensions(); 219 this._populateSectionsFromExtensions();
220 220
221 var restoreDefaults = this._appendSection().createChild("input", "settings-t ab-text-button"); 221 var restoreDefaults = this._appendSection().createChild("input", "settings-t ab-text-button");
222 restoreDefaults.type = "button"; 222 restoreDefaults.type = "button";
223 restoreDefaults.value = WebInspector.UIString("Restore defaults and reload") ; 223 restoreDefaults.value = WebInspector.UIString("Restore defaults and reload") ;
224 restoreDefaults.addEventListener("click", restoreAndReload); 224 restoreDefaults.addEventListener("click", restoreAndReload, false);
225 225
226 function restoreAndReload() 226 function restoreAndReload()
227 { 227 {
228 if (window.localStorage) 228 if (window.localStorage)
229 window.localStorage.clear(); 229 window.localStorage.clear();
230 WebInspector.reload(); 230 WebInspector.reload();
231 } 231 }
232 } 232 }
233 233
234 WebInspector.GenericSettingsTab.prototype = { 234 WebInspector.GenericSettingsTab.prototype = {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 var folderExcludePatternInput = WebInspector.SettingsUI.createSettingInputFi eld(WebInspector.UIString("Folder exclude pattern"), WebInspector.settings.works paceFolderExcludePattern, false, 0, "270px", WebInspector.SettingsUI.regexValida tor); 376 var folderExcludePatternInput = WebInspector.SettingsUI.createSettingInputFi eld(WebInspector.UIString("Folder exclude pattern"), WebInspector.settings.works paceFolderExcludePattern, false, 0, "270px", WebInspector.SettingsUI.regexValida tor);
377 this._commonSection.appendChild(folderExcludePatternInput); 377 this._commonSection.appendChild(folderExcludePatternInput);
378 378
379 this._fileSystemsSection = this._appendSection(WebInspector.UIString("Folder s")); 379 this._fileSystemsSection = this._appendSection(WebInspector.UIString("Folder s"));
380 this._fileSystemsListContainer = this._fileSystemsSection.createChild("p", " settings-list-container"); 380 this._fileSystemsListContainer = this._fileSystemsSection.createChild("p", " settings-list-container");
381 381
382 this._addFileSystemRowElement = this._fileSystemsSection.createChild("div"); 382 this._addFileSystemRowElement = this._fileSystemsSection.createChild("div");
383 var addFileSystemButton = this._addFileSystemRowElement.createChild("input", "settings-tab-text-button"); 383 var addFileSystemButton = this._addFileSystemRowElement.createChild("input", "settings-tab-text-button");
384 addFileSystemButton.type = "button"; 384 addFileSystemButton.type = "button";
385 addFileSystemButton.value = WebInspector.UIString("Add folder\u2026"); 385 addFileSystemButton.value = WebInspector.UIString("Add folder\u2026");
386 addFileSystemButton.addEventListener("click", this._addFileSystemClicked.bin d(this)); 386 addFileSystemButton.addEventListener("click", this._addFileSystemClicked.bin d(this), false);
387 387
388 this._editFileSystemButton = this._addFileSystemRowElement.createChild("inpu t", "settings-tab-text-button"); 388 this._editFileSystemButton = this._addFileSystemRowElement.createChild("inpu t", "settings-tab-text-button");
389 this._editFileSystemButton.type = "button"; 389 this._editFileSystemButton.type = "button";
390 this._editFileSystemButton.value = WebInspector.UIString("Edit\u2026"); 390 this._editFileSystemButton.value = WebInspector.UIString("Edit\u2026");
391 this._editFileSystemButton.addEventListener("click", this._editFileSystemCli cked.bind(this)); 391 this._editFileSystemButton.addEventListener("click", this._editFileSystemCli cked.bind(this), false);
392 this._updateEditFileSystemButtonState(); 392 this._updateEditFileSystemButtonState();
393 393
394 this._reset(); 394 this._reset();
395 } 395 }
396 396
397 WebInspector.WorkspaceSettingsTab.prototype = { 397 WebInspector.WorkspaceSettingsTab.prototype = {
398 wasShown: function() 398 wasShown: function()
399 { 399 {
400 WebInspector.SettingsTab.prototype.wasShown.call(this); 400 WebInspector.SettingsTab.prototype.wasShown.call(this);
401 this._reset(); 401 this._reset();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 444
445 /** 445 /**
446 * @param {!WebInspector.Event} event 446 * @param {!WebInspector.Event} event
447 */ 447 */
448 _fileSystemDoubleClicked: function(event) 448 _fileSystemDoubleClicked: function(event)
449 { 449 {
450 var id = /** @type{?string} */ (event.data); 450 var id = /** @type{?string} */ (event.data);
451 this._editFileSystem(id); 451 this._editFileSystem(id);
452 }, 452 },
453 453
454 /** 454 _editFileSystemClicked: function()
455 * @param {!WebInspector.Event=} event
456 */
457 _editFileSystemClicked: function(event)
458 { 455 {
459 this._editFileSystem(this._selectedFileSystemPath()); 456 this._editFileSystem(this._selectedFileSystemPath());
460 }, 457 },
461 458
462 /** 459 /**
463 * @param {?string} id 460 * @param {?string} id
464 */ 461 */
465 _editFileSystem: function(id) 462 _editFileSystem: function(id)
466 { 463 {
467 WebInspector.EditFileSystemDialog.show(WebInspector.inspectorView.elemen t, id); 464 WebInspector.EditFileSystemDialog.show(WebInspector.inspectorView.elemen t, id);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 * @param {string} itemId 795 * @param {string} itemId
799 * @return {!Element} 796 * @return {!Element}
800 */ 797 */
801 itemForId: function(itemId) 798 itemForId: function(itemId)
802 { 799 {
803 return this._listItems[itemId]; 800 return this._listItems[itemId];
804 }, 801 },
805 802
806 /** 803 /**
807 * @param {?string} id 804 * @param {?string} id
808 * @param {!Event=} event 805 * @param {?Event=} event
809 */ 806 */
810 _onDoubleClick: function(id, event) 807 _onDoubleClick: function(id, event)
811 { 808 {
812 this.dispatchEventToListeners(WebInspector.SettingsList.Events.DoubleCli cked, id); 809 this.dispatchEventToListeners(WebInspector.SettingsList.Events.DoubleCli cked, id);
813 }, 810 },
814 811
815 /** 812 /**
816 * @param {?string} id 813 * @param {?string} id
817 * @param {!Event=} event 814 * @param {?Event=} event
818 */ 815 */
819 selectItem: function(id, event) 816 selectItem: function(id, event)
820 { 817 {
821 if (typeof this._selectedId !== "undefined") { 818 if (typeof this._selectedId !== "undefined") {
822 this._listItems[this._selectedId].classList.remove("selected"); 819 this._listItems[this._selectedId].classList.remove("selected");
823 } 820 }
824 821
825 this._selectedId = id; 822 this._selectedId = id;
826 if (typeof this._selectedId !== "undefined") { 823 if (typeof this._selectedId !== "undefined") {
827 this._listItems[this._selectedId].classList.add("selected"); 824 this._listItems[this._selectedId].classList.add("selected");
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 /** 886 /**
890 * @param {!Element} columnElement 887 * @param {!Element} columnElement
891 * @param {string} columnId 888 * @param {string} columnId
892 * @param {?string} itemId 889 * @param {?string} itemId
893 */ 890 */
894 _renderColumn: function(columnElement, columnId, itemId) 891 _renderColumn: function(columnElement, columnId, itemId)
895 { 892 {
896 columnElement.classList.add("settings-list-column-" + columnId); 893 columnElement.classList.add("settings-list-column-" + columnId);
897 var placeholder = (columnId === "url") ? WebInspector.UIString("URL pref ix") : WebInspector.UIString("Folder path"); 894 var placeholder = (columnId === "url") ? WebInspector.UIString("URL pref ix") : WebInspector.UIString("Folder path");
898 if (itemId === null) { 895 if (itemId === null) {
899 var inputElement = columnElement.createChild("input", "list-column-e ditor"); 896 var inputElement = /** @type {!HTMLInputElement} */ (columnElement.c reateChild("input", "list-column-editor"));
900 inputElement.placeholder = placeholder; 897 inputElement.placeholder = placeholder;
901 inputElement.addEventListener("blur", this._onAddMappingInputBlur.bi nd(this)); 898 inputElement.addEventListener("blur", this._onAddMappingInputBlur.bi nd(this), false);
902 inputElement.addEventListener("input", this._validateEdit.bind(this, itemId)); 899 inputElement.addEventListener("input", this._validateEdit.bind(this, itemId), false);
903 this._addInputElements[columnId] = inputElement; 900 this._addInputElements[columnId] = inputElement;
904 return; 901 return;
905 } 902 }
906 var validItemId = itemId; 903 var validItemId = itemId;
907 904
908 if (!this._editInputElements[itemId]) 905 if (!this._editInputElements[itemId])
909 this._editInputElements[itemId] = {}; 906 this._editInputElements[itemId] = {};
910 if (!this._textElements[itemId]) 907 if (!this._textElements[itemId])
911 this._textElements[itemId] = {}; 908 this._textElements[itemId] = {};
912 909
913 var value = this._valuesProvider(itemId, columnId); 910 var value = this._valuesProvider(itemId, columnId);
914 911
915 var textElement = columnElement.createChild("span", "list-column-text"); 912 var textElement = /** @type {!HTMLSpanElement} */ (columnElement.createC hild("span", "list-column-text"));
916 textElement.textContent = value; 913 textElement.textContent = value;
917 textElement.title = value; 914 textElement.title = value;
918 columnElement.addEventListener("click", rowClicked.bind(this), false); 915 columnElement.addEventListener("click", rowClicked.bind(this), false);
919 this._textElements[itemId][columnId] = textElement; 916 this._textElements[itemId][columnId] = textElement;
920 917
921 var inputElement = columnElement.createChild("input", "list-column-edito r"); 918 var inputElement = /** @type {!HTMLInputElement} */ (columnElement.creat eChild("input", "list-column-editor"));
922 inputElement.value = value; 919 inputElement.value = value;
923 inputElement.addEventListener("blur", this._editMappingBlur.bind(this, i temId)); 920 inputElement.addEventListener("blur", this._editMappingBlur.bind(this, i temId), false);
924 inputElement.addEventListener("input", this._validateEdit.bind(this, ite mId)); 921 inputElement.addEventListener("input", this._validateEdit.bind(this, ite mId), false);
925 columnElement.inputElement = inputElement; 922 columnElement.inputElement = inputElement;
926 this._editInputElements[itemId][columnId] = inputElement; 923 this._editInputElements[itemId][columnId] = inputElement;
927 924
928 /** 925 /**
929 * @param {?Event} event 926 * @param {?Event} event
930 * @this {WebInspector.EditableSettingsList} 927 * @this {WebInspector.EditableSettingsList}
931 */ 928 */
932 function rowClicked(event) 929 function rowClicked(event)
933 { 930 {
934 if (itemId === this._editingId) 931 if (itemId === this._editingId)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 if (oldValue !== newValue) { 1001 if (oldValue !== newValue) {
1005 hasChanges = true; 1002 hasChanges = true;
1006 break; 1003 break;
1007 } 1004 }
1008 } 1005 }
1009 return hasChanges; 1006 return hasChanges;
1010 }, 1007 },
1011 1008
1012 /** 1009 /**
1013 * @param {string} itemId 1010 * @param {string} itemId
1014 * @param {!Event} event 1011 * @param {?Event} event
1015 */ 1012 */
1016 _editMappingBlur: function(itemId, event) 1013 _editMappingBlur: function(itemId, event)
1017 { 1014 {
1018 var inputElements = Object.values(this._editInputElements[itemId]); 1015 var inputElements = Object.values(this._editInputElements[itemId]);
1019 if (inputElements.indexOf(event.relatedTarget) !== -1) 1016 if (inputElements.indexOf(event.relatedTarget) !== -1)
1020 return; 1017 return;
1021 1018
1022 var listItem = this.itemForId(itemId); 1019 var listItem = this.itemForId(itemId);
1023 listItem.classList.remove("item-editing"); 1020 listItem.classList.remove("item-editing");
1024 delete this._editingId; 1021 delete this._editingId;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 var columnId = columns[i]; 1054 var columnId = columns[i];
1058 var inputElement = this._addInputElements[columnId]; 1055 var inputElement = this._addInputElements[columnId];
1059 inputElement.value = ""; 1056 inputElement.value = "";
1060 } 1057 }
1061 }, 1058 },
1062 1059
1063 __proto__: WebInspector.SettingsList.prototype 1060 __proto__: WebInspector.SettingsList.prototype
1064 } 1061 }
1065 1062
1066 WebInspector._settingsController = new WebInspector.SettingsController(); 1063 WebInspector._settingsController = new WebInspector.SettingsController();
OLDNEW
« no previous file with comments | « Source/devtools/front_end/search/SourcesSearchScope.js ('k') | Source/devtools/front_end/source_frame/ResourceView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698