2 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * @extends {WebInspector.TabbedPane}
35 WebInspector.NetworkItemView = function(resource)
37 WebInspector.TabbedPane.call(this);
39 this.element.addStyleClass("network-item-view");
41 var headersView = new WebInspector.ResourceHeadersView(resource);
42 this.appendTab("headers", WebInspector.UIString("Headers"), headersView);
44 var responseView = new WebInspector.ResourceResponseView(resource);
45 var previewView = new WebInspector.ResourcePreviewView(resource, responseView);
47 this.appendTab("preview", WebInspector.UIString("Preview"), previewView);
48 this.appendTab("response", WebInspector.UIString("Response"), responseView);
50 if (Capabilities.showCookiesTab) {
51 this._cookiesView = new WebInspector.ResourceCookiesView(resource);
52 this.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView);
55 if (Capabilities.showTimingTab) {
56 var timingView = new WebInspector.ResourceTimingView(resource);
57 this.appendTab("timing", WebInspector.UIString("Timing"), timingView);
60 this.addEventListener("tab-selected", this._tabSelected, this);
63 WebInspector.NetworkItemView.prototype = {
66 WebInspector.TabbedPane.prototype.wasShown.call();
71 * @param {string=} tabId
73 _selectTab: function(tabId)
76 tabId = WebInspector.settings.resourceViewTab.get();
78 if (!this.selectTab(tabId)) {
79 this._isInFallbackSelection = true;
80 this.selectTab("headers");
81 delete this._isInFallbackSelection;
85 _tabSelected: function(event)
87 if (event.data.isUserGesture)
88 WebInspector.settings.resourceViewTab.set(event.data.tabId);
92 WebInspector.NetworkItemView.prototype.__proto__ = WebInspector.TabbedPane.prototype;
95 * @extends {WebInspector.ResourceView}
98 WebInspector.ResourceContentView = function(resource)
100 WebInspector.ResourceView.call(this, resource);
103 WebInspector.ResourceContentView.prototype = {
104 hasContent: function()
111 return this._innerView;
114 set innerView(innerView)
116 this._innerView = innerView;
121 this._ensureInnerViewShown();
124 _ensureInnerViewShown: function()
126 if (this._innerViewShowRequested)
128 this._innerViewShowRequested = true;
132 this._innerViewShowRequested = false;
133 this.contentLoaded();
136 this.resource.requestContent(callback.bind(this));
139 contentLoaded: function()
141 // Should be implemented by subclasses.
144 canHighlightLine: function()
146 return this._innerView && this._innerView.canHighlightLine();
149 highlightLine: function(line)
151 if (this.canHighlightLine())
152 this._innerView.highlightLine(line);
156 WebInspector.ResourceContentView.prototype.__proto__ = WebInspector.ResourceView.prototype;