Chromium Code Reviews| 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._capabilitiesMask = capabilitiesMask; | 22 this._capabilitiesMask = capabilitiesMask; |
| 22 this._connection = connection; | 23 this._connection = connection; |
| 23 this._parentTarget = parentTarget; | 24 this._parentTarget = parentTarget; |
| 24 connection.addEventListener(InspectorBackendClass.Connection.Events.Disconne cted, this._onDisconnect, this); | 25 connection.addEventListener(InspectorBackendClass.Connection.Events.Disconne cted, this._onDisconnect, this); |
| 25 this._id = WebInspector.Target._nextId++; | 26 this._id = WebInspector.Target._nextId++; |
| 26 | 27 |
| 27 /** @type {!Map.<!Function, !WebInspector.SDKModel>} */ | 28 /** @type {!Map.<!Function, !WebInspector.SDKModel>} */ |
| 28 this._modelByConstructor = new Map(); | 29 this._modelByConstructor = new Map(); |
| 29 } | 30 } |
| 30 | 31 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 }, | 183 }, |
| 183 | 184 |
| 184 /** | 185 /** |
| 185 * @return {!Array<!WebInspector.SDKModel>} | 186 * @return {!Array<!WebInspector.SDKModel>} |
| 186 */ | 187 */ |
| 187 models: function() | 188 models: function() |
| 188 { | 189 { |
| 189 return this._modelByConstructor.valuesArray(); | 190 return this._modelByConstructor.valuesArray(); |
| 190 }, | 191 }, |
| 191 | 192 |
| 193 /** | |
| 194 * @return {string} | |
| 195 */ | |
| 196 inspectedURL: function() | |
| 197 { | |
| 198 return this._inspectedURL; | |
| 199 }, | |
| 200 | |
| 201 /** | |
| 202 * @return {string} | |
| 203 */ | |
| 204 inspectedDomain: function() | |
|
dgozman
2016/07/27 20:24:23
Maybe we should inline this at call sites?
eostroukhov-old
2016/07/27 21:39:46
Done.
| |
| 205 { | |
| 206 var parsedURL = this._inspectedURL ? this._inspectedURL.asParsedURL() : null; | |
| 207 return parsedURL ? parsedURL.host : ""; | |
| 208 }, | |
| 209 | |
| 210 /** | |
| 211 * @param {string} inspectedURL | |
| 212 */ | |
| 213 setInspectedURL: function(inspectedURL) | |
| 214 { | |
| 215 this._inspectedURL = inspectedURL; | |
| 216 InspectorFrontendHost.inspectedURLChanged(inspectedURL || ""); | |
| 217 this._targetManager.dispatchEventToListeners(WebInspector.TargetManager. Events.InspectedURLChanged, this); | |
| 218 }, | |
| 219 | |
| 192 __proto__: Protocol.Agents.prototype | 220 __proto__: Protocol.Agents.prototype |
| 193 } | 221 } |
| 194 | 222 |
| 195 /** | 223 /** |
| 196 * @constructor | 224 * @constructor |
| 197 * @extends {WebInspector.Object} | 225 * @extends {WebInspector.Object} |
| 198 * @param {!WebInspector.Target} target | 226 * @param {!WebInspector.Target} target |
| 199 */ | 227 */ |
| 200 WebInspector.SDKObject = function(target) | 228 WebInspector.SDKObject = function(target) |
| 201 { | 229 { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 { | 282 { |
| 255 var target = /** @type {!WebInspector.Target} */ (event.data); | 283 var target = /** @type {!WebInspector.Target} */ (event.data); |
| 256 if (target !== this._target) | 284 if (target !== this._target) |
| 257 return; | 285 return; |
| 258 this.dispose(); | 286 this.dispose(); |
| 259 WebInspector.targetManager.removeEventListener(WebInspector.TargetManage r.Events.TargetDisposed, this._targetDisposed, this); | 287 WebInspector.targetManager.removeEventListener(WebInspector.TargetManage r.Events.TargetDisposed, this._targetDisposed, this); |
| 260 }, | 288 }, |
| 261 | 289 |
| 262 __proto__: WebInspector.SDKObject.prototype | 290 __proto__: WebInspector.SDKObject.prototype |
| 263 } | 291 } |
| OLD | NEW |