| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Bindings.NetworkMapping = class { | 7 Bindings.NetworkMapping = class { |
| 8 /** | 8 /** |
| 9 * @param {!Workspace.Workspace} workspace | 9 * @param {!Workspace.Workspace} workspace |
| 10 */ | 10 */ |
| 11 constructor(workspace) { | 11 constructor(workspace) { |
| 12 this._workspace = workspace; | 12 this._workspace = workspace; |
| 13 InspectorFrontendHost.events.addEventListener( | |
| 14 InspectorFrontendHostAPI.Events.RevealSourceLine, this._revealSourceLine
, this); | |
| 15 } | 13 } |
| 16 | 14 |
| 17 /** | 15 /** |
| 18 * @param {!SDK.Target} target | 16 * @param {!SDK.Target} target |
| 19 * @param {?SDK.ResourceTreeFrame} frame | 17 * @param {?SDK.ResourceTreeFrame} frame |
| 20 * @param {string} url | 18 * @param {string} url |
| 21 * @return {?Workspace.UISourceCode} | 19 * @return {?Workspace.UISourceCode} |
| 22 */ | 20 */ |
| 23 _networkUISourceCodeForURL(target, frame, url) { | 21 _networkUISourceCodeForURL(target, frame, url) { |
| 24 return this._workspace.uiSourceCode(Bindings.NetworkProject.projectId(target
, frame, false), url); | 22 return this._workspace.uiSourceCode(Bindings.NetworkProject.projectId(target
, frame, false), url); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return this._uiSourceCodeForURL(header.target(), frame, url); | 63 return this._uiSourceCodeForURL(header.target(), frame, url); |
| 66 } | 64 } |
| 67 | 65 |
| 68 /** | 66 /** |
| 69 * @param {string} url | 67 * @param {string} url |
| 70 * @return {?Workspace.UISourceCode} | 68 * @return {?Workspace.UISourceCode} |
| 71 */ | 69 */ |
| 72 uiSourceCodeForURLForAnyTarget(url) { | 70 uiSourceCodeForURLForAnyTarget(url) { |
| 73 return Workspace.workspace.uiSourceCodeForURL(url); | 71 return Workspace.workspace.uiSourceCodeForURL(url); |
| 74 } | 72 } |
| 75 | |
| 76 /** | |
| 77 * @param {!Common.Event} event | |
| 78 */ | |
| 79 _revealSourceLine(event) { | |
| 80 var url = /** @type {string} */ (event.data['url']); | |
| 81 var lineNumber = /** @type {number} */ (event.data['lineNumber']); | |
| 82 var columnNumber = /** @type {number} */ (event.data['columnNumber']); | |
| 83 | |
| 84 var uiSourceCode = this.uiSourceCodeForURLForAnyTarget(url); | |
| 85 if (uiSourceCode) { | |
| 86 Common.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber)); | |
| 87 return; | |
| 88 } | |
| 89 | |
| 90 /** | |
| 91 * @param {!Common.Event} event | |
| 92 * @this {Bindings.NetworkMapping} | |
| 93 */ | |
| 94 function listener(event) { | |
| 95 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); | |
| 96 if (uiSourceCode.url() === url) { | |
| 97 Common.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber)
); | |
| 98 this._workspace.removeEventListener(Workspace.Workspace.Events.UISourceC
odeAdded, listener, this); | |
| 99 } | |
| 100 } | |
| 101 | |
| 102 this._workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdde
d, listener, this); | |
| 103 } | |
| 104 }; | 73 }; |
| 105 | 74 |
| 106 /** | 75 /** |
| 107 * @type {!Bindings.NetworkMapping} | 76 * @type {!Bindings.NetworkMapping} |
| 108 */ | 77 */ |
| 109 Bindings.networkMapping; | 78 Bindings.networkMapping; |
| OLD | NEW |