| 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 21 matching lines...) Expand all Loading... |
| 32 * @extends {WebInspector.Object} | 32 * @extends {WebInspector.Object} |
| 33 * @param {!WebInspector.DOMStorageModel} model | 33 * @param {!WebInspector.DOMStorageModel} model |
| 34 * @param {string} securityOrigin | 34 * @param {string} securityOrigin |
| 35 * @param {boolean} isLocalStorage | 35 * @param {boolean} isLocalStorage |
| 36 */ | 36 */ |
| 37 WebInspector.DOMStorage = function(model, securityOrigin, isLocalStorage) | 37 WebInspector.DOMStorage = function(model, securityOrigin, isLocalStorage) |
| 38 { | 38 { |
| 39 this._model = model; | 39 this._model = model; |
| 40 this._securityOrigin = securityOrigin; | 40 this._securityOrigin = securityOrigin; |
| 41 this._isLocalStorage = isLocalStorage; | 41 this._isLocalStorage = isLocalStorage; |
| 42 } | 42 }; |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * @param {string} securityOrigin | 45 * @param {string} securityOrigin |
| 46 * @param {boolean} isLocalStorage | 46 * @param {boolean} isLocalStorage |
| 47 * @return {!DOMStorageAgent.StorageId} | 47 * @return {!DOMStorageAgent.StorageId} |
| 48 */ | 48 */ |
| 49 WebInspector.DOMStorage.storageId = function(securityOrigin, isLocalStorage) | 49 WebInspector.DOMStorage.storageId = function(securityOrigin, isLocalStorage) |
| 50 { | 50 { |
| 51 return { securityOrigin: securityOrigin, isLocalStorage: isLocalStorage }; | 51 return { securityOrigin: securityOrigin, isLocalStorage: isLocalStorage }; |
| 52 } | 52 }; |
| 53 | 53 |
| 54 /** @enum {symbol} */ | 54 /** @enum {symbol} */ |
| 55 WebInspector.DOMStorage.Events = { | 55 WebInspector.DOMStorage.Events = { |
| 56 DOMStorageItemsCleared: Symbol("DOMStorageItemsCleared"), | 56 DOMStorageItemsCleared: Symbol("DOMStorageItemsCleared"), |
| 57 DOMStorageItemRemoved: Symbol("DOMStorageItemRemoved"), | 57 DOMStorageItemRemoved: Symbol("DOMStorageItemRemoved"), |
| 58 DOMStorageItemAdded: Symbol("DOMStorageItemAdded"), | 58 DOMStorageItemAdded: Symbol("DOMStorageItemAdded"), |
| 59 DOMStorageItemUpdated: Symbol("DOMStorageItemUpdated") | 59 DOMStorageItemUpdated: Symbol("DOMStorageItemUpdated") |
| 60 } | 60 }; |
| 61 | 61 |
| 62 WebInspector.DOMStorage.prototype = { | 62 WebInspector.DOMStorage.prototype = { |
| 63 | 63 |
| 64 /** @return {!DOMStorageAgent.StorageId} */ | 64 /** @return {!DOMStorageAgent.StorageId} */ |
| 65 get id() | 65 get id() |
| 66 { | 66 { |
| 67 return WebInspector.DOMStorage.storageId(this._securityOrigin, this._isL
ocalStorage); | 67 return WebInspector.DOMStorage.storageId(this._securityOrigin, this._isL
ocalStorage); |
| 68 }, | 68 }, |
| 69 | 69 |
| 70 /** @return {string} */ | 70 /** @return {string} */ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * @param {string} key | 100 * @param {string} key |
| 101 */ | 101 */ |
| 102 removeItem: function(key) | 102 removeItem: function(key) |
| 103 { | 103 { |
| 104 this._model._agent.removeDOMStorageItem(this.id, key); | 104 this._model._agent.removeDOMStorageItem(this.id, key); |
| 105 }, | 105 }, |
| 106 | 106 |
| 107 __proto__: WebInspector.Object.prototype | 107 __proto__: WebInspector.Object.prototype |
| 108 } | 108 }; |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * @constructor | 111 * @constructor |
| 112 * @extends {WebInspector.SDKModel} | 112 * @extends {WebInspector.SDKModel} |
| 113 * @param {!WebInspector.Target} target | 113 * @param {!WebInspector.Target} target |
| 114 * @param {!WebInspector.SecurityOriginManager} securityOriginManager | 114 * @param {!WebInspector.SecurityOriginManager} securityOriginManager |
| 115 */ | 115 */ |
| 116 WebInspector.DOMStorageModel = function(target, securityOriginManager) | 116 WebInspector.DOMStorageModel = function(target, securityOriginManager) |
| 117 { | 117 { |
| 118 WebInspector.SDKModel.call(this, WebInspector.DOMStorageModel, target); | 118 WebInspector.SDKModel.call(this, WebInspector.DOMStorageModel, target); |
| 119 | 119 |
| 120 this._securityOriginManager = securityOriginManager; | 120 this._securityOriginManager = securityOriginManager; |
| 121 /** @type {!Object.<string, !WebInspector.DOMStorage>} */ | 121 /** @type {!Object.<string, !WebInspector.DOMStorage>} */ |
| 122 this._storages = {}; | 122 this._storages = {}; |
| 123 this._agent = target.domstorageAgent(); | 123 this._agent = target.domstorageAgent(); |
| 124 } | 124 }; |
| 125 | 125 |
| 126 /** @enum {symbol} */ | 126 /** @enum {symbol} */ |
| 127 WebInspector.DOMStorageModel.Events = { | 127 WebInspector.DOMStorageModel.Events = { |
| 128 DOMStorageAdded: Symbol("DOMStorageAdded"), | 128 DOMStorageAdded: Symbol("DOMStorageAdded"), |
| 129 DOMStorageRemoved: Symbol("DOMStorageRemoved") | 129 DOMStorageRemoved: Symbol("DOMStorageRemoved") |
| 130 } | 130 }; |
| 131 | 131 |
| 132 WebInspector.DOMStorageModel.prototype = { | 132 WebInspector.DOMStorageModel.prototype = { |
| 133 enable: function() | 133 enable: function() |
| 134 { | 134 { |
| 135 if (this._enabled) | 135 if (this._enabled) |
| 136 return; | 136 return; |
| 137 | 137 |
| 138 this.target().registerDOMStorageDispatcher(new WebInspector.DOMStorageDi
spatcher(this)); | 138 this.target().registerDOMStorageDispatcher(new WebInspector.DOMStorageDi
spatcher(this)); |
| 139 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin
Manager.Events.SecurityOriginAdded, this._securityOriginAdded, this); | 139 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin
Manager.Events.SecurityOriginAdded, this._securityOriginAdded, this); |
| 140 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin
Manager.Events.SecurityOriginRemoved, this._securityOriginRemoved, this); | 140 this._securityOriginManager.addEventListener(WebInspector.SecurityOrigin
Manager.Events.SecurityOriginRemoved, this._securityOriginRemoved, this); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 */ | 291 */ |
| 292 storages: function() | 292 storages: function() |
| 293 { | 293 { |
| 294 var result = []; | 294 var result = []; |
| 295 for (var id in this._storages) | 295 for (var id in this._storages) |
| 296 result.push(this._storages[id]); | 296 result.push(this._storages[id]); |
| 297 return result; | 297 return result; |
| 298 }, | 298 }, |
| 299 | 299 |
| 300 __proto__: WebInspector.SDKModel.prototype | 300 __proto__: WebInspector.SDKModel.prototype |
| 301 } | 301 }; |
| 302 | 302 |
| 303 /** | 303 /** |
| 304 * @constructor | 304 * @constructor |
| 305 * @implements {DOMStorageAgent.Dispatcher} | 305 * @implements {DOMStorageAgent.Dispatcher} |
| 306 * @param {!WebInspector.DOMStorageModel} model | 306 * @param {!WebInspector.DOMStorageModel} model |
| 307 */ | 307 */ |
| 308 WebInspector.DOMStorageDispatcher = function(model) | 308 WebInspector.DOMStorageDispatcher = function(model) |
| 309 { | 309 { |
| 310 this._model = model; | 310 this._model = model; |
| 311 } | 311 }; |
| 312 | 312 |
| 313 WebInspector.DOMStorageDispatcher.prototype = { | 313 WebInspector.DOMStorageDispatcher.prototype = { |
| 314 | 314 |
| 315 /** | 315 /** |
| 316 * @override | 316 * @override |
| 317 * @param {!DOMStorageAgent.StorageId} storageId | 317 * @param {!DOMStorageAgent.StorageId} storageId |
| 318 */ | 318 */ |
| 319 domStorageItemsCleared: function(storageId) | 319 domStorageItemsCleared: function(storageId) |
| 320 { | 320 { |
| 321 this._model._domStorageItemsCleared(storageId); | 321 this._model._domStorageItemsCleared(storageId); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 346 * @override | 346 * @override |
| 347 * @param {!DOMStorageAgent.StorageId} storageId | 347 * @param {!DOMStorageAgent.StorageId} storageId |
| 348 * @param {string} key | 348 * @param {string} key |
| 349 * @param {string} oldValue | 349 * @param {string} oldValue |
| 350 * @param {string} value | 350 * @param {string} value |
| 351 */ | 351 */ |
| 352 domStorageItemUpdated: function(storageId, key, oldValue, value) | 352 domStorageItemUpdated: function(storageId, key, oldValue, value) |
| 353 { | 353 { |
| 354 this._model._domStorageItemUpdated(storageId, key, oldValue, value); | 354 this._model._domStorageItemUpdated(storageId, key, oldValue, value); |
| 355 }, | 355 }, |
| 356 } | 356 }; |
| 357 | 357 |
| 358 WebInspector.DOMStorageModel._symbol = Symbol("DomStorage"); | 358 WebInspector.DOMStorageModel._symbol = Symbol("DomStorage"); |
| 359 | 359 |
| 360 /** | 360 /** |
| 361 * @param {!WebInspector.Target} target | 361 * @param {!WebInspector.Target} target |
| 362 * @return {!WebInspector.DOMStorageModel} | 362 * @return {!WebInspector.DOMStorageModel} |
| 363 */ | 363 */ |
| 364 WebInspector.DOMStorageModel.fromTarget = function(target) | 364 WebInspector.DOMStorageModel.fromTarget = function(target) |
| 365 { | 365 { |
| 366 var model = /** @type {?WebInspector.DOMStorageModel} */ (target.model(WebIn
spector.DOMStorageModel)); | 366 var model = /** @type {?WebInspector.DOMStorageModel} */ (target.model(WebIn
spector.DOMStorageModel)); |
| 367 if (!model) { | 367 if (!model) { |
| 368 model = new WebInspector.DOMStorageModel(target, WebInspector.SecurityOr
iginManager.fromTarget(target)); | 368 model = new WebInspector.DOMStorageModel(target, WebInspector.SecurityOr
iginManager.fromTarget(target)); |
| 369 } | 369 } |
| 370 return model; | 370 return model; |
| 371 } | 371 }; |
| OLD | NEW |