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. | |
4 * | 3 * |
5 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
7 * are met: | 6 * are met: |
8 * | 7 * |
9 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
11 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
12 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
13 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 */ | 89 */ |
91 WebInspector.DOMStorageModel = function() | 90 WebInspector.DOMStorageModel = function() |
92 { | 91 { |
93 this._storages = {}; | 92 this._storages = {}; |
94 InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageDis
patcher(this)); | 93 InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageDis
patcher(this)); |
95 DOMStorageAgent.enable(); | 94 DOMStorageAgent.enable(); |
96 } | 95 } |
97 | 96 |
98 WebInspector.DOMStorageModel.Events = { | 97 WebInspector.DOMStorageModel.Events = { |
99 DOMStorageAdded: "DOMStorageAdded", | 98 DOMStorageAdded: "DOMStorageAdded", |
100 DOMStorageItemsCleared: "DOMStorageItemsCleared", | 99 DOMStorageUpdated: "DOMStorageUpdated" |
101 DOMStorageItemRemoved: "DOMStorageItemRemoved", | |
102 DOMStorageItemAdded: "DOMStorageItemAdded", | |
103 DOMStorageItemUpdated: "DOMStorageItemUpdated" | |
104 } | 100 } |
105 | 101 |
106 WebInspector.DOMStorageModel.prototype = { | 102 WebInspector.DOMStorageModel.prototype = { |
107 /** | 103 /** |
108 * @param {WebInspector.DOMStorage} domStorage | 104 * @param {WebInspector.DOMStorage} domStorage |
109 */ | 105 */ |
110 _addDOMStorage: function(domStorage) | 106 _addDOMStorage: function(domStorage) |
111 { | 107 { |
112 this._storages[domStorage.id] = domStorage; | 108 this._storages[domStorage.id] = domStorage; |
113 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageAdded, domStorage); | 109 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageAdded, domStorage); |
114 }, | 110 }, |
115 | 111 |
116 /** | 112 /** |
117 * @param {DOMStorageAgent.StorageId} storageId | 113 * @param {DOMStorageAgent.StorageId} storageId |
118 */ | 114 */ |
119 _domStorageItemsCleared: function(storageId) | 115 _domStorageUpdated: function(storageId) |
120 { | 116 { |
121 var domStorage = this._storages[storageId]; | 117 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageUpdated, this._storages[storageId]); |
122 var storageData = { | |
123 storage: domStorage | |
124 }; | |
125 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageItemsCleared, storageData); | |
126 }, | |
127 | |
128 /** | |
129 * @param {DOMStorageAgent.StorageId} storageId | |
130 * @param {string} key | |
131 */ | |
132 _domStorageItemRemoved: function(storageId, key) | |
133 { | |
134 var domStorage = this._storages[storageId]; | |
135 var storageData = { | |
136 storage: domStorage, | |
137 key: key | |
138 }; | |
139 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageItemRemoved, storageData); | |
140 }, | |
141 | |
142 /** | |
143 * @param {DOMStorageAgent.StorageId} storageId | |
144 * @param {string} key | |
145 * @param {string} newValue | |
146 */ | |
147 _domStorageItemAdded: function(storageId, key, newValue) | |
148 { | |
149 var domStorage = this._storages[storageId]; | |
150 var storageData = { | |
151 storage: domStorage, | |
152 key: key, | |
153 newValue: newValue | |
154 }; | |
155 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageItemAdded, storageData); | |
156 }, | |
157 | |
158 /** | |
159 * @param {DOMStorageAgent.StorageId} storageId | |
160 * @param {string} key | |
161 * @param {string} oldValue | |
162 * @param {string} newValue | |
163 */ | |
164 _domStorageItemUpdated: function(storageId, key, oldValue, newValue) | |
165 { | |
166 var domStorage = this._storages[storageId]; | |
167 var storageData = { | |
168 storage: domStorage, | |
169 key: key, | |
170 oldValue: oldValue, | |
171 newValue: newValue | |
172 }; | |
173 this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMSto
rageItemUpdated, storageData); | |
174 }, | 118 }, |
175 | 119 |
176 /** | 120 /** |
177 * @param {DOMStorageAgent.StorageId} storageId | 121 * @param {DOMStorageAgent.StorageId} storageId |
178 * @return {WebInspector.DOMStorage} | 122 * @return {WebInspector.DOMStorage} |
179 */ | 123 */ |
180 storageForId: function(storageId) | 124 storageForId: function(storageId) |
181 { | 125 { |
182 return this._storages[storageId]; | 126 return this._storages[storageId]; |
183 }, | 127 }, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 { | 159 { |
216 this._model._addDOMStorage(new WebInspector.DOMStorage( | 160 this._model._addDOMStorage(new WebInspector.DOMStorage( |
217 payload.id, | 161 payload.id, |
218 payload.origin, | 162 payload.origin, |
219 payload.isLocalStorage)); | 163 payload.isLocalStorage)); |
220 }, | 164 }, |
221 | 165 |
222 /** | 166 /** |
223 * @param {string} storageId | 167 * @param {string} storageId |
224 */ | 168 */ |
225 domStorageItemsCleared: function(storageId) | 169 domStorageUpdated: function(storageId) |
226 { | 170 { |
227 this._model._domStorageItemsCleared(storageId); | 171 this._model._domStorageUpdated(storageId); |
228 }, | 172 } |
229 | |
230 /** | |
231 * @param {string} storageId | |
232 * @param {string} key | |
233 */ | |
234 domStorageItemRemoved: function(storageId, key) | |
235 { | |
236 this._model._domStorageItemRemoved(storageId, key); | |
237 }, | |
238 | |
239 /** | |
240 * @param {string} storageId | |
241 * @param {string} key | |
242 * @param {string} newValue | |
243 */ | |
244 domStorageItemAdded: function(storageId, key, newValue) | |
245 { | |
246 this._model._domStorageItemAdded(storageId, key, newValue); | |
247 }, | |
248 | |
249 /** | |
250 * @param {string} storageId | |
251 * @param {string} key | |
252 * @param {string} oldValue | |
253 * @param {string} newValue | |
254 */ | |
255 domStorageItemUpdated: function(storageId, key, oldValue, newValue) | |
256 { | |
257 this._model._domStorageItemUpdated(storageId, key, oldValue, newValue); | |
258 }, | |
259 } | 173 } |
260 | 174 |
261 /** | 175 /** |
262 * @type {WebInspector.DOMStorageModel} | 176 * @type {WebInspector.DOMStorageModel} |
263 */ | 177 */ |
264 WebInspector.domStorageModel = null; | 178 WebInspector.domStorageModel = null; |
OLD | NEW |