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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/ServiceWorkerManager.js

Issue 2851913002: [DevTools] Do not expose agents on Target
Patch Set: storage and tests.js 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sdk/ServiceWorkerManager.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/ServiceWorkerManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/ServiceWorkerManager.js
index 4b0fc038d7b0be974e6663b4b50ea7fa838de29c..60a100d9cd1e52b8b82c027b15ab90f5ae07cb88 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/ServiceWorkerManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/ServiceWorkerManager.js
@@ -34,12 +34,14 @@
SDK.ServiceWorkerManager = class extends SDK.SDKModel {
/**
* @param {!SDK.Target} target
+ * @param {!Protocol.Dispatcher} dispatcher
*/
- constructor(target) {
- super(target);
- target.registerServiceWorkerDispatcher(new SDK.ServiceWorkerDispatcher(this));
+ constructor(target, dispatcher) {
+ super(target, dispatcher);
+ dispatcher.registerServiceWorkerDispatcher(new SDK.ServiceWorkerDispatcher(this));
this._lastAnonymousTargetId = 0;
- this._agent = target.serviceWorkerAgent();
+ this._agent = dispatcher.serviceWorkerAgent();
+ this._targetAgent = dispatcher.targetAgent();
/** @type {!Map.<string, !SDK.ServiceWorkerRegistration>} */
this._registrations = new Map();
this.enable();
@@ -174,6 +176,21 @@ SDK.ServiceWorkerManager = class extends SDK.SDKModel {
}
/**
+ * @param {string} controlledClient
+ * @return {!Promise<?Protocol.Target.TargetInfo>}
+ */
+ controlledClientInfo(controlledClient) {
+ return this._targetAgent.getTargetInfo(controlledClient, (error, targetInfo) => error ? null : targetInfo);
+ }
+
+ /**
+ * @param {string} controlledClient
+ */
+ activateControlledClient(controlledClient) {
+ this._targetAgent.activateTarget(controlledClient);
+ }
+
+ /**
* @param {!Array.<!Protocol.ServiceWorker.ServiceWorkerRegistration>} registrations
*/
_workerRegistrationUpdated(registrations) {

Powered by Google App Engine
This is Rietveld 408576698