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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2419943003: DevTools: allow handing over the raw protocol connection to external clients and back. (Closed)
Patch Set: floors Created 4 years, 2 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
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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 console.timeStamp("Main._presentUI"); 223 console.timeStamp("Main._presentUI");
224 app.presentUI(document); 224 app.presentUI(document);
225 225
226 var toggleSearchNodeAction = WebInspector.actionRegistry.action("element s.toggle-element-search"); 226 var toggleSearchNodeAction = WebInspector.actionRegistry.action("element s.toggle-element-search");
227 // TODO: we should not access actions from other modules. 227 // TODO: we should not access actions from other modules.
228 if (toggleSearchNodeAction) 228 if (toggleSearchNodeAction)
229 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostA PI.Events.EnterInspectElementMode, toggleSearchNodeAction.execute.bind(toggleSea rchNodeAction), this); 229 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostA PI.Events.EnterInspectElementMode, toggleSearchNodeAction.execute.bind(toggleSea rchNodeAction), this);
230 WebInspector.inspectorView.createToolbars(); 230 WebInspector.inspectorView.createToolbars();
231 InspectorFrontendHost.loadCompleted(); 231 InspectorFrontendHost.loadCompleted();
232 232
233 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.E vents.EvaluateForTestInFrontend, this._evaluateForTestInFrontend, this);
234 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.E vents.ReloadInspectedPage, this._reloadInspectedPage, this);
235
233 var extensions = self.runtime.extensions(WebInspector.QueryParamHandler) ; 236 var extensions = self.runtime.extensions(WebInspector.QueryParamHandler) ;
234 for (var extension of extensions) { 237 for (var extension of extensions) {
235 var value = Runtime.queryParam(extension.descriptor()["name"]); 238 var value = Runtime.queryParam(extension.descriptor()["name"]);
236 if (value !== null) 239 if (value !== null)
237 extension.instance().then(handleQueryParam.bind(null, value)); 240 extension.instance().then(handleQueryParam.bind(null, value));
238 } 241 }
239 242
240 /** 243 /**
241 * @param {string} value 244 * @param {string} value
242 * @param {!WebInspector.QueryParamHandler} handler 245 * @param {!WebInspector.QueryParamHandler} handler
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 /** 293 /**
291 * @param {!WebInspector.Event} event 294 * @param {!WebInspector.Event} event
292 */ 295 */
293 function onDisconnected(event) 296 function onDisconnected(event)
294 { 297 {
295 if (WebInspector._disconnectedScreenWithReasonWasShown) 298 if (WebInspector._disconnectedScreenWithReasonWasShown)
296 return; 299 return;
297 WebInspector.RemoteDebuggingTerminatedScreen.show(event.data.reason) ; 300 WebInspector.RemoteDebuggingTerminatedScreen.show(event.data.reason) ;
298 } 301 }
299 302
303 this._createMainTarget();
304 InspectorFrontendHost.readyForTest();
305 // Asynchronously run the extensions.
306 setTimeout(this._lateInitialization.bind(this), 100);
307 },
308
309 _createMainTarget: function()
310 {
300 var capabilities = 311 var capabilities =
301 WebInspector.Target.Capability.Browser | WebInspector.Target.Capabil ity.DOM | 312 WebInspector.Target.Capability.Browser | WebInspector.Target.Capabil ity.DOM |
302 WebInspector.Target.Capability.JS | WebInspector.Target.Capability.L og | 313 WebInspector.Target.Capability.JS | WebInspector.Target.Capability.L og |
303 WebInspector.Target.Capability.Network | WebInspector.Target.Capabil ity.Worker; 314 WebInspector.Target.Capability.Network | WebInspector.Target.Capabil ity.Worker;
304 if (Runtime.queryParam("isSharedWorker")) 315 if (Runtime.queryParam("isSharedWorker"))
305 capabilities = 316 capabilities =
306 WebInspector.Target.Capability.Browser | WebInspector.Target.Cap ability.Log | 317 WebInspector.Target.Capability.Browser | WebInspector.Target.Cap ability.Log |
307 WebInspector.Target.Capability.Network | WebInspector.Target.Cap ability.Worker; 318 WebInspector.Target.Capability.Network | WebInspector.Target.Cap ability.Worker;
308 else if (Runtime.queryParam("v8only")) 319 else if (Runtime.queryParam("v8only"))
309 capabilities = WebInspector.Target.Capability.JS; 320 capabilities = WebInspector.Target.Capability.JS;
310 321
311 this._mainTarget = WebInspector.targetManager.createTarget(WebInspector. UIString("Main"), capabilities, connection, null); 322 this._mainTarget = WebInspector.targetManager.createTarget(WebInspector. UIString("Main"), capabilities, this._mainConnection, null);
312 console.timeStamp("Main._mainTargetCreated");
313 this._registerShortcuts();
314
315 this._mainTarget.registerInspectorDispatcher(this); 323 this._mainTarget.registerInspectorDispatcher(this);
316 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.E vents.ReloadInspectedPage, this._reloadInspectedPage, this);
317 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.E vents.EvaluateForTestInFrontend, this._evaluateForTestInFrontend, this);
318
319 this._mainTarget.runtimeAgent().runIfWaitingForDebugger(); 324 this._mainTarget.runtimeAgent().runIfWaitingForDebugger();
320
321 if (this._mainTarget.hasBrowserCapability()) 325 if (this._mainTarget.hasBrowserCapability())
322 this._mainTarget.inspectorAgent().enable(); 326 this._mainTarget.inspectorAgent().enable();
323 InspectorFrontendHost.readyForTest(); 327 console.timeStamp("Main._mainTargetCreated");
328 },
324 329
325 // Asynchronously run the extensions. 330 _lateInitialization: function()
326 setTimeout(lateInitialization.bind(this), 0); 331 {
327 332 console.timeStamp("Main._lateInitialization");
328 /** 333 this._registerShortcuts();
329 * @this {WebInspector.Main} 334 WebInspector.extensionServer.initializeExtensions();
330 */ 335 if (Runtime.experiments.isEnabled("nodeDebugging"))
331 function lateInitialization() 336 new WebInspector.RemoteLocationManager(this._mainTarget);
332 {
333 console.timeStamp("Main.lateInitialization");
334 WebInspector.extensionServer.initializeExtensions();
335 if (Runtime.experiments.isEnabled("nodeDebugging"))
336 new WebInspector.RemoteLocationManager(this._mainTarget);
337 }
338 }, 337 },
339 338
340 _registerForwardedShortcuts: function() 339 _registerForwardedShortcuts: function()
341 { 340 {
342 /** @const */ var forwardedActions = ["main.toggle-dock", "debugger.togg le-breakpoints-active", "debugger.toggle-pause", "commandMenu.show"]; 341 /** @const */ var forwardedActions = ["main.toggle-dock", "debugger.togg le-breakpoints-active", "debugger.toggle-pause", "commandMenu.show"];
343 var actionKeys = WebInspector.shortcutRegistry.keysForActions(forwardedA ctions).map(WebInspector.KeyboardShortcut.keyCodeAndModifiersFromKey); 342 var actionKeys = WebInspector.shortcutRegistry.keysForActions(forwardedA ctions).map(WebInspector.KeyboardShortcut.keyCodeAndModifiersFromKey);
344 InspectorFrontendHost.setWhitelistedShortcuts(JSON.stringify(actionKeys) ); 343 InspectorFrontendHost.setWhitelistedShortcuts(JSON.stringify(actionKeys) );
345 }, 344 },
346 345
347 _registerMessageSinkListener: function() 346 _registerMessageSinkListener: function()
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 * @override 1116 * @override
1118 * @return {?Element} 1117 * @return {?Element}
1119 */ 1118 */
1120 settingElement: function() 1119 settingElement: function()
1121 { 1120 {
1122 return WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStri ng("Show rulers"), WebInspector.moduleSetting("showMetricsRulers")); 1121 return WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStri ng("Show rulers"), WebInspector.moduleSetting("showMetricsRulers"));
1123 } 1122 }
1124 } 1123 }
1125 1124
1126 new WebInspector.Main(); 1125 new WebInspector.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698