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

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

Powered by Google App Engine
This is Rietveld 408576698