| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 this._model = model; | 34 this._model = model; |
| 35 | 35 |
| 36 this.element.addStyleClass("storage-view"); | 36 this.element.addStyleClass("storage-view"); |
| 37 this.element.addStyleClass("table"); | 37 this.element.addStyleClass("table"); |
| 38 | 38 |
| 39 // FIXME: Needs better tooltip. (Localized) | 39 // FIXME: Needs better tooltip. (Localized) |
| 40 this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("
Delete"), "delete-storage-status-bar-item"); | 40 this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("
Delete"), "delete-storage-status-bar-item"); |
| 41 this.deleteButton.visible = false; | 41 this.deleteButton.visible = false; |
| 42 this.deleteButton.addEventListener("click", this._deleteButtonClicked, this)
; | 42 this.deleteButton.addEventListener("click", this._deleteButtonClicked, this)
; |
| 43 | 43 |
| 44 this.connectivityIcon = document.createElement("img"); | 44 this.connectivityIcon = document.createElement("div"); |
| 45 this.connectivityIcon.className = "storage-application-cache-connectivity-ic
on"; | |
| 46 this.connectivityIcon.src = ""; | |
| 47 this.connectivityMessage = document.createElement("span"); | 45 this.connectivityMessage = document.createElement("span"); |
| 48 this.connectivityMessage.className = "storage-application-cache-connectivity
"; | 46 this.connectivityMessage.className = "storage-application-cache-connectivity
"; |
| 49 this.connectivityMessage.textContent = ""; | 47 this.connectivityMessage.textContent = ""; |
| 50 | 48 |
| 51 this.divider = document.createElement("span"); | 49 this.divider = document.createElement("span"); |
| 52 this.divider.className = "status-bar-item status-bar-divider"; | 50 this.divider.className = "status-bar-item status-bar-divider"; |
| 53 | 51 |
| 54 this.statusIcon = document.createElement("img"); | 52 this.statusIcon = document.createElement("div"); |
| 55 this.statusIcon.className = "storage-application-cache-status-icon"; | |
| 56 this.statusIcon.src = ""; | |
| 57 this.statusMessage = document.createElement("span"); | 53 this.statusMessage = document.createElement("span"); |
| 58 this.statusMessage.className = "storage-application-cache-status"; | 54 this.statusMessage.className = "storage-application-cache-status"; |
| 59 this.statusMessage.textContent = ""; | 55 this.statusMessage.textContent = ""; |
| 60 | 56 |
| 61 this._frameId = frameId; | 57 this._frameId = frameId; |
| 62 | 58 |
| 63 this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("No Appli
cation Cache information available.")); | 59 this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("No Appli
cation Cache information available.")); |
| 64 this._emptyView.show(this.element); | 60 this._emptyView.show(this.element); |
| 65 | 61 |
| 66 this._markDirty(); | 62 this._markDirty(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 /** | 108 /** |
| 113 * @param {number} status | 109 * @param {number} status |
| 114 */ | 110 */ |
| 115 updateStatus: function(status) | 111 updateStatus: function(status) |
| 116 { | 112 { |
| 117 var oldStatus = this._status; | 113 var oldStatus = this._status; |
| 118 this._status = status; | 114 this._status = status; |
| 119 | 115 |
| 120 var statusInformation = {}; | 116 var statusInformation = {}; |
| 121 // We should never have UNCACHED status, since we remove frames with UNC
ACHED application cache status from the tree. | 117 // We should never have UNCACHED status, since we remove frames with UNC
ACHED application cache status from the tree. |
| 122 statusInformation[applicationCache.UNCACHED] = { src: "Images/errorRe
dDot.png", text: "UNCACHED" }; | 118 statusInformation[applicationCache.UNCACHED] = { className: "red-ball
", text: "UNCACHED" }; |
| 123 statusInformation[applicationCache.IDLE] = { src: "Images/success
GreenDot.png", text: "IDLE" }; | 119 statusInformation[applicationCache.IDLE] = { className: "green-ba
ll", text: "IDLE" }; |
| 124 statusInformation[applicationCache.CHECKING] = { src: "Images/warning
OrangeDot.png", text: "CHECKING" }; | 120 statusInformation[applicationCache.CHECKING] = { className: "orange-b
all", text: "CHECKING" }; |
| 125 statusInformation[applicationCache.DOWNLOADING] = { src: "Images/warning
OrangeDot.png", text: "DOWNLOADING" }; | 121 statusInformation[applicationCache.DOWNLOADING] = { className: "orange-b
all", text: "DOWNLOADING" }; |
| 126 statusInformation[applicationCache.UPDATEREADY] = { src: "Images/success
GreenDot.png", text: "UPDATEREADY" }; | 122 statusInformation[applicationCache.UPDATEREADY] = { className: "green-ba
ll", text: "UPDATEREADY" }; |
| 127 statusInformation[applicationCache.OBSOLETE] = { src: "Images/errorRe
dDot.png", text: "OBSOLETE" }; | 123 statusInformation[applicationCache.OBSOLETE] = { className: "red-ball
", text: "OBSOLETE" }; |
| 128 | 124 |
| 129 var info = statusInformation[status] || statusInformation[applicationCac
he.UNCACHED]; | 125 var info = statusInformation[status] || statusInformation[applicationCac
he.UNCACHED]; |
| 130 | 126 |
| 131 this.statusIcon.src = info.src; | 127 this.statusIcon.className = "storage-application-cache-status-icon " + i
nfo.className; |
| 132 this.statusMessage.textContent = info.text; | 128 this.statusMessage.textContent = info.text; |
| 133 | 129 |
| 134 if (this.isShowing() && this._status === applicationCache.IDLE && (oldSt
atus === applicationCache.UPDATEREADY || !this._resources)) | 130 if (this.isShowing() && this._status === applicationCache.IDLE && (oldSt
atus === applicationCache.UPDATEREADY || !this._resources)) |
| 135 this._markDirty(); | 131 this._markDirty(); |
| 136 this._maybeUpdate(); | 132 this._maybeUpdate(); |
| 137 }, | 133 }, |
| 138 | 134 |
| 139 /** | 135 /** |
| 140 * @param {boolean} isNowOnline | 136 * @param {boolean} isNowOnline |
| 141 */ | 137 */ |
| 142 updateNetworkState: function(isNowOnline) | 138 updateNetworkState: function(isNowOnline) |
| 143 { | 139 { |
| 144 if (isNowOnline) { | 140 if (isNowOnline) { |
| 145 this.connectivityIcon.src = "Images/successGreenDot.png"; | 141 this.connectivityIcon.className = "storage-application-cache-connect
ivity-icon green-ball"; |
| 146 this.connectivityMessage.textContent = WebInspector.UIString("Online
"); | 142 this.connectivityMessage.textContent = WebInspector.UIString("Online
"); |
| 147 } else { | 143 } else { |
| 148 this.connectivityIcon.src = "Images/errorRedDot.png"; | 144 this.connectivityIcon.className = "storage-application-cache-connect
ivity-icon red-ball"; |
| 149 this.connectivityMessage.textContent = WebInspector.UIString("Offlin
e"); | 145 this.connectivityMessage.textContent = WebInspector.UIString("Offlin
e"); |
| 150 } | 146 } |
| 151 }, | 147 }, |
| 152 | 148 |
| 153 _update: function() | 149 _update: function() |
| 154 { | 150 { |
| 155 this._model.requestApplicationCache(this._frameId, this._updateCallback.
bind(this)); | 151 this._model.requestApplicationCache(this._frameId, this._updateCallback.
bind(this)); |
| 156 }, | 152 }, |
| 157 | 153 |
| 158 /** | 154 /** |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 _deleteCallback: function(node) | 260 _deleteCallback: function(node) |
| 265 { | 261 { |
| 266 // FIXME: Should we delete a single (selected) resource or all resources
? | 262 // FIXME: Should we delete a single (selected) resource or all resources
? |
| 267 // InspectorBackend.deleteCachedResource(...) | 263 // InspectorBackend.deleteCachedResource(...) |
| 268 // this._update(); | 264 // this._update(); |
| 269 }, | 265 }, |
| 270 | 266 |
| 271 __proto__: WebInspector.View.prototype | 267 __proto__: WebInspector.View.prototype |
| 272 } | 268 } |
| 273 | 269 |
| OLD | NEW |