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

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

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 tabbedPane.setShrinkableTabs(false); 51 tabbedPane.setShrinkableTabs(false);
52 tabbedPane.setVerticalTabLayout(true); 52 tabbedPane.setVerticalTabLayout(true);
53 var shortcutsView = new WebInspector.SimpleView(WebInspector.UIString("Short cuts")); 53 var shortcutsView = new WebInspector.SimpleView(WebInspector.UIString("Short cuts"));
54 WebInspector.shortcutsScreen.createShortcutsTabView().show(shortcutsView.ele ment); 54 WebInspector.shortcutsScreen.createShortcutsTabView().show(shortcutsView.ele ment);
55 this._tabbedLocation.appendView(shortcutsView); 55 this._tabbedLocation.appendView(shortcutsView);
56 tabbedPane.show(this.contentElement); 56 tabbedPane.show(this.contentElement);
57 57
58 this.element.addEventListener("keydown", this._keyDown.bind(this), false); 58 this.element.addEventListener("keydown", this._keyDown.bind(this), false);
59 this._developerModeCounter = 0; 59 this._developerModeCounter = 0;
60 this.setDefaultFocusedElement(this.contentElement); 60 this.setDefaultFocusedElement(this.contentElement);
61 } 61 };
62 62
63 /** 63 /**
64 * @param {string=} name 64 * @param {string=} name
65 */ 65 */
66 WebInspector.SettingsScreen._showSettingsScreen = function(name) 66 WebInspector.SettingsScreen._showSettingsScreen = function(name)
67 { 67 {
68 var settingsScreen = /** @type {!WebInspector.SettingsScreen} */ (self.runti me.sharedInstance(WebInspector.SettingsScreen)); 68 var settingsScreen = /** @type {!WebInspector.SettingsScreen} */ (self.runti me.sharedInstance(WebInspector.SettingsScreen));
69 if (settingsScreen.isShowing()) 69 if (settingsScreen.isShowing())
70 return; 70 return;
71 var dialog = new WebInspector.Dialog(); 71 var dialog = new WebInspector.Dialog();
72 dialog.addCloseButton(); 72 dialog.addCloseButton();
73 settingsScreen.show(dialog.element); 73 settingsScreen.show(dialog.element);
74 dialog.show(); 74 dialog.show();
75 settingsScreen._selectTab(name || "preferences"); 75 settingsScreen._selectTab(name || "preferences");
76 } 76 };
77 77
78 WebInspector.SettingsScreen.prototype = { 78 WebInspector.SettingsScreen.prototype = {
79 /** 79 /**
80 * @override 80 * @override
81 * @param {string} locationName 81 * @param {string} locationName
82 * @return {?WebInspector.ViewLocation} 82 * @return {?WebInspector.ViewLocation}
83 */ 83 */
84 resolveLocation: function(locationName) 84 resolveLocation: function(locationName)
85 { 85 {
86 return this._tabbedLocation; 86 return this._tabbedLocation;
(...skipping 11 matching lines...) Expand all
98 * @param {!Event} event 98 * @param {!Event} event
99 */ 99 */
100 _keyDown: function(event) 100 _keyDown: function(event)
101 { 101 {
102 var shiftKeyCode = 16; 102 var shiftKeyCode = 16;
103 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5) 103 if (event.keyCode === shiftKeyCode && ++this._developerModeCounter > 5)
104 this.contentElement.classList.add("settings-developer-mode"); 104 this.contentElement.classList.add("settings-developer-mode");
105 }, 105 },
106 106
107 __proto__: WebInspector.VBox.prototype 107 __proto__: WebInspector.VBox.prototype
108 } 108 };
109 109
110 /** 110 /**
111 * @constructor 111 * @constructor
112 * @extends {WebInspector.VBox} 112 * @extends {WebInspector.VBox}
113 * @param {string} name 113 * @param {string} name
114 * @param {string=} id 114 * @param {string=} id
115 */ 115 */
116 WebInspector.SettingsTab = function(name, id) 116 WebInspector.SettingsTab = function(name, id)
117 { 117 {
118 WebInspector.VBox.call(this); 118 WebInspector.VBox.call(this);
119 this.element.classList.add("settings-tab-container"); 119 this.element.classList.add("settings-tab-container");
120 if (id) 120 if (id)
121 this.element.id = id; 121 this.element.id = id;
122 var header = this.element.createChild("header"); 122 var header = this.element.createChild("header");
123 header.createChild("h3").createTextChild(name); 123 header.createChild("h3").createTextChild(name);
124 this.containerElement = this.element.createChild("div", "help-container-wrap per").createChild("div", "settings-tab help-content help-container"); 124 this.containerElement = this.element.createChild("div", "help-container-wrap per").createChild("div", "settings-tab help-content help-container");
125 } 125 };
126 126
127 WebInspector.SettingsTab.prototype = { 127 WebInspector.SettingsTab.prototype = {
128 /** 128 /**
129 * @param {string=} name 129 * @param {string=} name
130 * @return {!Element} 130 * @return {!Element}
131 */ 131 */
132 _appendSection: function(name) 132 _appendSection: function(name)
133 { 133 {
134 var block = this.containerElement.createChild("div", "help-block"); 134 var block = this.containerElement.createChild("div", "help-block");
135 if (name) 135 if (name)
(...skipping 20 matching lines...) Expand all
156 { 156 {
157 // Don't use e.target.value to avoid conversion of the value to stri ng. 157 // Don't use e.target.value to avoid conversion of the value to stri ng.
158 setting.set(options[select.selectedIndex][1]); 158 setting.set(options[select.selectedIndex][1]);
159 } 159 }
160 160
161 select.addEventListener("change", changeListener, false); 161 select.addEventListener("change", changeListener, false);
162 return p; 162 return p;
163 }, 163 },
164 164
165 __proto__: WebInspector.VBox.prototype 165 __proto__: WebInspector.VBox.prototype
166 } 166 };
167 167
168 /** 168 /**
169 * @constructor 169 * @constructor
170 * @extends {WebInspector.SettingsTab} 170 * @extends {WebInspector.SettingsTab}
171 */ 171 */
172 WebInspector.GenericSettingsTab = function() 172 WebInspector.GenericSettingsTab = function()
173 { 173 {
174 WebInspector.SettingsTab.call(this, WebInspector.UIString("Preferences"), "p references-tab-content"); 174 WebInspector.SettingsTab.call(this, WebInspector.UIString("Preferences"), "p references-tab-content");
175 175
176 /** @const */ 176 /** @const */
177 var explicitSectionOrder = ["", "Appearance", "Elements", "Sources", "Networ k", "Profiler", "Console", "Extensions"]; 177 var explicitSectionOrder = ["", "Appearance", "Elements", "Sources", "Networ k", "Profiler", "Console", "Extensions"];
178 /** @type {!Map<string, !Element>} */ 178 /** @type {!Map<string, !Element>} */
179 this._nameToSection = new Map(); 179 this._nameToSection = new Map();
180 /** @type {!Map<string, !Element>} */ 180 /** @type {!Map<string, !Element>} */
181 this._nameToSettingElement = new Map(); 181 this._nameToSettingElement = new Map();
182 for (var sectionName of explicitSectionOrder) 182 for (var sectionName of explicitSectionOrder)
183 this._sectionElement(sectionName); 183 this._sectionElement(sectionName);
184 self.runtime.extensions("setting").forEach(this._addSetting.bind(this)); 184 self.runtime.extensions("setting").forEach(this._addSetting.bind(this));
185 self.runtime.extensions(WebInspector.SettingUI).forEach(this._addSettingUI.b ind(this)); 185 self.runtime.extensions(WebInspector.SettingUI).forEach(this._addSettingUI.b ind(this));
186 186
187 this._appendSection().appendChild(createTextButton(WebInspector.UIString("Re store defaults and reload"), restoreAndReload)); 187 this._appendSection().appendChild(createTextButton(WebInspector.UIString("Re store defaults and reload"), restoreAndReload));
188 188
189 function restoreAndReload() 189 function restoreAndReload()
190 { 190 {
191 WebInspector.settings.clearAll(); 191 WebInspector.settings.clearAll();
192 WebInspector.reload(); 192 WebInspector.reload();
193 } 193 }
194 } 194 };
195 195
196 /** 196 /**
197 * @param {!Runtime.Extension} extension 197 * @param {!Runtime.Extension} extension
198 * @return {boolean} 198 * @return {boolean}
199 */ 199 */
200 WebInspector.GenericSettingsTab.isSettingVisible = function(extension) 200 WebInspector.GenericSettingsTab.isSettingVisible = function(extension)
201 { 201 {
202 var descriptor = extension.descriptor(); 202 var descriptor = extension.descriptor();
203 if (!("title" in descriptor)) 203 if (!("title" in descriptor))
204 return false; 204 return false;
205 if (!("category" in descriptor)) 205 if (!("category" in descriptor))
206 return false; 206 return false;
207 return true; 207 return true;
208 } 208 };
209 209
210 WebInspector.GenericSettingsTab.prototype = { 210 WebInspector.GenericSettingsTab.prototype = {
211 /** 211 /**
212 * @param {!Runtime.Extension} extension 212 * @param {!Runtime.Extension} extension
213 */ 213 */
214 _addSetting: function(extension) 214 _addSetting: function(extension)
215 { 215 {
216 if (!WebInspector.GenericSettingsTab.isSettingVisible(extension)) 216 if (!WebInspector.GenericSettingsTab.isSettingVisible(extension))
217 return; 217 return;
218 var descriptor = extension.descriptor(); 218 var descriptor = extension.descriptor();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 var sectionElement = this._nameToSection.get(sectionName); 277 var sectionElement = this._nameToSection.get(sectionName);
278 if (!sectionElement) { 278 if (!sectionElement) {
279 var uiSectionName = sectionName && WebInspector.UIString(sectionName ); 279 var uiSectionName = sectionName && WebInspector.UIString(sectionName );
280 sectionElement = this._appendSection(uiSectionName); 280 sectionElement = this._appendSection(uiSectionName);
281 this._nameToSection.set(sectionName, sectionElement); 281 this._nameToSection.set(sectionName, sectionElement);
282 } 282 }
283 return sectionElement; 283 return sectionElement;
284 }, 284 },
285 285
286 __proto__: WebInspector.SettingsTab.prototype 286 __proto__: WebInspector.SettingsTab.prototype
287 } 287 };
288 288
289 /** 289 /**
290 * @constructor 290 * @constructor
291 * @extends {WebInspector.SettingsTab} 291 * @extends {WebInspector.SettingsTab}
292 */ 292 */
293 WebInspector.WorkspaceSettingsTab = function() 293 WebInspector.WorkspaceSettingsTab = function()
294 { 294 {
295 WebInspector.SettingsTab.call(this, WebInspector.UIString("Workspace"), "wor kspace-tab-content"); 295 WebInspector.SettingsTab.call(this, WebInspector.UIString("Workspace"), "wor kspace-tab-content");
296 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this); 296 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this);
297 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this); 297 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this);
298 298
299 var folderExcludePatternInput = this._createFolderExcludePatternInput(); 299 var folderExcludePatternInput = this._createFolderExcludePatternInput();
300 folderExcludePatternInput.classList.add("folder-exclude-pattern"); 300 folderExcludePatternInput.classList.add("folder-exclude-pattern");
301 this.containerElement.appendChild(folderExcludePatternInput); 301 this.containerElement.appendChild(folderExcludePatternInput);
302 302
303 this._fileSystemsListContainer = this.containerElement.createChild("div", "" ); 303 this._fileSystemsListContainer = this.containerElement.createChild("div", "" );
304 304
305 this.containerElement.appendChild(createTextButton(WebInspector.UIString("Ad d folder\u2026"), this._addFileSystemClicked.bind(this))); 305 this.containerElement.appendChild(createTextButton(WebInspector.UIString("Ad d folder\u2026"), this._addFileSystemClicked.bind(this)));
306 306
307 /** @type {!Map<string, !Element>} */ 307 /** @type {!Map<string, !Element>} */
308 this._elementByPath = new Map(); 308 this._elementByPath = new Map();
309 309
310 /** @type {!Map<string, !WebInspector.EditFileSystemView>} */ 310 /** @type {!Map<string, !WebInspector.EditFileSystemView>} */
311 this._mappingViewByPath = new Map(); 311 this._mappingViewByPath = new Map();
312 312
313 var fileSystems = WebInspector.isolatedFileSystemManager.fileSystems(); 313 var fileSystems = WebInspector.isolatedFileSystemManager.fileSystems();
314 for (var i = 0; i < fileSystems.length; ++i) 314 for (var i = 0; i < fileSystems.length; ++i)
315 this._addItem(fileSystems[i]); 315 this._addItem(fileSystems[i]);
316 } 316 };
317 317
318 WebInspector.WorkspaceSettingsTab.prototype = { 318 WebInspector.WorkspaceSettingsTab.prototype = {
319 /** 319 /**
320 * @return {!Element} 320 * @return {!Element}
321 */ 321 */
322 _createFolderExcludePatternInput: function() 322 _createFolderExcludePatternInput: function()
323 { 323 {
324 var p = createElement("p"); 324 var p = createElement("p");
325 var labelElement = p.createChild("label"); 325 var labelElement = p.createChild("label");
326 labelElement.textContent = WebInspector.UIString("Folder exclude pattern "); 326 labelElement.textContent = WebInspector.UIString("Folder exclude pattern ");
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 422
423 var element = this._elementByPath.get(fileSystem.path()); 423 var element = this._elementByPath.get(fileSystem.path());
424 if (element) { 424 if (element) {
425 this._elementByPath.delete(fileSystem.path()); 425 this._elementByPath.delete(fileSystem.path());
426 element.remove(); 426 element.remove();
427 } 427 }
428 }, 428 },
429 429
430 __proto__: WebInspector.SettingsTab.prototype 430 __proto__: WebInspector.SettingsTab.prototype
431 } 431 };
432 432
433 433
434 /** 434 /**
435 * @constructor 435 * @constructor
436 * @extends {WebInspector.SettingsTab} 436 * @extends {WebInspector.SettingsTab}
437 */ 437 */
438 WebInspector.ExperimentsSettingsTab = function() 438 WebInspector.ExperimentsSettingsTab = function()
439 { 439 {
440 WebInspector.SettingsTab.call(this, WebInspector.UIString("Experiments"), "e xperiments-tab-content"); 440 WebInspector.SettingsTab.call(this, WebInspector.UIString("Experiments"), "e xperiments-tab-content");
441 441
442 var experiments = Runtime.experiments.allConfigurableExperiments(); 442 var experiments = Runtime.experiments.allConfigurableExperiments();
443 if (experiments.length) { 443 if (experiments.length) {
444 var experimentsSection = this._appendSection(); 444 var experimentsSection = this._appendSection();
445 experimentsSection.appendChild(this._createExperimentsWarningSubsection( )); 445 experimentsSection.appendChild(this._createExperimentsWarningSubsection( ));
446 for (var i = 0; i < experiments.length; ++i) 446 for (var i = 0; i < experiments.length; ++i)
447 experimentsSection.appendChild(this._createExperimentCheckbox(experi ments[i])); 447 experimentsSection.appendChild(this._createExperimentCheckbox(experi ments[i]));
448 } 448 }
449 } 449 };
450 450
451 WebInspector.ExperimentsSettingsTab.prototype = { 451 WebInspector.ExperimentsSettingsTab.prototype = {
452 /** 452 /**
453 * @return {!Element} element 453 * @return {!Element} element
454 */ 454 */
455 _createExperimentsWarningSubsection: function() 455 _createExperimentsWarningSubsection: function()
456 { 456 {
457 var subsection = createElement("div"); 457 var subsection = createElement("div");
458 var warning = subsection.createChild("span", "settings-experiments-warni ng-subsection-warning"); 458 var warning = subsection.createChild("span", "settings-experiments-warni ng-subsection-warning");
459 warning.textContent = WebInspector.UIString("WARNING:"); 459 warning.textContent = WebInspector.UIString("WARNING:");
(...skipping 14 matching lines...) Expand all
474 } 474 }
475 input.addEventListener("click", listener, false); 475 input.addEventListener("click", listener, false);
476 476
477 var p = createElement("p"); 477 var p = createElement("p");
478 p.className = experiment.hidden && !experiment.isEnabled() ? "settings-e xperiment-hidden" : ""; 478 p.className = experiment.hidden && !experiment.isEnabled() ? "settings-e xperiment-hidden" : "";
479 p.appendChild(label); 479 p.appendChild(label);
480 return p; 480 return p;
481 }, 481 },
482 482
483 __proto__: WebInspector.SettingsTab.prototype 483 __proto__: WebInspector.SettingsTab.prototype
484 } 484 };
485 485
486 /** 486 /**
487 * @constructor 487 * @constructor
488 * @implements {WebInspector.ActionDelegate} 488 * @implements {WebInspector.ActionDelegate}
489 */ 489 */
490 WebInspector.SettingsScreen.ActionDelegate = function() { } 490 WebInspector.SettingsScreen.ActionDelegate = function() { };
491 491
492 WebInspector.SettingsScreen.ActionDelegate.prototype = { 492 WebInspector.SettingsScreen.ActionDelegate.prototype = {
493 /** 493 /**
494 * @override 494 * @override
495 * @param {!WebInspector.Context} context 495 * @param {!WebInspector.Context} context
496 * @param {string} actionId 496 * @param {string} actionId
497 * @return {boolean} 497 * @return {boolean}
498 */ 498 */
499 handleAction: function(context, actionId) 499 handleAction: function(context, actionId)
500 { 500 {
501 switch (actionId) { 501 switch (actionId) {
502 case "settings.show": 502 case "settings.show":
503 WebInspector.SettingsScreen._showSettingsScreen(); 503 WebInspector.SettingsScreen._showSettingsScreen();
504 return true; 504 return true;
505 case "settings.help": 505 case "settings.help":
506 InspectorFrontendHost.openInNewTab("https://developers.google.com/we b/tools/chrome-devtools/"); 506 InspectorFrontendHost.openInNewTab("https://developers.google.com/we b/tools/chrome-devtools/");
507 return true; 507 return true;
508 case "settings.shortcuts": 508 case "settings.shortcuts":
509 WebInspector.SettingsScreen._showSettingsScreen(WebInspector.UIStrin g("Shortcuts")); 509 WebInspector.SettingsScreen._showSettingsScreen(WebInspector.UIStrin g("Shortcuts"));
510 return true; 510 return true;
511 } 511 }
512 return false; 512 return false;
513 } 513 }
514 } 514 };
515 515
516 /** 516 /**
517 * @constructor 517 * @constructor
518 * @implements {WebInspector.Revealer} 518 * @implements {WebInspector.Revealer}
519 */ 519 */
520 WebInspector.SettingsScreen.Revealer = function() { } 520 WebInspector.SettingsScreen.Revealer = function() { };
521 521
522 WebInspector.SettingsScreen.Revealer.prototype = { 522 WebInspector.SettingsScreen.Revealer.prototype = {
523 /** 523 /**
524 * @override 524 * @override
525 * @param {!Object} object 525 * @param {!Object} object
526 * @return {!Promise} 526 * @return {!Promise}
527 */ 527 */
528 reveal: function(object) 528 reveal: function(object)
529 { 529 {
530 console.assert(object instanceof WebInspector.Setting); 530 console.assert(object instanceof WebInspector.Setting);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 if (location !== "settings-view") 573 if (location !== "settings-view")
574 return; 574 return;
575 var settings = extension.descriptor()["settings"]; 575 var settings = extension.descriptor()["settings"];
576 if (settings && settings.indexOf(setting.name) !== -1) { 576 if (settings && settings.indexOf(setting.name) !== -1) {
577 InspectorFrontendHost.bringToFront(); 577 InspectorFrontendHost.bringToFront();
578 WebInspector.SettingsScreen._showSettingsScreen(extension.descri ptor()["id"]); 578 WebInspector.SettingsScreen._showSettingsScreen(extension.descri ptor()["id"]);
579 success = true; 579 success = true;
580 } 580 }
581 } 581 }
582 } 582 }
583 } 583 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698