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

Side by Side Diff: Source/devtools/front_end/sdk/ServiceWorkerManager.js

Issue 1164583002: [4/5 blink] Shows the clients which are controlled by ServiceWorker in DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated pfeldman's comment Created 5 years, 6 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 * * 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 deliverPushMessage: function(registrationId, data) 155 deliverPushMessage: function(registrationId, data)
156 { 156 {
157 var registration = this._registrations.get(registrationId); 157 var registration = this._registrations.get(registrationId);
158 if (!registration) 158 if (!registration)
159 return; 159 return;
160 var origin = WebInspector.ParsedURL.splitURLIntoPathComponents(registrat ion.scopeURL)[0]; 160 var origin = WebInspector.ParsedURL.splitURLIntoPathComponents(registrat ion.scopeURL)[0];
161 this._agent.deliverPushMessage(origin, registrationId, data); 161 this._agent.deliverPushMessage(origin, registrationId, data);
162 }, 162 },
163 163
164 /** 164 /**
165 * @param {!ServiceWorkerAgent.TargetID} targetId
166 */
167 activateTarget: function(targetId)
168 {
169 this._agent.activateTarget(targetId);
170 },
171
172 /**
165 * @param {string} scope 173 * @param {string} scope
166 */ 174 */
167 _unregister: function(scope) 175 _unregister: function(scope)
168 { 176 {
169 this._agent.unregister(scope); 177 this._agent.unregister(scope);
170 }, 178 },
171 179
172 /** 180 /**
173 * @param {string} scope 181 * @param {string} scope
174 */ 182 */
(...skipping 20 matching lines...) Expand all
195 203
196 /** 204 /**
197 * @param {string} versionId 205 * @param {string} versionId
198 */ 206 */
199 skipWaiting: function(versionId) 207 skipWaiting: function(versionId)
200 { 208 {
201 this._agent.skipWaiting(versionId); 209 this._agent.skipWaiting(versionId);
202 }, 210 },
203 211
204 /** 212 /**
213 * @param {!ServiceWorkerAgent.TargetID} targetId
214 * @param {function(?WebInspector.TargetInfo)=} callback
215 */
216 getTargetInfo: function(targetId, callback)
217 {
218 /**
219 * @param {?Protocol.Error} error
220 * @param {?ServiceWorkerAgent.TargetInfo} targetInfo
221 */
222 function innerCallback(error, targetInfo)
223 {
224 if (error) {
225 console.error(error);
226 callback(null);
227 return;
228 }
229 if (targetInfo)
230 callback(new WebInspector.TargetInfo(targetInfo));
231 else
232 callback(null)
233 }
234 this._agent.getTargetInfo(targetId, innerCallback);
235 },
236
237 /**
205 * @param {string} workerId 238 * @param {string} workerId
206 * @param {string} url 239 * @param {string} url
207 */ 240 */
208 _workerCreated: function(workerId, url) 241 _workerCreated: function(workerId, url)
209 { 242 {
210 new WebInspector.ServiceWorker(this, workerId, url); 243 new WebInspector.ServiceWorker(this, workerId, url);
211 }, 244 },
212 245
213 /** 246 /**
214 * @param {string} workerId 247 * @param {string} workerId
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 _close: function() 528 _close: function()
496 { 529 {
497 this.connectionClosed("worker_terminated"); 530 this.connectionClosed("worker_terminated");
498 }, 531 },
499 532
500 __proto__: InspectorBackendClass.Connection.prototype 533 __proto__: InspectorBackendClass.Connection.prototype
501 } 534 }
502 535
503 /** 536 /**
504 * @constructor 537 * @constructor
538 * @param {!ServiceWorkerAgent.TargetInfo} payload
539 */
540 WebInspector.TargetInfo = function(payload)
541 {
542 this.id = payload.id;
543 this.type = payload.type;
544 this.title = payload.title;
545 this.url = payload.url;
546 }
547
548 WebInspector.TargetInfo.prototype = {
549 /**
550 * @return {boolean}
551 */
552 isWebContents: function()
553 {
554 return this.type == "web_contents";
555 },
556 /**
557 * @return {boolean}
558 */
559 isFrame: function()
560 {
561 return this.type == "frame";
562 },
563 }
564
565 /**
566 * @constructor
505 * @param {!ServiceWorkerAgent.ServiceWorkerErrorMessage} payload 567 * @param {!ServiceWorkerAgent.ServiceWorkerErrorMessage} payload
506 */ 568 */
507 WebInspector.ServiceWorkerErrorMessage = function(payload) 569 WebInspector.ServiceWorkerErrorMessage = function(payload)
508 { 570 {
509 this.errorMessage = payload.errorMessage; 571 this.errorMessage = payload.errorMessage;
510 this.sourceURL = payload.sourceURL; 572 this.sourceURL = payload.sourceURL;
511 this.lineNumber = payload.lineNumber; 573 this.lineNumber = payload.lineNumber;
512 this.columnNumber = payload.columnNumber; 574 this.columnNumber = payload.columnNumber;
513 } 575 }
514 576
(...skipping 15 matching lines...) Expand all
530 * @param {!ServiceWorkerAgent.ServiceWorkerVersion} payload 592 * @param {!ServiceWorkerAgent.ServiceWorkerVersion} payload
531 */ 593 */
532 _update: function(payload) 594 _update: function(payload)
533 { 595 {
534 this.id = payload.versionId; 596 this.id = payload.versionId;
535 this.scriptURL = payload.scriptURL; 597 this.scriptURL = payload.scriptURL;
536 this.runningStatus = payload.runningStatus; 598 this.runningStatus = payload.runningStatus;
537 this.status = payload.status; 599 this.status = payload.status;
538 this.scriptLastModified = payload.scriptLastModified; 600 this.scriptLastModified = payload.scriptLastModified;
539 this.scriptResponseTime = payload.scriptResponseTime; 601 this.scriptResponseTime = payload.scriptResponseTime;
602 this.controlledClients = []
603 for (var i = 0; i < payload.controlledClients.length; ++i) {
604 this.controlledClients.push(payload.controlledClients[i]);
605 }
540 }, 606 },
541 607
542 /** 608 /**
543 * @return {boolean} 609 * @return {boolean}
544 */ 610 */
545 isStartable: function() 611 isStartable: function()
546 { 612 {
547 return !this._registration.isDeleted && this.isActivated() && this.isSto pped(); 613 return !this._registration.isDeleted && this.isActivated() && this.isSto pped();
548 }, 614 },
549 615
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 }, 784 },
719 785
720 /** 786 /**
721 * @return {boolean} 787 * @return {boolean}
722 */ 788 */
723 _shouldBeRemoved: function() 789 _shouldBeRemoved: function()
724 { 790 {
725 return this._isRedundant() && (!this._hasErrorLog() || this._deleting); 791 return this._isRedundant() && (!this._hasErrorLog() || this._deleting);
726 } 792 }
727 } 793 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/resources/serviceWorkersView.css ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698