| 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 {string} name |
| 10 * @param {!InspectorBackendClass.Connection} connection | 11 * @param {!InspectorBackendClass.Connection} connection |
| 11 * @param {function(!WebInspector.Target)=} callback | 12 * @param {function(!WebInspector.Target)=} callback |
| 12 */ | 13 */ |
| 13 WebInspector.Target = function(connection, callback) | 14 WebInspector.Target = function(name, connection, callback) |
| 14 { | 15 { |
| 15 Protocol.Agents.call(this, connection.agentsMap()); | 16 Protocol.Agents.call(this, connection.agentsMap()); |
| 17 this._name = name; |
| 16 this._connection = connection; | 18 this._connection = connection; |
| 17 /** @type {boolean} */ | 19 /** @type {boolean} */ |
| 18 this.isMainFrontend = false; | 20 this.isMainFrontend = false; |
| 19 this._id = WebInspector.Target._nextId++; | 21 this._id = WebInspector.Target._nextId++; |
| 20 /** @type {boolean} */ | 22 /** @type {boolean} */ |
| 21 this.canScreencast = false; | 23 this.canScreencast = false; |
| 22 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr
eencast", null)); | 24 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr
eencast", null)); |
| 23 | 25 |
| 24 /** @type {boolean} */ | 26 /** @type {boolean} */ |
| 25 this.hasTouchInputs = false; | 27 this.hasTouchInputs = false; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 | 42 |
| 41 /** | 43 /** |
| 42 * @return {number} | 44 * @return {number} |
| 43 */ | 45 */ |
| 44 id: function() | 46 id: function() |
| 45 { | 47 { |
| 46 return this._id; | 48 return this._id; |
| 47 }, | 49 }, |
| 48 | 50 |
| 49 /** | 51 /** |
| 52 * |
| 53 * @return {string} |
| 54 */ |
| 55 name: function() |
| 56 { |
| 57 return this._name; |
| 58 }, |
| 59 |
| 60 /** |
| 50 * @param {string} name | 61 * @param {string} name |
| 51 * @param {function()|null} callback | 62 * @param {function()|null} callback |
| 52 * @param {?Protocol.Error} error | 63 * @param {?Protocol.Error} error |
| 53 * @param {*} result | 64 * @param {*} result |
| 54 */ | 65 */ |
| 55 _initializeCapability: function(name, callback, error, result) | 66 _initializeCapability: function(name, callback, error, result) |
| 56 { | 67 { |
| 57 this[name] = result; | 68 this[name] = result; |
| 58 if (!Capabilities[name]) | 69 if (!Capabilities[name]) |
| 59 Capabilities[name] = result; | 70 Capabilities[name] = result; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 248 |
| 238 /** | 249 /** |
| 239 * @param {!WebInspector.TargetManager.Observer} targetObserver | 250 * @param {!WebInspector.TargetManager.Observer} targetObserver |
| 240 */ | 251 */ |
| 241 unobserveTargets: function(targetObserver) | 252 unobserveTargets: function(targetObserver) |
| 242 { | 253 { |
| 243 this._observers.remove(targetObserver); | 254 this._observers.remove(targetObserver); |
| 244 }, | 255 }, |
| 245 | 256 |
| 246 /** | 257 /** |
| 258 * @param {string} name |
| 247 * @param {!InspectorBackendClass.Connection} connection | 259 * @param {!InspectorBackendClass.Connection} connection |
| 248 * @param {function(!WebInspector.Target)=} callback | 260 * @param {function(!WebInspector.Target)=} callback |
| 249 */ | 261 */ |
| 250 createTarget: function(connection, callback) | 262 createTarget: function(name, connection, callback) |
| 251 { | 263 { |
| 252 var target = new WebInspector.Target(connection, callbackWrapper.bind(th
is)); | 264 var target = new WebInspector.Target(name, connection, callbackWrapper.b
ind(this)); |
| 253 | 265 |
| 254 /** | 266 /** |
| 255 * @this {WebInspector.TargetManager} | 267 * @this {WebInspector.TargetManager} |
| 256 * @param {!WebInspector.Target} newTarget | 268 * @param {!WebInspector.Target} newTarget |
| 257 */ | 269 */ |
| 258 function callbackWrapper(newTarget) | 270 function callbackWrapper(newTarget) |
| 259 { | 271 { |
| 260 this.addTarget(newTarget); | 272 this.addTarget(newTarget); |
| 261 if (callback) | 273 if (callback) |
| 262 callback(newTarget); | 274 callback(newTarget); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 /** | 330 /** |
| 319 * @param {!WebInspector.Target} target | 331 * @param {!WebInspector.Target} target |
| 320 */ | 332 */ |
| 321 targetRemoved: function(target) { }, | 333 targetRemoved: function(target) { }, |
| 322 } | 334 } |
| 323 | 335 |
| 324 /** | 336 /** |
| 325 * @type {!WebInspector.TargetManager} | 337 * @type {!WebInspector.TargetManager} |
| 326 */ | 338 */ |
| 327 WebInspector.targetManager; | 339 WebInspector.targetManager; |
| OLD | NEW |