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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/ApplicationCacheModel.js

Issue 1960663003: DevTools: introduce the Clear storage pane in the resources panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests fixed Created 4 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 10 matching lines...) Expand all
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 /** 29 /**
30 * @constructor 30 * @constructor
31 * @extends {WebInspector.SDKObject} 31 * @extends {WebInspector.SDKModel}
32 * @param {!WebInspector.Target} target 32 * @param {!WebInspector.Target} target
33 */ 33 */
34 WebInspector.ApplicationCacheModel = function(target) 34 WebInspector.ApplicationCacheModel = function(target)
35 { 35 {
36 WebInspector.SDKObject.call(this, target); 36 WebInspector.SDKModel.call(this, WebInspector.ApplicationCacheModel, target) ;
37 37
38 target.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheD ispatcher(this)); 38 target.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheD ispatcher(this));
39 this._agent = target.applicationCacheAgent(); 39 this._agent = target.applicationCacheAgent();
40 this._agent.enable(); 40 this._agent.enable();
41 41
42 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve ntTypes.FrameNavigated, this._frameNavigated, this); 42 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve ntTypes.FrameNavigated, this._frameNavigated, this);
43 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve ntTypes.FrameDetached, this._frameDetached, this); 43 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve ntTypes.FrameDetached, this._frameDetached, this);
44 44
45 this._statuses = {}; 45 this._statuses = {};
46 this._manifestURLsByFrame = {}; 46 this._manifestURLsByFrame = {};
47 47
48 this._mainFrameNavigated(); 48 this._mainFrameNavigated();
49
50 this._onLine = true; 49 this._onLine = true;
51 } 50 }
52 51
53 WebInspector.ApplicationCacheModel.EventTypes = { 52 WebInspector.ApplicationCacheModel.EventTypes = {
54 FrameManifestStatusUpdated: "FrameManifestStatusUpdated", 53 FrameManifestStatusUpdated: "FrameManifestStatusUpdated",
55 FrameManifestAdded: "FrameManifestAdded", 54 FrameManifestAdded: "FrameManifestAdded",
56 FrameManifestRemoved: "FrameManifestRemoved", 55 FrameManifestRemoved: "FrameManifestRemoved",
56 FrameManifestsReset: "FrameManifestsReset",
57 NetworkStateChanged: "NetworkStateChanged" 57 NetworkStateChanged: "NetworkStateChanged"
58 } 58 }
59 59
60 WebInspector.ApplicationCacheModel.prototype = { 60 WebInspector.ApplicationCacheModel.prototype = {
61 _frameNavigated: function(event) 61 _frameNavigated: function(event)
62 { 62 {
63 var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data); 63 var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data);
64 if (frame.isMainFrame()) { 64 if (frame.isMainFrame()) {
65 this._mainFrameNavigated(); 65 this._mainFrameNavigated();
66 return; 66 return;
67 } 67 }
68 68
69 this._agent.getManifestForFrame(frame.id, this._manifestForFrameLoaded.b ind(this, frame.id)); 69 this._agent.getManifestForFrame(frame.id, this._manifestForFrameLoaded.b ind(this, frame.id));
70 }, 70 },
71 71
72 /** 72 /**
73 * @param {!WebInspector.Event} event 73 * @param {!WebInspector.Event} event
74 */ 74 */
75 _frameDetached: function(event) 75 _frameDetached: function(event)
76 { 76 {
77 var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data); 77 var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data);
78 this._frameManifestRemoved(frame.id); 78 this._frameManifestRemoved(frame.id);
79 }, 79 },
80 80
81 reset: function()
82 {
83 this._statuses = {};
84 this._manifestURLsByFrame = {};
85 this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTy pes.FrameManifestsReset);
86 },
87
81 _mainFrameNavigated: function() 88 _mainFrameNavigated: function()
82 { 89 {
83 this._agent.getFramesWithManifests(this._framesWithManifestsLoaded.bind( this)); 90 this._agent.getFramesWithManifests(this._framesWithManifestsLoaded.bind( this));
84 }, 91 },
85 92
86 /** 93 /**
87 * @param {string} frameId 94 * @param {string} frameId
88 * @param {?Protocol.Error} error 95 * @param {?Protocol.Error} error
89 * @param {string} manifestURL 96 * @param {string} manifestURL
90 */ 97 */
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 227
221 /** 228 /**
222 * @param {boolean} isNowOnline 229 * @param {boolean} isNowOnline
223 */ 230 */
224 _networkStateUpdated: function(isNowOnline) 231 _networkStateUpdated: function(isNowOnline)
225 { 232 {
226 this._onLine = isNowOnline; 233 this._onLine = isNowOnline;
227 this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTy pes.NetworkStateChanged, isNowOnline); 234 this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTy pes.NetworkStateChanged, isNowOnline);
228 }, 235 },
229 236
230 __proto__: WebInspector.SDKObject.prototype 237 __proto__: WebInspector.SDKModel.prototype
231 } 238 }
232 239
233 /** 240 /**
234 * @constructor 241 * @constructor
235 * @implements {ApplicationCacheAgent.Dispatcher} 242 * @implements {ApplicationCacheAgent.Dispatcher}
236 */ 243 */
237 WebInspector.ApplicationCacheDispatcher = function(applicationCacheModel) 244 WebInspector.ApplicationCacheDispatcher = function(applicationCacheModel)
238 { 245 {
239 this._applicationCacheModel = applicationCacheModel; 246 this._applicationCacheModel = applicationCacheModel;
240 } 247 }
(...skipping 12 matching lines...) Expand all
253 260
254 /** 261 /**
255 * @override 262 * @override
256 * @param {boolean} isNowOnline 263 * @param {boolean} isNowOnline
257 */ 264 */
258 networkStateUpdated: function(isNowOnline) 265 networkStateUpdated: function(isNowOnline)
259 { 266 {
260 this._applicationCacheModel._networkStateUpdated(isNowOnline); 267 this._applicationCacheModel._networkStateUpdated(isNowOnline);
261 } 268 }
262 } 269 }
270
271 /**
272 * @param {!WebInspector.Target} target
273 * @return {?WebInspector.ApplicationCacheModel}
274 */
275 WebInspector.ApplicationCacheModel.fromTarget = function(target)
276 {
277 return /** @type {?WebInspector.ApplicationCacheModel} */ (target.model(WebI nspector.ApplicationCacheModel));
278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698