| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Nokia Inc. All rights reserved. | 2 * Copyright (C) 2008 Nokia Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * @unrestricted | 31 * @unrestricted |
| 32 */ | 32 */ |
| 33 Resources.DOMStorage = class extends Common.Object { | 33 Resources.DOMStorage = class extends Common.ObjectBase { |
| 34 /** | 34 /** |
| 35 * @param {!Resources.DOMStorageModel} model | 35 * @param {!Resources.DOMStorageModel} model |
| 36 * @param {string} securityOrigin | 36 * @param {string} securityOrigin |
| 37 * @param {boolean} isLocalStorage | 37 * @param {boolean} isLocalStorage |
| 38 */ | 38 */ |
| 39 constructor(model, securityOrigin, isLocalStorage) { | 39 constructor(model, securityOrigin, isLocalStorage) { |
| 40 super(); | 40 super(); |
| 41 this._model = model; | 41 this._model = model; |
| 42 this._securityOrigin = securityOrigin; | 42 this._securityOrigin = securityOrigin; |
| 43 this._isLocalStorage = isLocalStorage; | 43 this._isLocalStorage = isLocalStorage; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * @param {string} key | 86 * @param {string} key |
| 87 */ | 87 */ |
| 88 removeItem(key) { | 88 removeItem(key) { |
| 89 this._model._agent.removeDOMStorageItem(this.id, key); | 89 this._model._agent.removeDOMStorageItem(this.id, key); |
| 90 } | 90 } |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 Resources.DOMStorage.ItemsClearedEvent = class {}; |
| 93 | 94 |
| 94 /** @enum {symbol} */ | 95 Resources.DOMStorage.ItemRemovedEvent = class { |
| 95 Resources.DOMStorage.Events = { | 96 /** |
| 96 DOMStorageItemsCleared: Symbol('DOMStorageItemsCleared'), | 97 * @param {string} key |
| 97 DOMStorageItemRemoved: Symbol('DOMStorageItemRemoved'), | 98 */ |
| 98 DOMStorageItemAdded: Symbol('DOMStorageItemAdded'), | 99 constructor(key) { |
| 99 DOMStorageItemUpdated: Symbol('DOMStorageItemUpdated') | 100 this.key = key; |
| 101 } |
| 102 }; |
| 103 |
| 104 Resources.DOMStorage.ItemAddedEvent = class { |
| 105 /** |
| 106 * @param {string} key |
| 107 * @param {string} value |
| 108 */ |
| 109 constructor(key, value) { |
| 110 this.key = key; |
| 111 this.value = value; |
| 112 } |
| 113 }; |
| 114 |
| 115 Resources.DOMStorage.ItemUpdatedEvent = class { |
| 116 /** |
| 117 * @param {string} key |
| 118 * @param {string} oldValue |
| 119 * @param {string} newValue |
| 120 */ |
| 121 constructor(key, oldValue, newValue) { |
| 122 this.key = key; |
| 123 this.oldValue = oldValue; |
| 124 this.newValue = newValue; |
| 125 } |
| 100 }; | 126 }; |
| 101 | 127 |
| 102 /** | 128 /** |
| 103 * @unrestricted | 129 * @unrestricted |
| 104 */ | 130 */ |
| 105 Resources.DOMStorageModel = class extends SDK.SDKModel { | 131 Resources.DOMStorageModel = class extends SDK.SDKModel { |
| 106 /** | 132 /** |
| 107 * @param {!SDK.Target} target | 133 * @param {!SDK.Target} target |
| 108 * @param {!SDK.SecurityOriginManager} securityOriginManager | 134 * @param {!SDK.SecurityOriginManager} securityOriginManager |
| 109 */ | 135 */ |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 return JSON.stringify(Resources.DOMStorage.storageId(securityOrigin, isLocal
Storage)); | 238 return JSON.stringify(Resources.DOMStorage.storageId(securityOrigin, isLocal
Storage)); |
| 213 } | 239 } |
| 214 | 240 |
| 215 /** | 241 /** |
| 216 * @param {!Protocol.DOMStorage.StorageId} storageId | 242 * @param {!Protocol.DOMStorage.StorageId} storageId |
| 217 */ | 243 */ |
| 218 _domStorageItemsCleared(storageId) { | 244 _domStorageItemsCleared(storageId) { |
| 219 var domStorage = this.storageForId(storageId); | 245 var domStorage = this.storageForId(storageId); |
| 220 if (!domStorage) | 246 if (!domStorage) |
| 221 return; | 247 return; |
| 222 | 248 domStorage.dispatchEventToListeners(new Resources.DOMStorage.ItemsClearedEve
nt()); |
| 223 var eventData = {}; | |
| 224 domStorage.dispatchEventToListeners(Resources.DOMStorage.Events.DOMStorageIt
emsCleared, eventData); | |
| 225 } | 249 } |
| 226 | 250 |
| 227 /** | 251 /** |
| 228 * @param {!Protocol.DOMStorage.StorageId} storageId | 252 * @param {!Protocol.DOMStorage.StorageId} storageId |
| 229 * @param {string} key | 253 * @param {string} key |
| 230 */ | 254 */ |
| 231 _domStorageItemRemoved(storageId, key) { | 255 _domStorageItemRemoved(storageId, key) { |
| 232 var domStorage = this.storageForId(storageId); | 256 var domStorage = this.storageForId(storageId); |
| 233 if (!domStorage) | 257 if (!domStorage) |
| 234 return; | 258 return; |
| 235 | 259 domStorage.dispatchEventToListeners(new Resources.DOMStorage.ItemRemovedEven
t(key)); |
| 236 var eventData = {key: key}; | |
| 237 domStorage.dispatchEventToListeners(Resources.DOMStorage.Events.DOMStorageIt
emRemoved, eventData); | |
| 238 } | 260 } |
| 239 | 261 |
| 240 /** | 262 /** |
| 241 * @param {!Protocol.DOMStorage.StorageId} storageId | 263 * @param {!Protocol.DOMStorage.StorageId} storageId |
| 242 * @param {string} key | 264 * @param {string} key |
| 243 * @param {string} value | 265 * @param {string} value |
| 244 */ | 266 */ |
| 245 _domStorageItemAdded(storageId, key, value) { | 267 _domStorageItemAdded(storageId, key, value) { |
| 246 var domStorage = this.storageForId(storageId); | 268 var domStorage = this.storageForId(storageId); |
| 247 if (!domStorage) | 269 if (!domStorage) |
| 248 return; | 270 return; |
| 249 | 271 domStorage.dispatchEventToListeners(new Resources.DOMStorage.ItemAddedEvent(
key, value)); |
| 250 var eventData = {key: key, value: value}; | |
| 251 domStorage.dispatchEventToListeners(Resources.DOMStorage.Events.DOMStorageIt
emAdded, eventData); | |
| 252 } | 272 } |
| 253 | 273 |
| 254 /** | 274 /** |
| 255 * @param {!Protocol.DOMStorage.StorageId} storageId | 275 * @param {!Protocol.DOMStorage.StorageId} storageId |
| 256 * @param {string} key | 276 * @param {string} key |
| 257 * @param {string} oldValue | 277 * @param {string} oldValue |
| 258 * @param {string} value | 278 * @param {string} value |
| 259 */ | 279 */ |
| 260 _domStorageItemUpdated(storageId, key, oldValue, value) { | 280 _domStorageItemUpdated(storageId, key, oldValue, value) { |
| 261 var domStorage = this.storageForId(storageId); | 281 var domStorage = this.storageForId(storageId); |
| 262 if (!domStorage) | 282 if (!domStorage) |
| 263 return; | 283 return; |
| 264 | 284 domStorage.dispatchEventToListeners(new Resources.DOMStorage.ItemUpdatedEven
t(key, oldValue, value)); |
| 265 var eventData = {key: key, oldValue: oldValue, value: value}; | |
| 266 domStorage.dispatchEventToListeners(Resources.DOMStorage.Events.DOMStorageIt
emUpdated, eventData); | |
| 267 } | 285 } |
| 268 | 286 |
| 269 /** | 287 /** |
| 270 * @param {!Protocol.DOMStorage.StorageId} storageId | 288 * @param {!Protocol.DOMStorage.StorageId} storageId |
| 271 * @return {!Resources.DOMStorage} | 289 * @return {!Resources.DOMStorage} |
| 272 */ | 290 */ |
| 273 storageForId(storageId) { | 291 storageForId(storageId) { |
| 274 return this._storages[JSON.stringify(storageId)]; | 292 return this._storages[JSON.stringify(storageId)]; |
| 275 } | 293 } |
| 276 | 294 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 * @param {string} key | 354 * @param {string} key |
| 337 * @param {string} oldValue | 355 * @param {string} oldValue |
| 338 * @param {string} value | 356 * @param {string} value |
| 339 */ | 357 */ |
| 340 domStorageItemUpdated(storageId, key, oldValue, value) { | 358 domStorageItemUpdated(storageId, key, oldValue, value) { |
| 341 this._model._domStorageItemUpdated(storageId, key, oldValue, value); | 359 this._model._domStorageItemUpdated(storageId, key, oldValue, value); |
| 342 } | 360 } |
| 343 }; | 361 }; |
| 344 | 362 |
| 345 Resources.DOMStorageModel._symbol = Symbol('DomStorage'); | 363 Resources.DOMStorageModel._symbol = Symbol('DomStorage'); |
| OLD | NEW |