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