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

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

Issue 2487373002: DevTools: settings of custom devtools should not interfere with bundled devtools (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/host/Platform.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/common/Settings.js
diff --git a/third_party/WebKit/Source/devtools/front_end/common/Settings.js b/third_party/WebKit/Source/devtools/front_end/common/Settings.js
index 3615da0fa13140dff390b94efa33e8aae631063c..2e04904637690ae95334ff583b007a54864bfa3e 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/Settings.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/Settings.js
@@ -33,13 +33,12 @@
*/
WebInspector.Settings = class {
/**
- * @param {!WebInspector.SettingsStorage} storage
+ * @param {!WebInspector.SettingsStorage} globalStorage
+ * @param {!WebInspector.SettingsStorage} localStorage
*/
- constructor(storage) {
- this._settingsStorage = storage;
- var clearLocalStorage = window.localStorage ? window.localStorage.clear.bind(window.localStorage) : undefined;
- this._localStorage =
- new WebInspector.SettingsStorage(window.localStorage || {}, undefined, undefined, clearLocalStorage);
+ constructor(globalStorage, localStorage) {
+ this._settingsStorage = globalStorage;
+ this._localStorage = localStorage;
this._eventSupport = new WebInspector.Object();
/** @type {!Map<string, !WebInspector.Setting>} */
@@ -141,12 +140,14 @@ WebInspector.SettingsStorage = class {
* @param {function(string, string)=} setCallback
* @param {function(string)=} removeCallback
* @param {function(string)=} removeAllCallback
+ * @param {string=} storagePrefix
*/
- constructor(object, setCallback, removeCallback, removeAllCallback) {
+ constructor(object, setCallback, removeCallback, removeAllCallback, storagePrefix) {
this._object = object;
this._setCallback = setCallback || function() {};
this._removeCallback = removeCallback || function() {};
this._removeAllCallback = removeAllCallback || function() {};
+ this._storagePrefix = storagePrefix || '';
}
/**
@@ -154,6 +155,7 @@ WebInspector.SettingsStorage = class {
* @param {string} value
*/
set(name, value) {
+ name = this._storagePrefix + name;
this._object[name] = value;
this._setCallback(name, value);
}
@@ -163,6 +165,7 @@ WebInspector.SettingsStorage = class {
* @return {boolean}
*/
has(name) {
+ name = this._storagePrefix + name;
return name in this._object;
}
@@ -171,6 +174,7 @@ WebInspector.SettingsStorage = class {
* @return {string}
*/
get(name) {
+ name = this._storagePrefix + name;
return this._object[name];
}
@@ -178,6 +182,7 @@ WebInspector.SettingsStorage = class {
* @param {string} name
*/
remove(name) {
+ name = this._storagePrefix + name;
delete this._object[name];
this._removeCallback(name);
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/host/Platform.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698