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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js

Issue 2500233002: DevTools: move revealSourceLine handler from Networkmapping to Main (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/main/Main.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/main/Main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698