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

Side by Side Diff: Source/devtools/front_end/inspector.js

Issue 185463010: DevTools: Introduce Target class which holds connection & models (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@gr-RuntimeAgent
Patch Set: Address vsevik's comments Created 6 years, 9 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 var warnings = WebInspector.console.warnings; 186 var warnings = WebInspector.console.warnings;
187 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings); 187 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings);
188 }, 188 },
189 189
190 inspectedPageDomain: function() 190 inspectedPageDomain: function()
191 { 191 {
192 var parsedURL = WebInspector.inspectedPageURL && WebInspector.inspectedP ageURL.asParsedURL(); 192 var parsedURL = WebInspector.inspectedPageURL && WebInspector.inspectedP ageURL.asParsedURL();
193 return parsedURL ? parsedURL.host : ""; 193 return parsedURL ? parsedURL.host : "";
194 }, 194 },
195 195
196 _initializeCapability: function(name, callback, error, result)
197 {
198 Capabilities[name] = result;
199 if (callback)
200 callback();
201 },
202
203 _debuggerPaused: function() 196 _debuggerPaused: function()
204 { 197 {
205 this.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events .DebuggerPaused, this._debuggerPaused, this); 198 this.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events .DebuggerPaused, this._debuggerPaused, this);
206 WebInspector.showPanel("sources"); 199 WebInspector.showPanel("sources");
207 } 200 }
208 } 201 }
209 202
210 WebInspector.Events = { 203 WebInspector.Events = {
211 InspectorLoaded: "InspectorLoaded" 204 InspectorLoaded: "InspectorLoaded"
212 } 205 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 279 }
287 WebInspector.socket.onclose = function() { 280 WebInspector.socket.onclose = function() {
288 if (!WebInspector.socket._detachReason) 281 if (!WebInspector.socket._detachReason)
289 (new WebInspector.RemoteDebuggingTerminatedScreen("websocket_clo sed")).showModal(); 282 (new WebInspector.RemoteDebuggingTerminatedScreen("websocket_clo sed")).showModal();
290 } 283 }
291 return; 284 return;
292 } 285 }
293 286
294 WebInspector.doLoadedDone(); 287 WebInspector.doLoadedDone();
295 288
296 // In case of loading as a web page with no bindings / harness, kick off ini tialization manually. 289 if (InspectorFrontendHost.isStub)
297 if (InspectorFrontendHost.isStub) {
298 InspectorFrontendAPI.dispatchQueryParameters(WebInspector.queryParamsObj ect); 290 InspectorFrontendAPI.dispatchQueryParameters(WebInspector.queryParamsObj ect);
299 WebInspector._doLoadedDoneWithCapabilities();
300 }
301 } 291 }
302 292
303 WebInspector.doLoadedDone = function() 293 WebInspector.doLoadedDone = function()
304 { 294 {
305 // Install styles and themes 295 // Install styles and themes
306 WebInspector.installPortStyles(); 296 WebInspector.installPortStyles();
307 if (WebInspector.socket) 297 if (WebInspector.socket)
308 document.body.classList.add("remote"); 298 document.body.classList.add("remote");
309 299
310 if (WebInspector.queryParamsObject.toolbarColor && WebInspector.queryParamsO bject.textColor) 300 if (WebInspector.queryParamsObject.toolbarColor && WebInspector.queryParamsO bject.textColor)
311 WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbarColo r, WebInspector.queryParamsObject.textColor); 301 WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbarColo r, WebInspector.queryParamsObject.textColor);
312 302
313 var workerId = WebInspector.queryParamsObject["dedicatedWorkerId"]; 303 var workerId = WebInspector.queryParamsObject["dedicatedWorkerId"];
314 if (workerId) 304 if (workerId)
315 this._initializeDedicatedWorkerFrontend(workerId); 305 this._initializeDedicatedWorkerFrontend(workerId);
316 306
317 var connection = workerId ? new WebInspector.WorkerConnection(workerId) : ne w InspectorBackendClass.MainConnection(); 307 var connection = workerId ? new WebInspector.WorkerConnection(workerId) : ne w InspectorBackendClass.MainConnection();
318 InspectorBackend.setConnection(connection); 308 InspectorBackend.setConnection(connection);
319 309
320 PageAgent.canScreencast(WebInspector._initializeCapability.bind(WebInspector , "canScreencast", null)); 310 WebInspector.targetManager = new WebInspector.TargetManager();
321 WorkerAgent.canInspectWorkers(WebInspector._initializeCapability.bind(WebIns pector, "canInspectWorkers", WebInspector._doLoadedDoneWithCapabilities.bind(Web Inspector))); 311 WebInspector.targetManager.createTarget(connection, WebInspector._doLoadedDo neWithCapabilities.bind(WebInspector));
322 } 312 }
323 313
324 WebInspector._doLoadedDoneWithCapabilities = function() 314 WebInspector._doLoadedDoneWithCapabilities = function(mainTarget)
325 { 315 {
316 // compatibility code
317 Capabilities.canInspectWorkers = mainTarget.canInspectWorkers;
vsevik 2014/03/06 16:30:08 Please move this to Target.
sergeyv 2014/03/06 16:45:37 Done.
318
326 new WebInspector.VersionController().updateVersion(); 319 new WebInspector.VersionController().updateVersion();
327
328 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); 320 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
329 this._registerShortcuts(); 321 this._registerShortcuts();
330 322
331 // set order of some sections explicitly 323 // set order of some sections explicitly
332 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); 324 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));
333 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel") ); 325 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel") );
334 WebInspector.ShortcutsScreen.registerShortcuts(); 326 WebInspector.ShortcutsScreen.registerShortcuts();
335 327
336 this.console = new WebInspector.ConsoleModel();
337 this.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleare d, this._resetErrorAndWarningCounts, this); 328 this.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleare d, this._resetErrorAndWarningCounts, this);
338 this.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._updateErrorAndWarningCounts, this); 329 this.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._updateErrorAndWarningCounts, this);
339 this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUp dated, this._updateErrorAndWarningCounts, this); 330 this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUp dated, this._updateErrorAndWarningCounts, this);
340 this.networkManager = new WebInspector.NetworkManager(); 331
341 this.resourceTreeModel = new WebInspector.ResourceTreeModel(this.networkMana ger);
342 this.debuggerModel = new WebInspector.DebuggerModel();
343 this.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debugg erPaused, this._debuggerPaused, this); 332 this.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debugg erPaused, this._debuggerPaused, this);
344 this.networkLog = new WebInspector.NetworkLog(); 333 this.networkLog = new WebInspector.NetworkLog();
345 this.domAgent = new WebInspector.DOMAgent();
346 this.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectNodeReque sted, this._inspectNodeRequested, this); 334 this.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectNodeReque sted, this._inspectNodeRequested, this);
347 this.workerManager = new WebInspector.WorkerManager(Capabilities.canInspectW orkers);
348 this.runtimeModel = new WebInspector.RuntimeModel(this.resourceTreeModel);
349 335
350 this.zoomManager = new WebInspector.ZoomManager(); 336 this.zoomManager = new WebInspector.ZoomManager();
351 337
352 this.advancedSearchController = new WebInspector.AdvancedSearchController(); 338 this.advancedSearchController = new WebInspector.AdvancedSearchController();
353 this.consoleView = new WebInspector.ConsoleView(WebInspector.isWorkerFronten d()); 339 this.consoleView = new WebInspector.ConsoleView(WebInspector.isWorkerFronten d());
354 340
355 InspectorBackend.registerInspectorDispatcher(this); 341 InspectorBackend.registerInspectorDispatcher(this);
356 342
357 this.isolatedFileSystemManager = new WebInspector.IsolatedFileSystemManager( ); 343 this.isolatedFileSystemManager = new WebInspector.IsolatedFileSystemManager( );
358 this.isolatedFileSystemDispatcher = new WebInspector.IsolatedFileSystemDispa tcher(this.isolatedFileSystemManager); 344 this.isolatedFileSystemDispatcher = new WebInspector.IsolatedFileSystemDispa tcher(this.isolatedFileSystemManager);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 new WebInspector.PresentationConsoleMessageHelper(this.workspace); 383 new WebInspector.PresentationConsoleMessageHelper(this.workspace);
398 384
399 // Create settings before loading modules. 385 // Create settings before loading modules.
400 WebInspector.settings.initializeBackendSettings(); 386 WebInspector.settings.initializeBackendSettings();
401 387
402 this._registerModules(); 388 this._registerModules();
403 389
404 this.panels = {}; 390 this.panels = {};
405 this.inspectorView = new WebInspector.InspectorView(); 391 this.inspectorView = new WebInspector.InspectorView();
406 // Screencast controller creates a root view itself. 392 // Screencast controller creates a root view itself.
407 if (Capabilities.canScreencast) 393 if (mainTarget.canScreencast)
408 this._screencastController = new WebInspector.ScreencastController(); 394 this._screencastController = new WebInspector.ScreencastController();
409 else 395 else
410 this._createRootView(); 396 this._createRootView();
411 this._createGlobalStatusBarItems(); 397 this._createGlobalStatusBarItems();
412 398
413 this.addMainEventListeners(document); 399 this.addMainEventListeners(document);
414 400
415 window.addEventListener("resize", this.windowResize.bind(this), true); 401 window.addEventListener("resize", this.windowResize.bind(this), true);
416 402
417 var errorWarningCount = document.getElementById("error-warning-count"); 403 var errorWarningCount = document.getElementById("error-warning-count");
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 this._fontFamily = "'Lucida Grande', sans-serif"; 885 this._fontFamily = "'Lucida Grande', sans-serif";
900 break; 886 break;
901 case "windows": 887 case "windows":
902 this._fontFamily = "'Segoe UI', Tahoma, sans-serif"; 888 this._fontFamily = "'Segoe UI', Tahoma, sans-serif";
903 break; 889 break;
904 } 890 }
905 return WebInspector._fontFamily; 891 return WebInspector._fontFamily;
906 } 892 }
907 893
908 window.DEBUG = true; 894 window.DEBUG = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698