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

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

Issue 2839413002: DevTools: add rendering overlay options to command menu (Closed)
Patch Set: ac 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) 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 case ('global'): 68 case ('global'):
69 storageType = Common.SettingStorageType.Global; 69 storageType = Common.SettingStorageType.Global;
70 break; 70 break;
71 default: 71 default:
72 storageType = Common.SettingStorageType.Global; 72 storageType = Common.SettingStorageType.Global;
73 } 73 }
74 var setting = isRegex ? this.createRegExpSetting(settingName, defaultValue, undefined, storageType) : 74 var setting = isRegex ? this.createRegExpSetting(settingName, defaultValue, undefined, storageType) :
75 this.createSetting(settingName, defaultValue, storag eType); 75 this.createSetting(settingName, defaultValue, storag eType);
76 if (descriptor['title']) 76 if (descriptor['title'])
77 setting.setTitle(descriptor['title']); 77 setting.setTitle(descriptor['title']);
78 setting._extension = extension;
78 this._moduleSettings.set(settingName, setting); 79 this._moduleSettings.set(settingName, setting);
79 } 80 }
80 81
81 /** 82 /**
82 * @param {string} settingName 83 * @param {string} settingName
83 * @return {!Common.Setting} 84 * @return {!Common.Setting}
84 */ 85 */
85 moduleSetting(settingName) { 86 moduleSetting(settingName) {
86 var setting = this._moduleSettings.get(settingName); 87 var setting = this._moduleSettings.get(settingName);
87 if (!setting) 88 if (!setting)
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 * @param {!Common.SettingsStorage} storage 257 * @param {!Common.SettingsStorage} storage
257 */ 258 */
258 constructor(settings, name, defaultValue, eventSupport, storage) { 259 constructor(settings, name, defaultValue, eventSupport, storage) {
259 this._settings = settings; 260 this._settings = settings;
260 this._name = name; 261 this._name = name;
261 this._defaultValue = defaultValue; 262 this._defaultValue = defaultValue;
262 this._eventSupport = eventSupport; 263 this._eventSupport = eventSupport;
263 this._storage = storage; 264 this._storage = storage;
264 /** @type {string} */ 265 /** @type {string} */
265 this._title = ''; 266 this._title = '';
267 this._extension = null;
266 } 268 }
267 269
268 /** 270 /**
269 * @param {function(!Common.Event)} listener 271 * @param {function(!Common.Event)} listener
270 * @param {!Object=} thisObject 272 * @param {!Object=} thisObject
271 */ 273 */
272 addChangeListener(listener, thisObject) { 274 addChangeListener(listener, thisObject) {
273 this._eventSupport.addEventListener(this._name, listener, thisObject); 275 this._eventSupport.addEventListener(this._name, listener, thisObject);
274 } 276 }
275 277
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 this._eventSupport.dispatchEventToListeners(this._name, value); 337 this._eventSupport.dispatchEventToListeners(this._name, value);
336 } 338 }
337 339
338 remove() { 340 remove() {
339 this._settings._registry.delete(this._name); 341 this._settings._registry.delete(this._name);
340 this._settings._moduleSettings.delete(this._name); 342 this._settings._moduleSettings.delete(this._name);
341 this._storage.remove(this._name); 343 this._storage.remove(this._name);
342 } 344 }
343 345
344 /** 346 /**
347 * @return {?Runtime.Extension}
348 */
349 extension() {
350 return this._extension;
351 }
352
353 /**
345 * @param {string} message 354 * @param {string} message
346 * @param {string} name 355 * @param {string} name
347 * @param {string} value 356 * @param {string} value
348 */ 357 */
349 _printSettingsSavingError(message, name, value) { 358 _printSettingsSavingError(message, name, value) {
350 var errorMessage = 359 var errorMessage =
351 'Error saving setting with name: ' + this._name + ', value length: ' + v alue.length + '. Error: ' + message; 360 'Error saving setting with name: ' + this._name + ', value length: ' + v alue.length + '. Error: ' + message;
352 console.error(errorMessage); 361 console.error(errorMessage);
353 Common.console.error(errorMessage); 362 Common.console.error(errorMessage);
354 this._storage._dumpSizes(); 363 this._storage._dumpSizes();
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 return Common.settings.moduleSetting(settingName); 831 return Common.settings.moduleSetting(settingName);
823 }; 832 };
824 833
825 /** 834 /**
826 * @param {string} settingName 835 * @param {string} settingName
827 * @return {!Common.Setting} 836 * @return {!Common.Setting}
828 */ 837 */
829 Common.settingForTest = function(settingName) { 838 Common.settingForTest = function(settingName) {
830 return Common.settings.settingForTest(settingName); 839 return Common.settings.settingForTest(settingName);
831 }; 840 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698