Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: Source/devtools/front_end/NetworkManager.js

Issue 185463010: DevTools: Introduce Target class which holds connection & models (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@gr-RuntimeAgent
Patch Set: Address aandrey's comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @extends {WebInspector.Object} 33 * @extends {WebInspector.Object}
34 * @param {!WebInspector.Target} target
34 */ 35 */
35 WebInspector.NetworkManager = function() 36 WebInspector.NetworkManager = function(target)
36 { 37 {
37 WebInspector.Object.call(this); 38 WebInspector.Object.call(this);
38 this._agent = NetworkAgent; 39 this._agent = target.agent("Network");
39 this._dispatcher = new WebInspector.NetworkDispatcher(this); 40 this._dispatcher = new WebInspector.NetworkDispatcher(this, target.consoleMo del);
41 target.registerDispatcher("Network", this._dispatcher);
40 if (WebInspector.settings.cacheDisabled.get()) 42 if (WebInspector.settings.cacheDisabled.get())
41 this._agent.setCacheDisabled(true); 43 this._agent.setCacheDisabled(true);
42 44
43 this._agent.enable(); 45 this._agent.enable();
44 46
45 WebInspector.settings.cacheDisabled.addChangeListener(this._cacheDisabledSet tingChanged, this); 47 WebInspector.settings.cacheDisabled.addChangeListener(this._cacheDisabledSet tingChanged, this);
46 } 48 }
47 49
48 WebInspector.NetworkManager.EventTypes = { 50 WebInspector.NetworkManager.EventTypes = {
49 RequestStarted: "RequestStarted", 51 RequestStarted: "RequestStarted",
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 this._agent.replayXHR(requestId); 125 this._agent.replayXHR(requestId);
124 }, 126 },
125 127
126 __proto__: WebInspector.Object.prototype 128 __proto__: WebInspector.Object.prototype
127 } 129 }
128 130
129 /** 131 /**
130 * @constructor 132 * @constructor
131 * @implements {NetworkAgent.Dispatcher} 133 * @implements {NetworkAgent.Dispatcher}
132 */ 134 */
133 WebInspector.NetworkDispatcher = function(manager) 135 WebInspector.NetworkDispatcher = function(manager, consoleModel)
134 { 136 {
135 this._manager = manager; 137 this._manager = manager;
136 this.consoleModel = WebInspector.console; 138 this.consoleModel = consoleModel;
137 this._inflightRequestsById = {}; 139 this._inflightRequestsById = {};
138 this._inflightRequestsByURL = {}; 140 this._inflightRequestsByURL = {};
139 InspectorBackend.registerNetworkDispatcher(this);
140 } 141 }
141 142
142 WebInspector.NetworkDispatcher.prototype = { 143 WebInspector.NetworkDispatcher.prototype = {
143 /** 144 /**
144 * @param {!NetworkAgent.Headers} headersMap 145 * @param {!NetworkAgent.Headers} headersMap
145 * @return {!Array.<!WebInspector.NetworkRequest.NameValue>} 146 * @return {!Array.<!WebInspector.NetworkRequest.NameValue>}
146 */ 147 */
147 _headersMapToHeadersArray: function(headersMap) 148 _headersMapToHeadersArray: function(headersMap)
148 { 149 {
149 var result = []; 150 var result = [];
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 var networkRequest = new WebInspector.NetworkRequest(requestId, url, doc umentURL, frameId, loaderId); 574 var networkRequest = new WebInspector.NetworkRequest(requestId, url, doc umentURL, frameId, loaderId);
574 networkRequest.initiator = initiator; 575 networkRequest.initiator = initiator;
575 return networkRequest; 576 return networkRequest;
576 } 577 }
577 } 578 }
578 579
579 /** 580 /**
580 * @type {!WebInspector.NetworkManager} 581 * @type {!WebInspector.NetworkManager}
581 */ 582 */
582 WebInspector.networkManager; 583 WebInspector.networkManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698