| 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 28 matching lines...) Expand all Loading... |
| 58 WebInspector.runtimeModel = this.runtimeModel; | 62 WebInspector.runtimeModel = this.runtimeModel; |
| 59 | 63 |
| 60 this.domModel = new WebInspector.DOMModel(); | 64 this.domModel = new WebInspector.DOMModel(); |
| 61 if (!WebInspector.domModel) | 65 if (!WebInspector.domModel) |
| 62 WebInspector.domModel = this.domModel; | 66 WebInspector.domModel = this.domModel; |
| 63 | 67 |
| 64 this.workerManager = new WebInspector.WorkerManager(this, this.isMainFro
ntend); | 68 this.workerManager = new WebInspector.WorkerManager(this, this.isMainFro
ntend); |
| 65 if (!WebInspector.workerManager) | 69 if (!WebInspector.workerManager) |
| 66 WebInspector.workerManager = this.workerManager; | 70 WebInspector.workerManager = this.workerManager; |
| 67 | 71 |
| 72 if (this.canProfilePower) |
| 73 WebInspector.powerProfiler = new WebInspector.PowerProfiler(); |
| 74 |
| 68 if (callback) | 75 if (callback) |
| 69 callback(this); | 76 callback(this); |
| 70 }, | 77 }, |
| 71 | 78 |
| 72 /** | 79 /** |
| 73 * @override | 80 * @override |
| 74 * @param {string} domain | 81 * @param {string} domain |
| 75 * @param {!Object} dispatcher | 82 * @param {!Object} dispatcher |
| 76 */ | 83 */ |
| 77 registerDispatcher: function(domain, dispatcher) | 84 registerDispatcher: function(domain, dispatcher) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return this._targets[0]; | 153 return this._targets[0]; |
| 147 }, | 154 }, |
| 148 | 155 |
| 149 __proto__: WebInspector.Object.prototype | 156 __proto__: WebInspector.Object.prototype |
| 150 } | 157 } |
| 151 | 158 |
| 152 /** | 159 /** |
| 153 * @type {!WebInspector.TargetManager} | 160 * @type {!WebInspector.TargetManager} |
| 154 */ | 161 */ |
| 155 WebInspector.targetManager; | 162 WebInspector.targetManager; |
| OLD | NEW |