Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: Source/devtools/front_end/Target.js

Issue 185463010: DevTools: Introduce Target class which holds connection & models (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@gr-RuntimeAgent
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /**
2 * Copyright 2014 The Chromium Authors. All rights reserved.
aandrey 2014/03/04 10:05:16 odd licence
sergeyv 2014/03/04 12:42:37 Header was changed recently. http://www.chromium.
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 {WebInspector.Object}
10 * @param {!InspectorBackendClass.Connection} connection
11 */
12 WebInspector.Target = function(connection)
13 {
14 WebInspector.Object.call(this);
15 this.connection = connection;
16 this.canScreenCast = false;
17 this.canInspectWorkers = false;
18
19 connection.agent("Page").canScreencast(this._initializeCapability.bind(this, "canScreencast", null));
20 connection.agent("Worker").canInspectWorkers(this._initializeCapability.bind (this, "canInspectWorkers", this._loadedWithCapabilities.bind(this)));
21
22 // In case of loading as a web page with no bindings / harness, kick off ini tialization manually.
23 if (InspectorFrontendHost.isStub)
24 // give a chance to add listeners of WebInspector.Target.Events.TargetIs Ready
aandrey 2014/03/04 10:05:16 add {} braces
sergeyv 2014/03/04 12:42:38 Done.
25 setTimeout(this._loadedWithCapabilities.bind(this), 0);
26 }
27
28 WebInspector.Target.Events = {
29 TargetIsReady: "TargetIsReady"
30 }
31
32 WebInspector.Target.prototype = {
33
34 _initializeCapability: function(name, callback, error, result)
35 {
36 this[name] = result;
37 if (callback)
38 callback();
39 },
40
41 _loadedWithCapabilities: function()
aandrey 2014/03/04 10:05:16 this does not seem to be private
sergeyv 2014/03/04 12:42:38 There is no usages of this function out of this fi
42 {
43 this.consoleModel = new WebInspector.ConsoleModel(this);
44 this.networkManager = new WebInspector.NetworkManager(this);
45 this.resourceTreeModel = new WebInspector.ResourceTreeModel(this);
46 this.debuggerModel = new WebInspector.DebuggerModel();
47 this.runtimeModel = new WebInspector.RuntimeModel(this);
48
49 this.dispatchEventToListeners(WebInspector.Target.Events.TargetIsReady);
50 },
51
52 __proto__: WebInspector.Object.prototype
53 }
54
55 /**
56 * @constructor
57 * @extends {WebInspector.Object}
58 */
59 WebInspector.TargetManager = function()
60 {
61 this._targets = [];
aandrey 2014/03/04 10:05:16 jsdoc
sergeyv 2014/03/04 12:42:38 Done.
62 }
63
64 WebInspector.TargetManager.Events = {
65 TargetSwitched: "TargetSwitched"
66 }
67
68 WebInspector.TargetManager.prototype = {
69
70 /**
71 * @param {!InspectorBackendClass.Connection} connection
72 * @return {!WebInspector.Target}
73 */
74 newConnectionAvailable: function(connection)
75 {
76 var newTarget = new WebInspector.Target(connection);
77 this._targets.push(newTarget);
78 return newTarget;
79 },
80
81 __proto__: WebInspector.Object.prototype
82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698