Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 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 | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 /** | |
| 8 * @constructor | |
| 9 * @extends {Protocol.Agents} | |
| 10 * @param {!InspectorBackendClass.Connection} connection | |
| 11 * @param {function(!WebInspector.Target)=} callback | |
| 12 */ | |
| 13 WebInspector.Target = function(connection, callback) | |
| 14 { | |
| 15 Protocol.Agents.call(this, connection.agentsMap()); | |
| 16 this._connection = connection; | |
| 17 this.canScreenCast = false; | |
|
vsevik
2014/03/06 17:52:31
Why is this needed?
sergeyv
2014/03/07 09:42:08
Done.
| |
| 18 this.canInspectWorkers = false; | |
| 19 | |
| 20 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr eencast", null)); | |
| 21 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, " canInspectWorkers", this._loadedWithCapabilities.bind(this, callback))); | |
| 22 | |
| 23 // In case of loading as a web page with no bindings / harness, kick off ini tialization manually. | |
| 24 if (InspectorFrontendHost.isStub) { | |
| 25 // give a chance to add listeners of WebInspector.Target.Events.TargetIs Ready | |
| 26 setTimeout(this._loadedWithCapabilities.bind(this, callback), 0); | |
| 27 } | |
| 28 } | |
| 29 | |
| 30 WebInspector.Target.prototype = { | |
| 31 | |
| 32 _initializeCapability: function(name, callback, error, result) | |
|
vsevik
2014/03/06 17:52:31
weird indent
sergeyv
2014/03/07 09:42:08
Done.
| |
| 33 { | |
| 34 this[name] = result; | |
| 35 if (callback) | |
| 36 callback(); | |
| 37 }, | |
| 38 | |
| 39 /** | |
| 40 * @param {function(!WebInspector.Target)=} callback | |
| 41 */ | |
| 42 _loadedWithCapabilities: function(callback) | |
| 43 { | |
| 44 // compatibility code | |
| 45 Capabilities.canInspectWorkers = this.canInspectWorkers; | |
|
vsevik
2014/03/06 17:52:31
Capabilities[name] = result; in _initializeCapabil
sergeyv
2014/03/07 09:42:08
Done.
| |
| 46 | |
| 47 this.consoleModel = new WebInspector.ConsoleModel(); | |
| 48 //This and similar lines are needed for compatibility | |
| 49 WebInspector.console = this.consoleModel; | |
| 50 this.networkManager = new WebInspector.NetworkManager(); | |
| 51 WebInspector.networkManager = this.networkManager; | |
| 52 this.resourceTreeModel = new WebInspector.ResourceTreeModel(this.network Manager); | |
| 53 WebInspector.resourceTreeModel = this.resourceTreeModel; | |
| 54 this.debuggerModel = new WebInspector.DebuggerModel(); | |
| 55 WebInspector.debuggerModel = this.debuggerModel; | |
| 56 this.runtimeModel = new WebInspector.RuntimeModel(this.resourceTreeModel ); | |
| 57 WebInspector.runtimeModel = this.runtimeModel; | |
| 58 | |
| 59 //we can't name it domAgent, because it clashes with function, WebInspec tor.DOMAgent should be renamed to DOMModel | |
| 60 this._domAgent = new WebInspector.DOMAgent(); | |
| 61 WebInspector.domAgent = this._domAgent; | |
| 62 this.workerManager = new WebInspector.WorkerManager(this.canInspectWorke rs); | |
| 63 WebInspector.workerManager = this.workerManager; | |
| 64 | |
| 65 if (callback) | |
| 66 callback(this); | |
| 67 }, | |
| 68 | |
| 69 __proto__: Protocol.Agents.prototype | |
| 70 } | |
| 71 | |
| 72 /** | |
| 73 * @constructor | |
| 74 */ | |
| 75 WebInspector.TargetManager = function() | |
| 76 { | |
| 77 /** @type {!Array.<!WebInspector.Target>} */ | |
| 78 this._targets = []; | |
| 79 } | |
| 80 | |
| 81 WebInspector.TargetManager.prototype = { | |
| 82 | |
| 83 /** | |
| 84 * @param {!InspectorBackendClass.Connection} connection | |
| 85 * @param {function(!WebInspector.Target)=} callback | |
| 86 */ | |
| 87 createTarget: function(connection, callback) | |
| 88 { | |
| 89 var newTarget = new WebInspector.Target(connection, callback); | |
| 90 this._targets.push(newTarget); | |
| 91 } | |
| 92 | |
| 93 } | |
| OLD | NEW |