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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/DatabaseModel.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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 * @constructor 136 * @constructor
137 * @extends {WebInspector.SDKModel} 137 * @extends {WebInspector.SDKModel}
138 * @param {!WebInspector.Target} target 138 * @param {!WebInspector.Target} target
139 */ 139 */
140 WebInspector.DatabaseModel = function(target) 140 WebInspector.DatabaseModel = function(target)
141 { 141 {
142 WebInspector.SDKModel.call(this, WebInspector.DatabaseModel, target); 142 WebInspector.SDKModel.call(this, WebInspector.DatabaseModel, target);
143 143
144 this._databases = []; 144 this._databases = [];
145 this._agent = target.databaseAgent(); 145 this._agent = target.databaseAgent();
146 this.target().registerDatabaseDispatcher(new WebInspector.DatabaseDispatcher (this));
146 } 147 }
147 148
148 WebInspector.DatabaseModel.Events = { 149 WebInspector.DatabaseModel.Events = {
149 DatabaseAdded: "DatabaseAdded" 150 DatabaseAdded: "DatabaseAdded",
151 DatabasesRemoved: "DatabasesRemoved"
150 } 152 }
151 153
152 WebInspector.DatabaseModel.prototype = { 154 WebInspector.DatabaseModel.prototype = {
153 enable: function() 155 enable: function()
154 { 156 {
155 if (this._enabled) 157 if (this._enabled)
156 return; 158 return;
157 this.target().registerDatabaseDispatcher(new WebInspector.DatabaseDispat cher(this));
158 this._agent.enable(); 159 this._agent.enable();
159 this._enabled = true; 160 this._enabled = true;
160 }, 161 },
161 162
163 disable: function()
164 {
165 if (!this._enabled)
166 return;
167 this._enabled = false;
168 this._databases = [];
169 this._agent.disable();
170 this.dispatchEventToListeners(WebInspector.DatabaseModel.Events.Database sRemoved);
171 },
172
162 /** 173 /**
163 * @return {!Array.<!WebInspector.Database>} 174 * @return {!Array.<!WebInspector.Database>}
164 */ 175 */
165 databases: function() 176 databases: function()
166 { 177 {
167 var result = []; 178 var result = [];
168 for (var database of this._databases) 179 for (var database of this._databases)
169 result.push(database); 180 result.push(database);
170 return result; 181 return result;
171 }, 182 },
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 * @param {!WebInspector.Target} target 224 * @param {!WebInspector.Target} target
214 * @return {!WebInspector.DatabaseModel} 225 * @return {!WebInspector.DatabaseModel}
215 */ 226 */
216 WebInspector.DatabaseModel.fromTarget = function(target) 227 WebInspector.DatabaseModel.fromTarget = function(target)
217 { 228 {
218 if (!target[WebInspector.DatabaseModel._symbol]) 229 if (!target[WebInspector.DatabaseModel._symbol])
219 target[WebInspector.DatabaseModel._symbol] = new WebInspector.DatabaseMo del(target); 230 target[WebInspector.DatabaseModel._symbol] = new WebInspector.DatabaseMo del(target);
220 231
221 return target[WebInspector.DatabaseModel._symbol]; 232 return target[WebInspector.DatabaseModel._symbol];
222 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698