| OLD | NEW |
| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 /** | 163 /** |
| 164 * @this {WebInspector.Main} | 164 * @this {WebInspector.Main} |
| 165 */ | 165 */ |
| 166 function calculateTitle() | 166 function calculateTitle() |
| 167 { | 167 { |
| 168 this._calculateWorkerInspectorTitle(); | 168 this._calculateWorkerInspectorTitle(); |
| 169 } | 169 } |
| 170 }, | 170 }, |
| 171 | 171 |
| 172 _resetErrorAndWarningCounts: function() | |
| 173 { | |
| 174 WebInspector.inspectorView.setErrorAndWarningCounts(0, 0); | |
| 175 }, | |
| 176 | |
| 177 _updateErrorAndWarningCounts: function() | |
| 178 { | |
| 179 var errors = WebInspector.consoleModel.errors; | |
| 180 var warnings = WebInspector.consoleModel.warnings; | |
| 181 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings); | |
| 182 }, | |
| 183 | |
| 184 _debuggerPaused: function() | |
| 185 { | |
| 186 WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerMode
l.Events.DebuggerPaused, this._debuggerPaused, this); | |
| 187 WebInspector.inspectorView.showPanel("sources"); | |
| 188 }, | |
| 189 | |
| 190 _loaded: function() | 172 _loaded: function() |
| 191 { | 173 { |
| 192 console.timeStamp("Main._loaded"); | 174 console.timeStamp("Main._loaded"); |
| 193 if (WebInspector.queryParam("toolbox")) { | 175 if (WebInspector.queryParam("toolbox")) { |
| 194 new WebInspector.Toolbox(); | 176 new WebInspector.Toolbox(); |
| 195 return; | 177 return; |
| 196 } | 178 } |
| 197 | 179 |
| 198 WebInspector.settings = new WebInspector.Settings(); | 180 WebInspector.settings = new WebInspector.Settings(); |
| 199 WebInspector.experimentsSettings = new WebInspector.ExperimentsSettings(
WebInspector.queryParam("experiments") !== null); | 181 WebInspector.experimentsSettings = new WebInspector.ExperimentsSettings(
WebInspector.queryParam("experiments") !== null); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); | 289 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); |
| 308 this._registerShortcuts(); | 290 this._registerShortcuts(); |
| 309 | 291 |
| 310 // set order of some sections explicitly | 292 // set order of some sections explicitly |
| 311 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); | 293 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); |
| 312 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Pan
el")); | 294 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Pan
el")); |
| 313 | 295 |
| 314 if (WebInspector.experimentsSettings.workersInMainWindow.isEnabled()) | 296 if (WebInspector.experimentsSettings.workersInMainWindow.isEnabled()) |
| 315 WebInspector.workerTargetManager = new WebInspector.WorkerTargetMana
ger(mainTarget, WebInspector.targetManager); | 297 WebInspector.workerTargetManager = new WebInspector.WorkerTargetMana
ger(mainTarget, WebInspector.targetManager); |
| 316 | 298 |
| 317 WebInspector.consoleModel.addEventListener(WebInspector.ConsoleModel.Eve
nts.ConsoleCleared, this._resetErrorAndWarningCounts, this); | |
| 318 WebInspector.consoleModel.addEventListener(WebInspector.ConsoleModel.Eve
nts.MessageAdded, this._updateErrorAndWarningCounts, this); | |
| 319 | |
| 320 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.E
vents.DebuggerPaused, this._debuggerPaused, this); | |
| 321 | |
| 322 InspectorBackend.registerInspectorDispatcher(this); | 299 InspectorBackend.registerInspectorDispatcher(this); |
| 323 | 300 |
| 324 if (Capabilities.isMainFrontend) { | 301 if (Capabilities.isMainFrontend) { |
| 325 WebInspector.inspectElementModeController = new WebInspector.Inspect
ElementModeController(); | 302 WebInspector.inspectElementModeController = new WebInspector.Inspect
ElementModeController(); |
| 326 WebInspector.workerFrontendManager = new WebInspector.WorkerFrontend
Manager(); | 303 WebInspector.workerFrontendManager = new WebInspector.WorkerFrontend
Manager(); |
| 327 } else { | 304 } else { |
| 328 mainTarget.workerManager.addEventListener(WebInspector.WorkerManager
.Events.WorkerDisconnected, onWorkerDisconnected); | 305 mainTarget.workerManager.addEventListener(WebInspector.WorkerManager
.Events.WorkerDisconnected, onWorkerDisconnected); |
| 329 } | 306 } |
| 330 | 307 |
| 331 function onWorkerDisconnected() | 308 function onWorkerDisconnected() |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 340 |
| 364 this._registerModules(); | 341 this._registerModules(); |
| 365 WebInspector.actionRegistry = new WebInspector.ActionRegistry(); | 342 WebInspector.actionRegistry = new WebInspector.ActionRegistry(); |
| 366 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns
pector.actionRegistry); | 343 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns
pector.actionRegistry); |
| 367 this._registerForwardedShortcuts(); | 344 this._registerForwardedShortcuts(); |
| 368 this._registerMessageSinkListener(); | 345 this._registerMessageSinkListener(); |
| 369 WebInspector.ShortcutsScreen.registerShortcuts(); | 346 WebInspector.ShortcutsScreen.registerShortcuts(); |
| 370 | 347 |
| 371 WebInspector.zoomManager = new WebInspector.ZoomManager(); | 348 WebInspector.zoomManager = new WebInspector.ZoomManager(); |
| 372 WebInspector.inspectorView = new WebInspector.InspectorView(); | 349 WebInspector.inspectorView = new WebInspector.InspectorView(); |
| 350 |
| 351 new WebInspector.Main.PauseListener(); |
| 352 new WebInspector.Main.WarningErrorCounter(); |
| 353 |
| 373 WebInspector.app.createRootView(); | 354 WebInspector.app.createRootView(); |
| 374 this._createGlobalStatusBarItems(); | 355 this._createGlobalStatusBarItems(); |
| 375 | 356 |
| 376 this._addMainEventListeners(document); | 357 this._addMainEventListeners(document); |
| 377 | 358 |
| 378 var errorWarningCount = document.getElementById("error-warning-count"); | 359 var errorWarningCount = document.getElementById("error-warning-count"); |
| 379 | 360 |
| 380 function showConsole() | 361 function showConsole() |
| 381 { | 362 { |
| 382 WebInspector.consoleModel.show(); | 363 WebInspector.consoleModel.show(); |
| 383 } | 364 } |
| 384 errorWarningCount.addEventListener("click", showConsole, false); | 365 errorWarningCount.addEventListener("click", showConsole, false); |
| 385 this._updateErrorAndWarningCounts(); | |
| 386 | 366 |
| 387 WebInspector.extensionServerProxy.setFrontendReady(); | 367 WebInspector.extensionServerProxy.setFrontendReady(); |
| 388 | 368 |
| 389 InspectorAgent.enable(inspectorAgentEnableCallback); | 369 InspectorAgent.enable(inspectorAgentEnableCallback); |
| 390 | 370 |
| 391 function inspectorAgentEnableCallback() | 371 function inspectorAgentEnableCallback() |
| 392 { | 372 { |
| 393 console.timeStamp("Main.inspectorAgentEnableCallback"); | 373 console.timeStamp("Main.inspectorAgentEnableCallback"); |
| 394 WebInspector.app.presentUI(); | 374 WebInspector.app.presentUI(); |
| 395 console.timeStamp("Main.inspectorAgentEnableCallbackPresentUI"); | 375 console.timeStamp("Main.inspectorAgentEnableCallbackPresentUI"); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 }); | 811 }); |
| 832 | 812 |
| 833 /** | 813 /** |
| 834 * @param {string} name | 814 * @param {string} name |
| 835 * @return {?WebInspector.Panel} | 815 * @return {?WebInspector.Panel} |
| 836 */ | 816 */ |
| 837 WebInspector.panel = function(name) | 817 WebInspector.panel = function(name) |
| 838 { | 818 { |
| 839 return WebInspector.inspectorView.panel(name); | 819 return WebInspector.inspectorView.panel(name); |
| 840 } | 820 } |
| 821 |
| 822 /** |
| 823 * @constructor |
| 824 * @implements {WebInspector.TargetManager.Observer} |
| 825 */ |
| 826 WebInspector.Main.WarningErrorCounter = function() |
| 827 { |
| 828 WebInspector.targetManager.observeTargets(this); |
| 829 } |
| 830 |
| 831 WebInspector.Main.WarningErrorCounter.prototype = { |
| 832 /** |
| 833 * @param {!WebInspector.Target} target |
| 834 */ |
| 835 targetAdded: function(target) |
| 836 { |
| 837 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co
nsoleCleared, this._updateErrorAndWarningCounts, this); |
| 838 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Me
ssageAdded, this._updateErrorAndWarningCounts, this); |
| 839 this._updateErrorAndWarningCounts(); |
| 840 }, |
| 841 |
| 842 /** |
| 843 * @param {!WebInspector.Target} target |
| 844 */ |
| 845 targetRemoved: function(target) |
| 846 { |
| 847 target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events
.ConsoleCleared, this._updateErrorAndWarningCounts, this); |
| 848 target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events
.MessageAdded, this._updateErrorAndWarningCounts, this); |
| 849 }, |
| 850 |
| 851 _updateErrorAndWarningCounts: function() |
| 852 { |
| 853 var errors = 0; |
| 854 var warnings = 0; |
| 855 var targets = WebInspector.targetManager.targets(); |
| 856 for (var i = 0; i < targets.length; ++i) { |
| 857 errors = errors + targets[i].consoleModel.errors; |
| 858 warnings = warnings + targets[i].consoleModel.warnings; |
| 859 } |
| 860 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings); |
| 861 } |
| 862 } |
| 863 |
| 864 /** |
| 865 * @constructor |
| 866 * @implements {WebInspector.TargetManager.Observer} |
| 867 */ |
| 868 WebInspector.Main.PauseListener = function() |
| 869 { |
| 870 WebInspector.targetManager.observeTargets(this); |
| 871 } |
| 872 |
| 873 WebInspector.Main.PauseListener.prototype = { |
| 874 /** |
| 875 * @param {!WebInspector.Target} target |
| 876 */ |
| 877 targetAdded: function(target) |
| 878 { |
| 879 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
DebuggerPaused, this._debuggerPaused, this); |
| 880 }, |
| 881 |
| 882 /** |
| 883 * @param {!WebInspector.Target} target |
| 884 */ |
| 885 targetRemoved: function(target) |
| 886 { |
| 887 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.DebuggerPaused, this._debuggerPaused, this); |
| 888 }, |
| 889 |
| 890 /** |
| 891 * @param {!WebInspector.Event} event |
| 892 */ |
| 893 _debuggerPaused: function(event) |
| 894 { |
| 895 var targets = WebInspector.targetManager.targets(); |
| 896 for (var i = 0; i < targets.length; ++i) |
| 897 targets[i].debuggerModel.removeEventListener(WebInspector.DebuggerMo
del.Events.DebuggerPaused, this._debuggerPaused, this); |
| 898 |
| 899 var debuggerModel = /** @type {!WebInspector.DebuggerModel} */ (event.ta
rget); |
| 900 WebInspector.context.setFlavor(WebInspector.Target, debuggerModel.target
()); |
| 901 WebInspector.targetManager.unobserveTargets(this); |
| 902 WebInspector.inspectorView.showPanel("sources"); |
| 903 } |
| 904 } |
| OLD | NEW |