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

Side by Side Diff: Source/devtools/front_end/common/Settings.js

Issue 413213003: DevTools: Support Blackbox/Disabled options in framework blackboxing UI dialog. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed Created 6 years, 4 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
« no previous file with comments | « no previous file | Source/devtools/front_end/settings/FrameworkBlackboxDialog.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 * @constructor 203 * @constructor
204 * @extends {WebInspector.Setting} 204 * @extends {WebInspector.Setting}
205 * @param {string} name 205 * @param {string} name
206 * @param {string} defaultValue 206 * @param {string} defaultValue
207 * @param {!WebInspector.Object} eventSupport 207 * @param {!WebInspector.Object} eventSupport
208 * @param {?Storage} storage 208 * @param {?Storage} storage
209 * @param {string=} regexFlags 209 * @param {string=} regexFlags
210 */ 210 */
211 WebInspector.RegExpSetting = function(name, defaultValue, eventSupport, storage, regexFlags) 211 WebInspector.RegExpSetting = function(name, defaultValue, eventSupport, storage, regexFlags)
212 { 212 {
213 WebInspector.Setting.call(this, name, [defaultValue], eventSupport, storage) ; 213 WebInspector.Setting.call(this, name, defaultValue ? [{ pattern: defaultValu e }] : [], eventSupport, storage);
214 this._regexFlags = regexFlags; 214 this._regexFlags = regexFlags;
215 } 215 }
216 216
217 WebInspector.RegExpSetting.prototype = { 217 WebInspector.RegExpSetting.prototype = {
218 /** 218 /**
219 * @override 219 * @override
220 * @return {string} 220 * @return {string}
221 */ 221 */
222 get: function() 222 get: function()
223 { 223 {
224 return this.getAsArray().join("|"); 224 var result = [];
225 var items = this.getAsArray();
226 for (var i = 0; i < items.length; ++i) {
227 var item = items[i];
228 if (item.pattern && !item.disabled)
229 result.push(item.pattern);
230 }
231 return result.join("|");
225 }, 232 },
226 233
227 /** 234 /**
228 * @return {!Array.<string>} 235 * @return {!Array.<{pattern: string, disabled: (boolean|undefined)}>}
229 */ 236 */
230 getAsArray: function() 237 getAsArray: function()
231 { 238 {
232 var value = WebInspector.Setting.prototype.get.call(this); 239 return WebInspector.Setting.prototype.get.call(this);
233 if (typeof value === "string") // Backward compatibility.
234 value = [value];
235 value.remove("");
236 return value;
237 }, 240 },
238 241
239 /** 242 /**
240 * @override 243 * @override
241 * @param {string} value 244 * @param {string} value
242 */ 245 */
243 set: function(value) 246 set: function(value)
244 { 247 {
245 this.setAsArray([value]); 248 this.setAsArray([{ pattern: value }]);
246 }, 249 },
247 250
248 /** 251 /**
249 * @param {!Array.<string>} value 252 * @param {!Array.<{pattern: string, disabled: (boolean|undefined)}>} value
250 */ 253 */
251 setAsArray: function(value) 254 setAsArray: function(value)
252 { 255 {
253 delete this._regex; 256 delete this._regex;
254 value.remove("");
255 WebInspector.Setting.prototype.set.call(this, value); 257 WebInspector.Setting.prototype.set.call(this, value);
256 }, 258 },
257 259
258 /** 260 /**
259 * @return {?RegExp} 261 * @return {?RegExp}
260 */ 262 */
261 asRegExp: function() 263 asRegExp: function()
262 { 264 {
263 if (typeof this._regex !== "undefined") 265 if (typeof this._regex !== "undefined")
264 return this._regex; 266 return this._regex;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 449 }
448 } 450 }
449 451
450 /** 452 /**
451 * @constructor 453 * @constructor
452 */ 454 */
453 WebInspector.VersionController = function() 455 WebInspector.VersionController = function()
454 { 456 {
455 } 457 }
456 458
457 WebInspector.VersionController.currentVersion = 8; 459 WebInspector.VersionController.currentVersion = 9;
458 460
459 WebInspector.VersionController.prototype = { 461 WebInspector.VersionController.prototype = {
460 updateVersion: function() 462 updateVersion: function()
461 { 463 {
462 var versionSetting = WebInspector.settings.createSetting("inspectorVersi on", 0); 464 var versionSetting = WebInspector.settings.createSetting("inspectorVersi on", 0);
463 var currentVersion = WebInspector.VersionController.currentVersion; 465 var currentVersion = WebInspector.VersionController.currentVersion;
464 var oldVersion = versionSetting.get(); 466 var oldVersion = versionSetting.get();
465 var methodsToRun = this._methodsToRunToUpdateVersion(oldVersion, current Version); 467 var methodsToRun = this._methodsToRunToUpdateVersion(oldVersion, current Version);
466 for (var i = 0; i < methodsToRun.length; ++i) 468 for (var i = 0; i < methodsToRun.length; ++i)
467 this[methodsToRun[i]].call(this); 469 this[methodsToRun[i]].call(this);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 var deviceScaleFactor = parseFloat(components[2]); 636 var deviceScaleFactor = parseFloat(components[2]);
635 if (deviceScaleFactor) { 637 if (deviceScaleFactor) {
636 components[0] = "" + Math.round(width / deviceScaleFactor); 638 components[0] = "" + Math.round(width / deviceScaleFactor);
637 components[1] = "" + Math.round(height / deviceScaleFactor); 639 components[1] = "" + Math.round(height / deviceScaleFactor);
638 } 640 }
639 } 641 }
640 value = components.join("x"); 642 value = components.join("x");
641 setting.set(value); 643 setting.set(value);
642 }, 644 },
643 645
646 _updateVersionFrom8To9: function()
647 {
648 if (!window.localStorage)
649 return;
650
651 var settingNames = [
652 "skipStackFramesPattern",
653 "workspaceFolderExcludePattern"
654 ];
655
656 for (var i = 0; i < settingNames.length; ++i) {
657 var settingName = settingNames[i];
658 if (!(settingName in window.localStorage))
659 continue;
660 try {
661 var value = JSON.parse(window.localStorage[settingName]);
662 if (!value)
663 continue;
664 if (typeof value === "string")
665 value = [value];
666 for (var j = 0; j < value.length; ++j) {
667 if (typeof value[j] === "string")
668 value[j] = { pattern: value[j] };
669 }
670 window.localStorage[settingName] = JSON.stringify(value);
671 } catch(e) {
672 }
673 }
674 },
675
644 /** 676 /**
645 * @param {!WebInspector.Setting} breakpointsSetting 677 * @param {!WebInspector.Setting} breakpointsSetting
646 * @param {number} maxBreakpointsCount 678 * @param {number} maxBreakpointsCount
647 */ 679 */
648 _clearBreakpointsWhenTooMany: function(breakpointsSetting, maxBreakpointsCou nt) 680 _clearBreakpointsWhenTooMany: function(breakpointsSetting, maxBreakpointsCou nt)
649 { 681 {
650 // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused 682 // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused
651 // periodical breakpoints duplication leading to inspector slowness. 683 // periodical breakpoints duplication leading to inspector slowness.
652 if (breakpointsSetting.get().length > maxBreakpointsCount) 684 if (breakpointsSetting.get().length > maxBreakpointsCount)
653 breakpointsSetting.set([]); 685 breakpointsSetting.set([]);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 763
732 _fireChangedIfNeeded: function() 764 _fireChangedIfNeeded: function()
733 { 765 {
734 var newValue = this._calculateValue(); 766 var newValue = this._calculateValue();
735 if (newValue === this._value) 767 if (newValue === this._value)
736 return; 768 return;
737 this._value = newValue; 769 this._value = newValue;
738 this._eventSupport.dispatchEventToListeners(this._name, this._value); 770 this._eventSupport.dispatchEventToListeners(this._name, this._value);
739 } 771 }
740 } 772 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/settings/FrameworkBlackboxDialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698