| 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 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr
eencast", null)); | 19 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr
eencast", null)); |
| 20 |
| 21 if (WebInspector.experimentsSettings.powerProfiler.isEnabled()) |
| 22 this.powerAgent().canProfilePower(this._initializeCapability.bind(this,
"canProfilePower", null)); |
| 23 |
| 20 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, "
isMainFrontend", this._loadedWithCapabilities.bind(this, callback))); | 24 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, "
isMainFrontend", this._loadedWithCapabilities.bind(this, callback))); |
| 21 } | 25 } |
| 22 | 26 |
| 23 WebInspector.Target.prototype = { | 27 WebInspector.Target.prototype = { |
| 24 | 28 |
| 25 _initializeCapability: function(name, callback, error, result) | 29 _initializeCapability: function(name, callback, error, result) |
| 26 { | 30 { |
| 27 this[name] = result; | 31 this[name] = result; |
| 28 if (!Capabilities[name]) | 32 if (!Capabilities[name]) |
| 29 Capabilities[name] = result; | 33 Capabilities[name] = result; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 59 | 63 |
| 60 //we can't name it domAgent, because it clashes with function, WebInspec
tor.DOMAgent should be renamed to DOMModel | 64 //we can't name it domAgent, because it clashes with function, WebInspec
tor.DOMAgent should be renamed to DOMModel |
| 61 this.domModel = new WebInspector.DOMAgent(); | 65 this.domModel = new WebInspector.DOMAgent(); |
| 62 if (!WebInspector.domAgent) | 66 if (!WebInspector.domAgent) |
| 63 WebInspector.domAgent = this.domModel; | 67 WebInspector.domAgent = this.domModel; |
| 64 | 68 |
| 65 this.workerManager = new WebInspector.WorkerManager(this, this.isMainFro
ntend); | 69 this.workerManager = new WebInspector.WorkerManager(this, this.isMainFro
ntend); |
| 66 if (!WebInspector.workerManager) | 70 if (!WebInspector.workerManager) |
| 67 WebInspector.workerManager = this.workerManager; | 71 WebInspector.workerManager = this.workerManager; |
| 68 | 72 |
| 73 if (this.canProfilePower) |
| 74 WebInspector.powerProfiler = new WebInspector.PowerProfiler(); |
| 75 |
| 69 if (callback) | 76 if (callback) |
| 70 callback(this); | 77 callback(this); |
| 71 }, | 78 }, |
| 72 | 79 |
| 73 /** | 80 /** |
| 74 * @override | 81 * @override |
| 75 * @param {string} domain | 82 * @param {string} domain |
| 76 * @param {!Object} dispatcher | 83 * @param {!Object} dispatcher |
| 77 */ | 84 */ |
| 78 registerDispatcher: function(domain, dispatcher) | 85 registerDispatcher: function(domain, dispatcher) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 return this._targets[0]; | 154 return this._targets[0]; |
| 148 }, | 155 }, |
| 149 | 156 |
| 150 __proto__: WebInspector.Object.prototype | 157 __proto__: WebInspector.Object.prototype |
| 151 } | 158 } |
| 152 | 159 |
| 153 /** | 160 /** |
| 154 * @type {!WebInspector.TargetManager} | 161 * @type {!WebInspector.TargetManager} |
| 155 */ | 162 */ |
| 156 WebInspector.targetManager; | 163 WebInspector.targetManager; |
| OLD | NEW |