| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.View} | 7 * @extends {WebInspector.Widget} |
| 8 * @param {!Document} parsedXML | 8 * @param {!Document} parsedXML |
| 9 */ | 9 */ |
| 10 WebInspector.XMLView = function(parsedXML) | 10 WebInspector.XMLView = function(parsedXML) |
| 11 { | 11 { |
| 12 WebInspector.View.call(this, true); | 12 WebInspector.Widget.call(this, true); |
| 13 this.registerRequiredCSS("network/xmlView.css"); | 13 this.registerRequiredCSS("network/xmlView.css"); |
| 14 this.contentElement.classList.add("shadow-xml-view", "source-code"); | 14 this.contentElement.classList.add("shadow-xml-view", "source-code"); |
| 15 var treeOutline = new TreeOutline(); | 15 var treeOutline = new TreeOutline(); |
| 16 this.contentElement.appendChild(treeOutline.element); | 16 this.contentElement.appendChild(treeOutline.element); |
| 17 WebInspector.XMLView.Node.populate(treeOutline, parsedXML); | 17 WebInspector.XMLView.Node.populate(treeOutline, parsedXML); |
| 18 } | 18 } |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * @param {string} text | 21 * @param {string} text |
| 22 * @param {string} mimeType | 22 * @param {string} mimeType |
| 23 * @return {?Document} | 23 * @return {?Document} |
| 24 */ | 24 */ |
| 25 WebInspector.XMLView.parseXML = function(text, mimeType) | 25 WebInspector.XMLView.parseXML = function(text, mimeType) |
| 26 { | 26 { |
| 27 var parsedXML; | 27 var parsedXML; |
| 28 try { | 28 try { |
| 29 parsedXML = (new DOMParser()).parseFromString(text, mimeType); | 29 parsedXML = (new DOMParser()).parseFromString(text, mimeType); |
| 30 } catch (e) { | 30 } catch (e) { |
| 31 return null; | 31 return null; |
| 32 } | 32 } |
| 33 if (parsedXML.body) | 33 if (parsedXML.body) |
| 34 return null; | 34 return null; |
| 35 return parsedXML; | 35 return parsedXML; |
| 36 } | 36 } |
| 37 | 37 |
| 38 WebInspector.XMLView.prototype = { | 38 WebInspector.XMLView.prototype = { |
| 39 __proto__: WebInspector.View.prototype | 39 __proto__: WebInspector.Widget.prototype |
| 40 } | 40 } |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * @constructor | 43 * @constructor |
| 44 * @extends {TreeElement} | 44 * @extends {TreeElement} |
| 45 * @param {!Node} node | 45 * @param {!Node} node |
| 46 * @param {boolean} closeTag | 46 * @param {boolean} closeTag |
| 47 */ | 47 */ |
| 48 WebInspector.XMLView.Node = function(node, closeTag) | 48 WebInspector.XMLView.Node = function(node, closeTag) |
| 49 { | 49 { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 }, | 160 }, |
| 161 | 161 |
| 162 onpopulate: function() | 162 onpopulate: function() |
| 163 { | 163 { |
| 164 WebInspector.XMLView.Node.populate(this, this._node); | 164 WebInspector.XMLView.Node.populate(this, this._node); |
| 165 this.appendChild(new WebInspector.XMLView.Node(this._node, true)); | 165 this.appendChild(new WebInspector.XMLView.Node(this._node, true)); |
| 166 }, | 166 }, |
| 167 | 167 |
| 168 __proto__: TreeElement.prototype | 168 __proto__: TreeElement.prototype |
| 169 } | 169 } |
| OLD | NEW |