OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * @constructor | 8 * @constructor |
9 * @extends {Protocol.Agents} | 9 * @extends {Protocol.Agents} |
10 * @param {!WebInspector.TargetManager} targetManager | 10 * @param {!WebInspector.TargetManager} targetManager |
11 * @param {string} name | 11 * @param {string} name |
12 * @param {number} capabilitiesMask | 12 * @param {number} capabilitiesMask |
13 * @param {!InspectorBackendClass.Connection} connection | 13 * @param {!InspectorBackendClass.Connection} connection |
14 * @param {?WebInspector.Target} parentTarget | 14 * @param {?WebInspector.Target} parentTarget |
15 */ | 15 */ |
16 WebInspector.Target = function(targetManager, name, capabilitiesMask, connection
, parentTarget) | 16 WebInspector.Target = function(targetManager, name, capabilitiesMask, connection
, parentTarget) |
17 { | 17 { |
18 Protocol.Agents.call(this, connection.agentsMap()); | 18 Protocol.Agents.call(this, connection.agentsMap()); |
19 this._targetManager = targetManager; | 19 this._targetManager = targetManager; |
20 this._name = name; | 20 this._name = name; |
21 this._inspectedURL = ""; | 21 this._inspectedURL = ""; |
22 this._capabilitiesMask = capabilitiesMask; | 22 this._capabilitiesMask = capabilitiesMask; |
23 this._connection = connection; | 23 this._connection = connection; |
24 this._parentTarget = parentTarget; | 24 this._parentTarget = parentTarget; |
25 connection.addEventListener(InspectorBackendClass.Connection.Events.Disconne
cted, this.dispose, this); | 25 connection.addEventListener(InspectorBackendClass.Connection.Events.Disconne
cted, this.dispose, this); |
26 this._id = WebInspector.Target._nextId++; | 26 this._id = WebInspector.Target._nextId++; |
27 | 27 |
28 /** @type {!Map.<!Function, !WebInspector.SDKModel>} */ | 28 /** @type {!Map.<!Function, !WebInspector.SDKModel>} */ |
29 this._modelByConstructor = new Map(); | 29 this._modelByConstructor = new Map(); |
30 } | 30 }; |
31 | 31 |
32 /** | 32 /** |
33 * @enum {number} | 33 * @enum {number} |
34 */ | 34 */ |
35 WebInspector.Target.Capability = { | 35 WebInspector.Target.Capability = { |
36 Browser: 1, | 36 Browser: 1, |
37 DOM: 2, | 37 DOM: 2, |
38 JS: 4, | 38 JS: 4, |
39 Log: 8, | 39 Log: 8, |
40 Network: 16, | 40 Network: 16, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 var parsedURL = inspectedURL.asParsedURL(); | 225 var parsedURL = inspectedURL.asParsedURL(); |
226 this._inspectedURLName = parsedURL ? parsedURL.lastPathComponentWithFrag
ment() : "#" + this._id; | 226 this._inspectedURLName = parsedURL ? parsedURL.lastPathComponentWithFrag
ment() : "#" + this._id; |
227 if (!this.parentTarget()) | 227 if (!this.parentTarget()) |
228 InspectorFrontendHost.inspectedURLChanged(inspectedURL || ""); | 228 InspectorFrontendHost.inspectedURLChanged(inspectedURL || ""); |
229 this._targetManager.dispatchEventToListeners(WebInspector.TargetManager.
Events.InspectedURLChanged, this); | 229 this._targetManager.dispatchEventToListeners(WebInspector.TargetManager.
Events.InspectedURLChanged, this); |
230 if (!this._name) | 230 if (!this._name) |
231 this._targetManager.dispatchEventToListeners(WebInspector.TargetMana
ger.Events.NameChanged, this); | 231 this._targetManager.dispatchEventToListeners(WebInspector.TargetMana
ger.Events.NameChanged, this); |
232 }, | 232 }, |
233 | 233 |
234 __proto__: Protocol.Agents.prototype | 234 __proto__: Protocol.Agents.prototype |
235 } | 235 }; |
236 | 236 |
237 /** | 237 /** |
238 * @constructor | 238 * @constructor |
239 * @extends {WebInspector.Object} | 239 * @extends {WebInspector.Object} |
240 * @param {!WebInspector.Target} target | 240 * @param {!WebInspector.Target} target |
241 */ | 241 */ |
242 WebInspector.SDKObject = function(target) | 242 WebInspector.SDKObject = function(target) |
243 { | 243 { |
244 WebInspector.Object.call(this); | 244 WebInspector.Object.call(this); |
245 this._target = target; | 245 this._target = target; |
246 } | 246 }; |
247 | 247 |
248 WebInspector.SDKObject.prototype = { | 248 WebInspector.SDKObject.prototype = { |
249 /** | 249 /** |
250 * @return {!WebInspector.Target} | 250 * @return {!WebInspector.Target} |
251 */ | 251 */ |
252 target: function() | 252 target: function() |
253 { | 253 { |
254 return this._target; | 254 return this._target; |
255 }, | 255 }, |
256 | 256 |
257 __proto__: WebInspector.Object.prototype | 257 __proto__: WebInspector.Object.prototype |
258 } | 258 }; |
259 | 259 |
260 /** | 260 /** |
261 * @constructor | 261 * @constructor |
262 * @extends {WebInspector.SDKObject} | 262 * @extends {WebInspector.SDKObject} |
263 * @param {!Function} modelClass | 263 * @param {!Function} modelClass |
264 * @param {!WebInspector.Target} target | 264 * @param {!WebInspector.Target} target |
265 */ | 265 */ |
266 WebInspector.SDKModel = function(modelClass, target) | 266 WebInspector.SDKModel = function(modelClass, target) |
267 { | 267 { |
268 WebInspector.SDKObject.call(this, target); | 268 WebInspector.SDKObject.call(this, target); |
269 target._modelByConstructor.set(modelClass, this); | 269 target._modelByConstructor.set(modelClass, this); |
270 } | 270 }; |
271 | 271 |
272 WebInspector.SDKModel.prototype = { | 272 WebInspector.SDKModel.prototype = { |
273 /** | 273 /** |
274 * @return {!Promise} | 274 * @return {!Promise} |
275 */ | 275 */ |
276 suspendModel: function() | 276 suspendModel: function() |
277 { | 277 { |
278 return Promise.resolve(); | 278 return Promise.resolve(); |
279 }, | 279 }, |
280 | 280 |
(...skipping 12 matching lines...) Expand all Loading... |
293 */ | 293 */ |
294 _targetDisposed: function(event) | 294 _targetDisposed: function(event) |
295 { | 295 { |
296 var target = /** @type {!WebInspector.Target} */ (event.data); | 296 var target = /** @type {!WebInspector.Target} */ (event.data); |
297 if (target !== this._target) | 297 if (target !== this._target) |
298 return; | 298 return; |
299 this.dispose(); | 299 this.dispose(); |
300 }, | 300 }, |
301 | 301 |
302 __proto__: WebInspector.SDKObject.prototype | 302 __proto__: WebInspector.SDKObject.prototype |
303 } | 303 }; |
OLD | NEW |