| OLD | NEW | 
|    1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 /** |    5 /** | 
|    6  * @constructor |    6  * @constructor | 
|    7  * @extends {WebInspector.VBox} |    7  * @extends {WebInspector.VBox} | 
|    8  * @implements {WebInspector.TargetManager.Observer} |    8  * @implements {WebInspector.TargetManager.Observer} | 
|    9  */ |    9  */ | 
|   10 WebInspector.ServiceWorkersView = function() |   10 WebInspector.ServiceWorkersView = function() | 
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  406                 var scriptLastModifiedLabel = scriptURLDiv.createChild("label", 
     " service-workers-info service-worker-script-last-modified", "dt-icon-label"); |  406                 var scriptLastModifiedLabel = scriptURLDiv.createChild("label", 
     " service-workers-info service-worker-script-last-modified", "dt-icon-label"); | 
|  407                 scriptLastModifiedLabel.type = "info-icon"; |  407                 scriptLastModifiedLabel.type = "info-icon"; | 
|  408                 scriptLastModifiedLabel.createTextChild(WebInspector.UIString("L
     ast-Modified: %s", (new Date(version.scriptLastModified * 1000)).toConsoleTime()
     )); |  408                 scriptLastModifiedLabel.createTextChild(WebInspector.UIString("L
     ast-Modified: %s", (new Date(version.scriptLastModified * 1000)).toConsoleTime()
     )); | 
|  409             } |  409             } | 
|  410             if (version.scriptResponseTime) { |  410             if (version.scriptResponseTime) { | 
|  411                 var scriptResponseTimeDiv = scriptURLDiv.createChild("label", " 
     service-workers-info service-worker-script-response-time", "dt-icon-label"); |  411                 var scriptResponseTimeDiv = scriptURLDiv.createChild("label", " 
     service-workers-info service-worker-script-response-time", "dt-icon-label"); | 
|  412                 scriptResponseTimeDiv.type = "info-icon"; |  412                 scriptResponseTimeDiv.type = "info-icon"; | 
|  413                 scriptResponseTimeDiv.createTextChild(WebInspector.UIString("Ser
     ver response time: %s", (new Date(version.scriptResponseTime * 1000)).toConsoleT
     ime())); |  413                 scriptResponseTimeDiv.createTextChild(WebInspector.UIString("Ser
     ver response time: %s", (new Date(version.scriptResponseTime * 1000)).toConsoleT
     ime())); | 
|  414             } |  414             } | 
|  415  |  415  | 
 |  416             for (var i = 0; i < version.controlledClients.length; ++i) { | 
 |  417                 var client = version.controlledClients[i]; | 
 |  418                 var clientLabel = scriptURLDiv.createChild("label", "service-wor
     kers-info", "dt-icon-label"); | 
 |  419                 clientLabel.type = "info-icon"; | 
 |  420                 var clientLabelText = clientLabel.createChild("label", "service-
     worker-client"); | 
 |  421                 this._manager.getTargetInfo(client, this._updateClientInfo.bind(
     this, clientLabelText)); | 
 |  422             } | 
 |  423  | 
|  416             var errorMessages = version.errorMessages; |  424             var errorMessages = version.errorMessages; | 
|  417             for (var index = 0; index < errorMessages.length; ++index) { |  425             for (var index = 0; index < errorMessages.length; ++index) { | 
|  418                 var errorDiv = scriptURLDiv.createChild("div", "service-workers-
     error"); |  426                 var errorDiv = scriptURLDiv.createChild("div", "service-workers-
     error"); | 
|  419                 errorDiv.createChild("label", "", "dt-icon-label").type = "error
     -icon"; |  427                 errorDiv.createChild("label", "", "dt-icon-label").type = "error
     -icon"; | 
|  420                 errorDiv.createChild("div", "service-workers-error-message").cre
     ateTextChild(errorMessages[index].errorMessage); |  428                 errorDiv.createChild("div", "service-workers-error-message").cre
     ateTextChild(errorMessages[index].errorMessage); | 
|  421                 var script_path = errorMessages[index].sourceURL; |  429                 var script_path = errorMessages[index].sourceURL; | 
|  422                 var script_url; |  430                 var script_url; | 
|  423                 if (script_url = script_path.asParsedURL()) |  431                 if (script_url = script_path.asParsedURL()) | 
|  424                     script_path = script_url.displayName; |  432                     script_path = script_url.displayName; | 
|  425                 if (script_path.length && errorMessages[index].lineNumber != -1) |  433                 if (script_path.length && errorMessages[index].lineNumber != -1) | 
|  426                     script_path = String.sprintf("(%s:%d)", script_path, errorMe
     ssages[index].lineNumber); |  434                     script_path = String.sprintf("(%s:%d)", script_path, errorMe
     ssages[index].lineNumber); | 
|  427                 errorDiv.createChild("div", "service-workers-error-line").create
     TextChild(script_path); |  435                 errorDiv.createChild("div", "service-workers-error-line").create
     TextChild(script_path); | 
|  428             } |  436             } | 
|  429  |  437  | 
|  430         } |  438         } | 
|  431         if (!versions.length) { |  439         if (!versions.length) { | 
|  432             var stateRowElement = versionsElement.createChild("div", "service-wo
     rkers-version-row"); |  440             var stateRowElement = versionsElement.createChild("div", "service-wo
     rkers-version-row"); | 
|  433             stateRowElement.createChild("div", "service-workers-version-status")
     ; |  441             stateRowElement.createChild("div", "service-workers-version-status")
     ; | 
|  434             stateRowElement.createChild("div", "service-workers-version-running-
     status"); |  442             stateRowElement.createChild("div", "service-workers-version-running-
     status"); | 
|  435             stateRowElement.createChild("div", "service-workers-version-script-u
     rl"); |  443             stateRowElement.createChild("div", "service-workers-version-script-u
     rl"); | 
|  436         } |  444         } | 
|  437         return modeRowElement; |  445         return modeRowElement; | 
|  438     }, |  446     }, | 
|  439  |  447  | 
|  440     /** |  448     /** | 
 |  449      * @param {!Element} element | 
 |  450      * @param {?WebInspector.TargetInfo} targetInfo | 
 |  451      */ | 
 |  452     _updateClientInfo: function(element, targetInfo) | 
 |  453     { | 
 |  454         if (!targetInfo) | 
 |  455             return; | 
 |  456         element.createTextChild(WebInspector.UIString("Client: %s", targetInfo.u
     rl)); | 
 |  457         if (!(targetInfo.isWebContents() || targetInfo.isFrame())) | 
 |  458             return; | 
 |  459         var focusLabel = element.createChild("label", "service-worker-client-foc
     us"); | 
 |  460         focusLabel.createTextChild("focus"); | 
 |  461         focusLabel.addEventListener("click", this._activateTarget.bind(this, tar
     getInfo.id), true); | 
 |  462     }, | 
 |  463  | 
 |  464     /** | 
 |  465      * @param {string} targetId | 
 |  466      */ | 
 |  467     _activateTarget: function(targetId) | 
 |  468     { | 
 |  469         this._manager.activateTarget(targetId); | 
 |  470     }, | 
 |  471  | 
 |  472     /** | 
|  441      * @param {!Event} event |  473      * @param {!Event} event | 
|  442      */ |  474      */ | 
|  443     _deleteButtonClicked: function(event) |  475     _deleteButtonClicked: function(event) | 
|  444     { |  476     { | 
|  445         this._manager.deleteRegistration(this._registration.id); |  477         this._manager.deleteRegistration(this._registration.id); | 
|  446     }, |  478     }, | 
|  447  |  479  | 
|  448     /** |  480     /** | 
|  449      * @param {!Event} event |  481      * @param {!Event} event | 
|  450      */ |  482      */ | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  506     }, |  538     }, | 
|  507  |  539  | 
|  508     /** |  540     /** | 
|  509      * @return {boolean} |  541      * @return {boolean} | 
|  510      */ |  542      */ | 
|  511     _visible: function() |  543     _visible: function() | 
|  512     { |  544     { | 
|  513         return this._originElement._visible(); |  545         return this._originElement._visible(); | 
|  514     }, |  546     }, | 
|  515 } |  547 } | 
| OLD | NEW |