OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @implements {WebInspector.TargetManager.Observer} | |
34 * @param {!WebInspector.NetworkWorkspaceBinding} networkWorkspaceBinding | 33 * @param {!WebInspector.NetworkWorkspaceBinding} networkWorkspaceBinding |
35 * @param {!WebInspector.Workspace} workspace | 34 * @param {!WebInspector.Workspace} workspace |
36 */ | 35 */ |
37 WebInspector.NetworkUISourceCodeProvider = function(networkWorkspaceBinding, wor
kspace) | 36 WebInspector.NetworkUISourceCodeProvider = function(networkWorkspaceBinding, wor
kspace) |
38 { | 37 { |
39 this._networkWorkspaceBinding = networkWorkspaceBinding; | 38 this._networkWorkspaceBinding = networkWorkspaceBinding; |
40 this._workspace = workspace; | 39 this._workspace = workspace; |
41 WebInspector.targetManager.observeTargets(this); | |
42 this._processedURLs = {}; | 40 this._processedURLs = {}; |
| 41 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel,
WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, th
is); |
| 42 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel,
WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNav
igated, this); |
| 43 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this
); |
| 44 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScriptSourc
e, this); |
| 45 WebInspector.targetManager.addModelListener(WebInspector.CSSStyleModel, WebI
nspector.CSSStyleModel.Events.StyleSheetAdded, this._styleSheetAdded, this); |
43 } | 46 } |
44 | 47 |
45 WebInspector.NetworkUISourceCodeProvider.prototype = { | 48 WebInspector.NetworkUISourceCodeProvider.prototype = { |
46 /** | 49 /** |
47 * @param {!WebInspector.Target} target | 50 * @param {!WebInspector.Target} target |
48 */ | 51 */ |
49 targetAdded: function(target) | |
50 { | |
51 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel
.EventTypes.ResourceAdded, this._resourceAdded, this); | |
52 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel
.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); | |
53 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
ParsedScriptSource, this._parsedScriptSource, this); | |
54 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
FailedToParseScriptSource, this._parsedScriptSource, this); | |
55 target.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Style
SheetAdded, this._styleSheetAdded, this); | |
56 }, | |
57 | |
58 /** | |
59 * @param {!WebInspector.Target} target | |
60 */ | |
61 targetRemoved: function(target) | |
62 { | |
63 // FIXME: add workspace cleanup here. | |
64 target.resourceTreeModel.removeEventListener(WebInspector.ResourceTreeMo
del.EventTypes.ResourceAdded, this._resourceAdded, this); | |
65 target.resourceTreeModel.removeEventListener(WebInspector.ResourceTreeMo
del.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); | |
66 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.ParsedScriptSource, this._parsedScriptSource, this); | |
67 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.FailedToParseScriptSource, this._parsedScriptSource, this); | |
68 target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.St
yleSheetAdded, this._styleSheetAdded, this); | |
69 }, | |
70 | |
71 /** | |
72 * @param {!WebInspector.Target} target | |
73 */ | |
74 _populate: function(target) | 52 _populate: function(target) |
75 { | 53 { |
76 /** | 54 /** |
77 * @param {!WebInspector.ResourceTreeFrame} frame | 55 * @param {!WebInspector.ResourceTreeFrame} frame |
78 * @this {WebInspector.NetworkUISourceCodeProvider} | 56 * @this {WebInspector.NetworkUISourceCodeProvider} |
79 */ | 57 */ |
80 function populateFrame(frame) | 58 function populateFrame(frame) |
81 { | 59 { |
82 for (var i = 0; i < frame.childFrames.length; ++i) | 60 for (var i = 0; i < frame.childFrames.length; ++i) |
83 populateFrame.call(this, frame.childFrames[i]); | 61 populateFrame.call(this, frame.childFrames[i]); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 246 } |
269 | 247 |
270 this._resource.searchInContent(query, caseSensitive, isRegex, callback); | 248 this._resource.searchInContent(query, caseSensitive, isRegex, callback); |
271 } | 249 } |
272 } | 250 } |
273 | 251 |
274 /** | 252 /** |
275 * @type {!WebInspector.NetworkWorkspaceBinding} | 253 * @type {!WebInspector.NetworkWorkspaceBinding} |
276 */ | 254 */ |
277 WebInspector.networkWorkspaceBinding; | 255 WebInspector.networkWorkspaceBinding; |
OLD | NEW |