Hook up the initiator info and show it in the Resource details sidebar.
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / NetworkObserver.js
1 /*
2  * Copyright (C) 2013 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 WebInspector.NetworkObserver = function()
27 {
28     WebInspector.Object.call(this);
29 };
30
31 WebInspector.NetworkObserver.prototype = {
32     constructor: WebInspector.NetworkObserver,
33
34     // Events defined by the "Network" domain (see WebCore/inspector/Inspector.json).
35
36     requestWillBeSent: function(requestId, frameId, loaderId, documentURL, request, timestamp, initiator, redirectResponse, type)
37     {
38         WebInspector.frameResourceManager.resourceRequestWillBeSent(requestId, frameId, loaderId, request, type, redirectResponse, timestamp, initiator);
39     },
40
41     requestServedFromCache: function(requestId)
42     {
43         WebInspector.frameResourceManager.markResourceRequestAsServedFromMemoryCache(requestId);
44     },
45
46     responseReceived: function(requestId, frameId, loaderId, timestamp, type, response)
47     {
48         WebInspector.frameResourceManager.resourceRequestDidReceiveResponse(requestId, frameId, loaderId, type, response, timestamp);
49     },
50
51     dataReceived: function(requestId, timestamp, dataLength, encodedDataLength)
52     {
53         WebInspector.frameResourceManager.resourceRequestDidReceiveData(requestId, dataLength, encodedDataLength, timestamp);
54     },
55
56     loadingFinished: function(requestId, timestamp, sourceMapURL)
57     {
58         WebInspector.frameResourceManager.resourceRequestDidFinishLoading(requestId, timestamp, sourceMapURL);
59     },
60
61     loadingFailed: function(requestId, timestamp, errorText, canceled)
62     {
63         WebInspector.frameResourceManager.resourceRequestDidFailLoading(requestId, canceled, timestamp);
64     },
65
66     requestServedFromMemoryCache: function(requestId, frameId, loaderId, documentURL, timestamp, initiator, resource)
67     {
68         WebInspector.frameResourceManager.resourceRequestWasServedFromMemoryCache(requestId, frameId, loaderId, resource, timestamp, initiator);
69     },
70
71     webSocketWillSendHandshakeRequest: function(requestId, timestamp, request)
72     {
73         // FIXME: Not implemented.
74     },
75
76     webSocketHandshakeResponseReceived: function(requestId, timestamp, response)
77     {
78         // FIXME: Not implemented.
79     },
80
81     webSocketCreated: function(requestId, url)
82     {
83         // FIXME: Not implemented.
84     },
85
86     webSocketClosed: function(requestId, timestamp)
87     {
88         // FIXME: Not implemented.
89     }
90 };
91
92 WebInspector.NetworkObserver.prototype.__proto__ = WebInspector.Object.prototype;