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

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

Issue 2851913002: [DevTools] Do not expose agents on Target
Patch Set: storage and tests.js Created 3 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) 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DOMStorageItemAdded: Symbol('DOMStorageItemAdded'), 102 DOMStorageItemAdded: Symbol('DOMStorageItemAdded'),
103 DOMStorageItemUpdated: Symbol('DOMStorageItemUpdated') 103 DOMStorageItemUpdated: Symbol('DOMStorageItemUpdated')
104 }; 104 };
105 105
106 /** 106 /**
107 * @unrestricted 107 * @unrestricted
108 */ 108 */
109 Resources.DOMStorageModel = class extends SDK.SDKModel { 109 Resources.DOMStorageModel = class extends SDK.SDKModel {
110 /** 110 /**
111 * @param {!SDK.Target} target 111 * @param {!SDK.Target} target
112 * @param {!Protocol.Dispatcher} dispatcher
112 */ 113 */
113 constructor(target) { 114 constructor(target, dispatcher) {
114 super(target); 115 super(target, dispatcher);
115 116
116 this._securityOriginManager = target.model(SDK.SecurityOriginManager); 117 this._securityOriginManager = target.model(SDK.SecurityOriginManager);
117 /** @type {!Object.<string, !Resources.DOMStorage>} */ 118 /** @type {!Object.<string, !Resources.DOMStorage>} */
118 this._storages = {}; 119 this._storages = {};
119 this._agent = target.domstorageAgent(); 120 this._agent = dispatcher.domstorageAgent();
121 dispatcher.registerDOMStorageDispatcher(new Resources.DOMStorageDispatcher(t his));
120 } 122 }
121 123
122 enable() { 124 enable() {
123 if (this._enabled) 125 if (this._enabled)
124 return; 126 return;
125 127
126 this.target().registerDOMStorageDispatcher(new Resources.DOMStorageDispatche r(this));
127 this._securityOriginManager.addEventListener( 128 this._securityOriginManager.addEventListener(
128 SDK.SecurityOriginManager.Events.SecurityOriginAdded, this._securityOrig inAdded, this); 129 SDK.SecurityOriginManager.Events.SecurityOriginAdded, this._securityOrig inAdded, this);
129 this._securityOriginManager.addEventListener( 130 this._securityOriginManager.addEventListener(
130 SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this._securityOr iginRemoved, this); 131 SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this._securityOr iginRemoved, this);
131 132
132 for (var securityOrigin of this._securityOriginManager.securityOrigins()) 133 for (var securityOrigin of this._securityOriginManager.securityOrigins())
133 this._addOrigin(securityOrigin); 134 this._addOrigin(securityOrigin);
134 this._agent.enable(); 135 this._agent.enable();
135 136
136 this._enabled = true; 137 this._enabled = true;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 * @param {string} key 327 * @param {string} key
327 * @param {string} oldValue 328 * @param {string} oldValue
328 * @param {string} value 329 * @param {string} value
329 */ 330 */
330 domStorageItemUpdated(storageId, key, oldValue, value) { 331 domStorageItemUpdated(storageId, key, oldValue, value) {
331 this._model._domStorageItemUpdated(storageId, key, oldValue, value); 332 this._model._domStorageItemUpdated(storageId, key, oldValue, value);
332 } 333 }
333 }; 334 };
334 335
335 Resources.DOMStorageModel._symbol = Symbol('DomStorage'); 336 Resources.DOMStorageModel._symbol = Symbol('DomStorage');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698