Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 */ | 474 */ |
| 475 _resourceViewForResource: function(resource) | 475 _resourceViewForResource: function(resource) |
| 476 { | 476 { |
| 477 if (resource.hasTextContent()) { | 477 if (resource.hasTextContent()) { |
| 478 var treeElement = this._findTreeElementForResource(resource); | 478 var treeElement = this._findTreeElementForResource(resource); |
| 479 if (!treeElement) | 479 if (!treeElement) |
| 480 return null; | 480 return null; |
| 481 return treeElement.sourceView(); | 481 return treeElement.sourceView(); |
| 482 } | 482 } |
| 483 | 483 |
| 484 switch (resource.type) { | 484 switch (resource.resourceType()) { |
| 485 case WebInspector.resourceTypes.Image: | 485 case WebInspector.resourceTypes.Image: |
| 486 return new WebInspector.ImageView(resource.url, resource.mimeType, r esource); | 486 return new WebInspector.ImageView(resource.url, resource.mimeType, r esource); |
| 487 case WebInspector.resourceTypes.Font: | 487 case WebInspector.resourceTypes.Font: |
| 488 return new WebInspector.FontView(resource.url); | 488 return new WebInspector.FontView(resource.url); |
| 489 default: | 489 default: |
| 490 return new WebInspector.EmptyView(resource.url); | 490 return new WebInspector.EmptyView(resource.url); |
| 491 } | 491 } |
| 492 }, | 492 }, |
| 493 | 493 |
| 494 /** | 494 /** |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1078 { | 1078 { |
| 1079 if (hovered) { | 1079 if (hovered) { |
| 1080 this.listItemElement.classList.add("hovered"); | 1080 this.listItemElement.classList.add("hovered"); |
| 1081 DOMAgent.highlightFrame(this._frameId, WebInspector.Color.PageHighli ght.Content.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.to ProtocolRGBA()); | 1081 DOMAgent.highlightFrame(this._frameId, WebInspector.Color.PageHighli ght.Content.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.to ProtocolRGBA()); |
| 1082 } else { | 1082 } else { |
| 1083 this.listItemElement.classList.remove("hovered"); | 1083 this.listItemElement.classList.remove("hovered"); |
| 1084 DOMAgent.hideHighlight(); | 1084 DOMAgent.hideHighlight(); |
| 1085 } | 1085 } |
| 1086 }, | 1086 }, |
| 1087 | 1087 |
| 1088 /** | |
| 1089 * @param {!WebInspector.Resource} resource | |
| 1090 */ | |
| 1088 appendResource: function(resource) | 1091 appendResource: function(resource) |
| 1089 { | 1092 { |
| 1090 if (resource.isHidden()) | 1093 if (resource.isHidden()) |
| 1091 return; | 1094 return; |
| 1092 var categoryName = resource.type.name(); | 1095 var resourceType = resource.resourceType(); |
| 1093 var categoryElement = resource.type === WebInspector.resourceTypes.Docum ent ? this : this._categoryElements[categoryName]; | 1096 var categoryName = resourceType.name(); |
| 1097 var categoryElement = resourceType === WebInspector.resourceTypes.Docume nt ? this : this._categoryElements[categoryName]; | |
| 1094 if (!categoryElement) { | 1098 if (!categoryElement) { |
| 1095 categoryElement = new WebInspector.StorageCategoryTreeElement(this._ storagePanel, resource.type.categoryTitle(), categoryName, null, true); | 1099 categoryElement = new WebInspector.StorageCategoryTreeElement(this._ storagePanel, resource.resourceType().categoryTitle(), categoryName, null, true) ; |
| 1096 this._categoryElements[resource.type.name()] = categoryElement; | 1100 this._categoryElements[resourceType.name()] = categoryElement; |
| 1097 this._insertInPresentationOrder(this, categoryElement); | 1101 this._insertInPresentationOrder(this, categoryElement); |
| 1098 } | 1102 } |
| 1099 var resourceTreeElement = new WebInspector.FrameResourceTreeElement(this ._storagePanel, resource); | 1103 var resourceTreeElement = new WebInspector.FrameResourceTreeElement(this ._storagePanel, resource); |
| 1100 this._insertInPresentationOrder(categoryElement, resourceTreeElement); | 1104 this._insertInPresentationOrder(categoryElement, resourceTreeElement); |
| 1101 this._treeElementForResource[resource.url] = resourceTreeElement; | 1105 this._treeElementForResource[resource.url] = resourceTreeElement; |
| 1102 }, | 1106 }, |
| 1103 | 1107 |
| 1104 /** | 1108 /** |
| 1105 * @param {string} url | 1109 * @param {string} url |
| 1106 * @return {?WebInspector.Resource} | 1110 * @return {?WebInspector.Resource} |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1154 } | 1158 } |
| 1155 parentTreeElement.insertChild(childTreeElement, i); | 1159 parentTreeElement.insertChild(childTreeElement, i); |
| 1156 }, | 1160 }, |
| 1157 | 1161 |
| 1158 __proto__: WebInspector.BaseStorageTreeElement.prototype | 1162 __proto__: WebInspector.BaseStorageTreeElement.prototype |
| 1159 } | 1163 } |
| 1160 | 1164 |
| 1161 /** | 1165 /** |
| 1162 * @constructor | 1166 * @constructor |
| 1163 * @extends {WebInspector.BaseStorageTreeElement} | 1167 * @extends {WebInspector.BaseStorageTreeElement} |
| 1168 * @param {!WebInspector.ResourcesPanel} storagePanel | |
| 1169 * @param {!WebInspector.Resource} resource | |
| 1164 */ | 1170 */ |
| 1165 WebInspector.FrameResourceTreeElement = function(storagePanel, resource) | 1171 WebInspector.FrameResourceTreeElement = function(storagePanel, resource) |
| 1166 { | 1172 { |
| 1167 WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resou rce.displayName, ["resource-sidebar-tree-item", "resources-type-" + resource.typ e.name()]); | 1173 WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resou rce.displayName, ["resource-sidebar-tree-item", "resources-type-" + resource.res ourceType().name()]); |
| 1174 /** @type {!WebInspector.Resource} */ | |
| 1168 this._resource = resource; | 1175 this._resource = resource; |
| 1169 this._resource.addEventListener(WebInspector.Resource.Events.MessageAdded, t his._consoleMessageAdded, this); | 1176 this._resource.addEventListener(WebInspector.Resource.Events.MessageAdded, t his._consoleMessageAdded, this); |
| 1170 this._resource.addEventListener(WebInspector.Resource.Events.MessagesCleared , this._consoleMessagesCleared, this); | 1177 this._resource.addEventListener(WebInspector.Resource.Events.MessagesCleared , this._consoleMessagesCleared, this); |
| 1171 this.tooltip = resource.url; | 1178 this.tooltip = resource.url; |
| 1172 } | 1179 } |
| 1173 | 1180 |
| 1174 WebInspector.FrameResourceTreeElement.prototype = { | 1181 WebInspector.FrameResourceTreeElement.prototype = { |
| 1175 get itemURL() | 1182 get itemURL() |
| 1176 { | 1183 { |
| 1177 return this._resource.url; | 1184 return this._resource.url; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1198 return false; | 1205 return false; |
| 1199 }, | 1206 }, |
| 1200 | 1207 |
| 1201 /** | 1208 /** |
| 1202 * @override | 1209 * @override |
| 1203 */ | 1210 */ |
| 1204 onattach: function() | 1211 onattach: function() |
| 1205 { | 1212 { |
| 1206 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); | 1213 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); |
| 1207 | 1214 |
| 1208 if (this._resource.type === WebInspector.resourceTypes.Image) { | 1215 if (this._resource.resourceType() === WebInspector.resourceTypes.Image) { |
| 1209 var iconElement = createElementWithClass("div", "icon"); | 1216 var iconElement = createElementWithClass("div", "icon"); |
| 1210 var previewImage = iconElement.createChild("img", "image-resource-ic on-preview"); | 1217 var previewImage = iconElement.createChild("img", "image-resource-ic on-preview"); |
| 1211 this._resource.populateImageSource(previewImage); | 1218 this._resource.populateImageSource(previewImage); |
| 1212 this.listItemElement.replaceChild(iconElement, this.imageElement); | 1219 this.listItemElement.replaceChild(iconElement, this.imageElement); |
| 1213 } | 1220 } |
| 1214 | 1221 |
| 1215 this._statusElement = createElementWithClass("div", "status"); | 1222 this._statusElement = createElementWithClass("div", "status"); |
| 1216 this.listItemElement.insertBefore(this._statusElement, this.titleElement ); | 1223 this.listItemElement.insertBefore(this._statusElement, this.titleElement ); |
| 1217 | 1224 |
| 1218 this.listItemElement.draggable = true; | 1225 this.listItemElement.draggable = true; |
| 1219 this.listItemElement.addEventListener("dragstart", this._ondragstart.bin d(this), false); | 1226 this.listItemElement.addEventListener("dragstart", this._ondragstart.bin d(this), false); |
| 1220 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); | 1227 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); |
| 1221 | 1228 |
| 1222 this._updateErrorsAndWarningsBubbles(); | 1229 this._updateErrorsAndWarningsBubbles(); |
| 1223 }, | 1230 }, |
| 1224 | 1231 |
| 1225 /** | 1232 /** |
| 1226 * @param {!MouseEvent} event | 1233 * @param {!MouseEvent} event |
| 1227 * @return {boolean} | 1234 * @return {boolean} |
| 1228 */ | 1235 */ |
| 1229 _ondragstart: function(event) | 1236 _ondragstart: function(event) |
| 1230 { | 1237 { |
| 1231 event.dataTransfer.setData("text/plain", this._resource.content); | 1238 event.dataTransfer.setData("text/plain", this._resource.content || ""); |
| 1232 event.dataTransfer.effectAllowed = "copy"; | 1239 event.dataTransfer.effectAllowed = "copy"; |
| 1233 return true; | 1240 return true; |
| 1234 }, | 1241 }, |
| 1235 | 1242 |
| 1236 _handleContextMenuEvent: function(event) | 1243 _handleContextMenuEvent: function(event) |
| 1237 { | 1244 { |
| 1238 var contextMenu = new WebInspector.ContextMenu(event); | 1245 var contextMenu = new WebInspector.ContextMenu(event); |
| 1239 contextMenu.appendApplicableItems(this._resource); | 1246 contextMenu.appendApplicableItems(this._resource); |
| 1240 contextMenu.show(); | 1247 contextMenu.show(); |
| 1241 }, | 1248 }, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1260 }, | 1267 }, |
| 1261 | 1268 |
| 1262 _updateErrorsAndWarningsBubbles: function() | 1269 _updateErrorsAndWarningsBubbles: function() |
| 1263 { | 1270 { |
| 1264 if (this._storagePanel.currentQuery) | 1271 if (this._storagePanel.currentQuery) |
| 1265 return; | 1272 return; |
| 1266 | 1273 |
| 1267 this._resetBubble(); | 1274 this._resetBubble(); |
| 1268 | 1275 |
| 1269 if (this._resource.warnings || this._resource.errors) | 1276 if (this._resource.warnings || this._resource.errors) |
| 1270 this._setBubbleText(this._resource.warnings + this._resource.errors) ; | 1277 this._setBubbleText((this._resource.warnings + this._resource.errors ) + ""); |
|
apavlov
2014/10/22 07:40:05
String(this._resource.warnings + this._resource.er
eustas
2014/10/22 08:23:00
Done. Thanks.
| |
| 1271 | 1278 |
| 1272 if (this._resource.warnings) | 1279 if (this._resource.warnings) |
| 1273 this._bubbleElement.classList.add("warning"); | 1280 this._bubbleElement.classList.add("warning"); |
| 1274 | 1281 |
| 1275 if (this._resource.errors) | 1282 if (this._resource.errors) |
| 1276 this._bubbleElement.classList.add("error"); | 1283 this._bubbleElement.classList.add("error"); |
| 1277 }, | 1284 }, |
| 1278 | 1285 |
| 1279 _consoleMessagesCleared: function() | 1286 _consoleMessagesCleared: function() |
| 1280 { | 1287 { |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2180 | 2187 |
| 2181 WebInspector.ResourcesPanelFactory.prototype = { | 2188 WebInspector.ResourcesPanelFactory.prototype = { |
| 2182 /** | 2189 /** |
| 2183 * @return {!WebInspector.Panel} | 2190 * @return {!WebInspector.Panel} |
| 2184 */ | 2191 */ |
| 2185 createPanel: function() | 2192 createPanel: function() |
| 2186 { | 2193 { |
| 2187 return WebInspector.ResourcesPanel._instance(); | 2194 return WebInspector.ResourcesPanel._instance(); |
| 2188 } | 2195 } |
| 2189 } | 2196 } |
| OLD | NEW |