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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.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 | « third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 Components.dockController.initialize(); 243 Components.dockController.initialize();
244 app.presentUI(document); 244 app.presentUI(document);
245 245
246 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme nt-search'); 246 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme nt-search');
247 // TODO: we should not access actions from other modules. 247 // TODO: we should not access actions from other modules.
248 if (toggleSearchNodeAction) { 248 if (toggleSearchNodeAction) {
249 InspectorFrontendHost.events.addEventListener( 249 InspectorFrontendHost.events.addEventListener(
250 InspectorFrontendHostAPI.Events.EnterInspectElementMode, 250 InspectorFrontendHostAPI.Events.EnterInspectElementMode,
251 toggleSearchNodeAction.execute.bind(toggleSearchNodeAction), this); 251 toggleSearchNodeAction.execute.bind(toggleSearchNodeAction), this);
252 } 252 }
253 InspectorFrontendHost.events.addEventListener(
254 InspectorFrontendHostAPI.Events.RevealSourceLine, this._revealSourceLine , this);
255
253 UI.inspectorView.createToolbars(); 256 UI.inspectorView.createToolbars();
254 InspectorFrontendHost.loadCompleted(); 257 InspectorFrontendHost.loadCompleted();
255 258
256 InspectorFrontendHost.events.addEventListener( 259 InspectorFrontendHost.events.addEventListener(
257 InspectorFrontendHostAPI.Events.ReloadInspectedPage, this._reloadInspect edPage, this); 260 InspectorFrontendHostAPI.Events.ReloadInspectedPage, this._reloadInspect edPage, this);
258 261
259 var extensions = self.runtime.extensions(Common.QueryParamHandler); 262 var extensions = self.runtime.extensions(Common.QueryParamHandler);
260 for (var extension of extensions) { 263 for (var extension of extensions) {
261 var value = Runtime.queryParam(extension.descriptor()['name']); 264 var value = Runtime.queryParam(extension.descriptor()['name']);
262 if (value !== null) 265 if (value !== null)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 /** 314 /**
312 * @param {!Common.Event} event 315 * @param {!Common.Event} event
313 */ 316 */
314 function messageAdded(event) { 317 function messageAdded(event) {
315 var message = /** @type {!Common.Console.Message} */ (event.data); 318 var message = /** @type {!Common.Console.Message} */ (event.data);
316 if (message.show) 319 if (message.show)
317 Common.console.show(); 320 Common.console.show();
318 } 321 }
319 } 322 }
320 323
324 /**
325 * @param {!Common.Event} event
326 */
327 _revealSourceLine(event) {
328 var url = /** @type {string} */ (event.data['url']);
329 var lineNumber = /** @type {number} */ (event.data['lineNumber']);
330 var columnNumber = /** @type {number} */ (event.data['columnNumber']);
331
332 var uiSourceCode = Workspace.workspace.uiSourceCodeForURL(url);
333 if (uiSourceCode) {
334 Common.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber));
335 return;
336 }
337
338 /**
339 * @param {!Common.Event} event
340 */
341 function listener(event) {
342 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
343 if (uiSourceCode.url() === url) {
344 Common.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber) );
345 Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISou rceCodeAdded, listener);
346 }
347 }
348
349 Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCode Added, listener);
350 }
351
321 _documentClick(event) { 352 _documentClick(event) {
322 var target = event.target; 353 var target = event.target;
323 if (target.shadowRoot) 354 if (target.shadowRoot)
324 target = event.deepElementFromPoint(); 355 target = event.deepElementFromPoint();
325 if (!target) 356 if (!target)
326 return; 357 return;
327 358
328 var anchor = target.enclosingNodeOrSelfWithNodeName('a'); 359 var anchor = target.enclosingNodeOrSelfWithNodeName('a');
329 if (!anchor || !anchor.href) 360 if (!anchor || !anchor.href)
330 return; 361 return;
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 * @override 1055 * @override
1025 * @return {?Element} 1056 * @return {?Element}
1026 */ 1057 */
1027 settingElement() { 1058 settingElement() {
1028 return UI.SettingsUI.createSettingCheckbox( 1059 return UI.SettingsUI.createSettingCheckbox(
1029 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' )); 1060 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' ));
1030 } 1061 }
1031 }; 1062 };
1032 1063
1033 new Main.Main(); 1064 new Main.Main();
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698