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 {!InspectorBackendClass.Connection} connection | 10 * @param {!InspectorBackendClass.Connection} connection |
11 * @param {function(!WebInspector.Target)=} callback | 11 * @param {function(!WebInspector.Target)=} callback |
12 */ | 12 */ |
13 WebInspector.Target = function(connection, callback) | 13 WebInspector.Target = function(connection, callback) |
14 { | 14 { |
15 Protocol.Agents.call(this, connection.agentsMap()); | 15 Protocol.Agents.call(this, connection.agentsMap()); |
16 this._connection = connection; | 16 this._connection = connection; |
17 this.isMainFrontend = false; | 17 this.isMainFrontend = false; |
18 | 18 |
19 /** | |
20 * @type {boolean} | |
21 */ | |
22 this.canScreencast = false; | |
19 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr eencast", null)); | 23 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr eencast", null)); |
20 | 24 |
25 /** | |
26 * @type {boolean} | |
27 */ | |
28 this.hasTouchInputs = false; | |
29 this.pageAgent().hasTouchInputs(this._initializeCapability.bind(this, "hasTo uchInputs", null)); | |
30 | |
21 if (WebInspector.experimentsSettings.powerProfiler.isEnabled()) | 31 if (WebInspector.experimentsSettings.powerProfiler.isEnabled()) |
22 this.powerAgent().canProfilePower(this._initializeCapability.bind(this, "canProfilePower", null)); | 32 this.powerAgent().canProfilePower(this._initializeCapability.bind(this, "canProfilePower", null)); |
23 | 33 |
24 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, " isMainFrontend", this._loadedWithCapabilities.bind(this, callback))); | 34 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, " isMainFrontend", this._loadedWithCapabilities.bind(this, callback))); |
25 } | 35 } |
26 | 36 |
27 WebInspector.Target.prototype = { | 37 WebInspector.Target.prototype = { |
28 | 38 |
29 _initializeCapability: function(name, callback, error, result) | 39 _initializeCapability: function(name, callback, error, result) |
30 { | 40 { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 { | 229 { |
220 return this._targets; | 230 return this._targets; |
221 }, | 231 }, |
222 | 232 |
223 /** | 233 /** |
224 * @return {?WebInspector.Target} | 234 * @return {?WebInspector.Target} |
225 */ | 235 */ |
226 activeTarget: function() | 236 activeTarget: function() |
227 { | 237 { |
228 return this._targets[0]; | 238 return this._targets[0]; |
239 }, | |
240 | |
241 /** | |
242 * @return {?WebInspector.Target} | |
243 */ | |
244 mainTarget: function() | |
pfeldman
2014/04/18 16:23:15
Remove
dgozman
2014/04/21 11:46:11
Done.
| |
245 { | |
246 for (var i = 0; i < this._targets.length; ++i) { | |
247 if (this._targets[i].isMainFrontend) | |
dgozman
2014/04/18 15:13:12
Main target is the one with |isMainFrontend|, righ
| |
248 return this._targets[i]; | |
249 } | |
250 return null; | |
229 } | 251 } |
230 } | 252 } |
231 | 253 |
232 /** | 254 /** |
233 * @interface | 255 * @interface |
234 */ | 256 */ |
235 WebInspector.TargetManager.Observer = function() | 257 WebInspector.TargetManager.Observer = function() |
236 { | 258 { |
237 } | 259 } |
238 | 260 |
239 WebInspector.TargetManager.Observer.prototype = { | 261 WebInspector.TargetManager.Observer.prototype = { |
240 /** | 262 /** |
241 * @param {!WebInspector.Target} target | 263 * @param {!WebInspector.Target} target |
242 */ | 264 */ |
243 targetAdded: function(target) { }, | 265 targetAdded: function(target) { }, |
244 | 266 |
245 /** | 267 /** |
246 * @param {!WebInspector.Target} target | 268 * @param {!WebInspector.Target} target |
247 */ | 269 */ |
248 targetRemoved: function(target) { }, | 270 targetRemoved: function(target) { }, |
249 } | 271 } |
250 | 272 |
251 /** | 273 /** |
252 * @type {!WebInspector.TargetManager} | 274 * @type {!WebInspector.TargetManager} |
253 */ | 275 */ |
254 WebInspector.targetManager; | 276 WebInspector.targetManager; |
OLD | NEW |