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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/IndexedDBModel.js

Issue 2782773002: [DevTools] Remove SDKModels' fromTarget methods (Closed)
Patch Set: addressed review comments Created 3 years, 8 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 19 matching lines...) Expand all
30 30
31 /** 31 /**
32 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 Resources.IndexedDBModel = class extends SDK.SDKModel { 34 Resources.IndexedDBModel = class extends SDK.SDKModel {
35 /** 35 /**
36 * @param {!SDK.Target} target 36 * @param {!SDK.Target} target
37 */ 37 */
38 constructor(target) { 38 constructor(target) {
39 super(target); 39 super(target);
40 this._securityOriginManager = SDK.SecurityOriginManager.fromTarget(target); 40 this._securityOriginManager = target.model(SDK.SecurityOriginManager);
41 this._agent = target.indexedDBAgent(); 41 this._agent = target.indexedDBAgent();
42 42
43 /** @type {!Map.<!Resources.IndexedDBModel.DatabaseId, !Resources.IndexedDBM odel.Database>} */ 43 /** @type {!Map.<!Resources.IndexedDBModel.DatabaseId, !Resources.IndexedDBM odel.Database>} */
44 this._databases = new Map(); 44 this._databases = new Map();
45 /** @type {!Object.<string, !Array.<string>>} */ 45 /** @type {!Object.<string, !Array.<string>>} */
46 this._databaseNamesBySecurityOrigin = {}; 46 this._databaseNamesBySecurityOrigin = {};
47 } 47 }
48 48
49 /** 49 /**
50 * @param {*} idbKey 50 * @param {*} idbKey
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 * @return {?string} 131 * @return {?string}
132 */ 132 */
133 static keyPathStringFromIDBKeyPath(idbKeyPath) { 133 static keyPathStringFromIDBKeyPath(idbKeyPath) {
134 if (typeof idbKeyPath === 'string') 134 if (typeof idbKeyPath === 'string')
135 return '"' + idbKeyPath + '"'; 135 return '"' + idbKeyPath + '"';
136 if (idbKeyPath instanceof Array) 136 if (idbKeyPath instanceof Array)
137 return '["' + idbKeyPath.join('", "') + '"]'; 137 return '["' + idbKeyPath.join('", "') + '"]';
138 return null; 138 return null;
139 } 139 }
140 140
141 /**
142 * @param {!SDK.Target} target
143 * @return {!Resources.IndexedDBModel}
144 */
145 static fromTarget(target) {
146 return /** @type {!Resources.IndexedDBModel} */ (target.model(Resources.Inde xedDBModel));
147 }
148
149 enable() { 141 enable() {
150 if (this._enabled) 142 if (this._enabled)
151 return; 143 return;
152 144
153 this._agent.enable(); 145 this._agent.enable();
154 this._securityOriginManager.addEventListener( 146 this._securityOriginManager.addEventListener(
155 SDK.SecurityOriginManager.Events.SecurityOriginAdded, this._securityOrig inAdded, this); 147 SDK.SecurityOriginManager.Events.SecurityOriginAdded, this._securityOrig inAdded, this);
156 this._securityOriginManager.addEventListener( 148 this._securityOriginManager.addEventListener(
157 SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this._securityOr iginRemoved, this); 149 SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this._securityOr iginRemoved, this);
158 150
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 538 }
547 539
548 /** 540 /**
549 * @return {string} 541 * @return {string}
550 */ 542 */
551 get keyPathString() { 543 get keyPathString() {
552 return /** @type {string}*/ ( 544 return /** @type {string}*/ (
553 Resources.IndexedDBModel.keyPathStringFromIDBKeyPath(/** @type {string}* / (this.keyPath))); 545 Resources.IndexedDBModel.keyPathStringFromIDBKeyPath(/** @type {string}* / (this.keyPath)));
554 } 546 }
555 }; 547 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698