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

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

Issue 396993003: DevTools: get rid of WebInspector.cssModel, use target models instead (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 { 209 {
210 WebInspector.setToolbarColors(/** @type {string} */ (event.data["bac kgroundColor"]), /** @type {string} */ (event.data["color"])); 210 WebInspector.setToolbarColors(/** @type {string} */ (event.data["bac kgroundColor"]), /** @type {string} */ (event.data["color"]));
211 } 211 }
212 212
213 var canDock = !!WebInspector.queryParam("can_dock"); 213 var canDock = !!WebInspector.queryParam("can_dock");
214 WebInspector.zoomManager = new WebInspector.ZoomManager(); 214 WebInspector.zoomManager = new WebInspector.ZoomManager();
215 WebInspector.inspectorView = new WebInspector.InspectorView(); 215 WebInspector.inspectorView = new WebInspector.InspectorView();
216 WebInspector.ContextMenu.initialize(); 216 WebInspector.ContextMenu.initialize();
217 WebInspector.dockController = new WebInspector.DockController(canDock); 217 WebInspector.dockController = new WebInspector.DockController(canDock);
218 WebInspector.overridesSupport = new WebInspector.OverridesSupport(canDoc k); 218 WebInspector.overridesSupport = new WebInspector.OverridesSupport(canDoc k);
219 WebInspector.multitargetConsoleModel = new WebInspector.MultitargetConso leModel();
219 220
220 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); 221 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
221 // set order of some sections explicitly 222 // set order of some sections explicitly
222 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); 223 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));
223 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Pan el")); 224 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Pan el"));
224 225
225 if (canDock) 226 if (canDock)
226 WebInspector.app = new WebInspector.AdvancedApp(); 227 WebInspector.app = new WebInspector.AdvancedApp();
227 else if (WebInspector.queryParam("remoteFrontend")) 228 else if (WebInspector.queryParam("remoteFrontend"))
228 WebInspector.app = new WebInspector.ScreencastApp(); 229 WebInspector.app = new WebInspector.ScreencastApp();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 WebInspector.setToolbarColors(WebInspector.queryParam("toolbarColor" ), WebInspector.queryParam("textColor")); 290 WebInspector.setToolbarColors(WebInspector.queryParam("toolbarColor" ), WebInspector.queryParam("textColor"));
290 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.E vents.SetToolbarColors, updateToolbarColors); 291 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.E vents.SetToolbarColors, updateToolbarColors);
291 /** 292 /**
292 * @param {!WebInspector.Event} event 293 * @param {!WebInspector.Event} event
293 */ 294 */
294 function updateToolbarColors(event) 295 function updateToolbarColors(event)
295 { 296 {
296 WebInspector.setToolbarColors(/** @type {string} */ (event.data["bac kgroundColor"]), /** @type {string} */ (event.data["color"])); 297 WebInspector.setToolbarColors(/** @type {string} */ (event.data["bac kgroundColor"]), /** @type {string} */ (event.data["color"]));
297 } 298 }
298 WebInspector.ContextMenu.initialize(); 299 WebInspector.ContextMenu.initialize();
299
300 WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), c onnection, this._mainTargetCreated.bind(this)); 300 WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), c onnection, this._mainTargetCreated.bind(this));
301 WebInspector.isolatedFileSystemManager = new WebInspector.IsolatedFileSy stemManager(); 301 WebInspector.isolatedFileSystemManager = new WebInspector.IsolatedFileSy stemManager();
302 WebInspector.workspace = new WebInspector.Workspace(WebInspector.isolate dFileSystemManager.mapping()); 302 WebInspector.workspace = new WebInspector.Workspace(WebInspector.isolate dFileSystemManager.mapping());
303 WebInspector.networkWorkspaceBinding = new WebInspector.NetworkWorkspace Binding(WebInspector.workspace); 303 WebInspector.networkWorkspaceBinding = new WebInspector.NetworkWorkspace Binding(WebInspector.workspace);
304 new WebInspector.NetworkUISourceCodeProvider(WebInspector.networkWorkspa ceBinding, WebInspector.workspace); 304 new WebInspector.NetworkUISourceCodeProvider(WebInspector.networkWorkspa ceBinding, WebInspector.workspace);
305 new WebInspector.PresentationConsoleMessageHelper(WebInspector.workspace ); 305 new WebInspector.PresentationConsoleMessageHelper(WebInspector.workspace );
306 WebInspector.fileSystemWorkspaceBinding = new WebInspector.FileSystemWor kspaceBinding(WebInspector.isolatedFileSystemManager, WebInspector.workspace); 306 WebInspector.fileSystemWorkspaceBinding = new WebInspector.FileSystemWor kspaceBinding(WebInspector.isolatedFileSystemManager, WebInspector.workspace);
307 WebInspector.breakpointManager = new WebInspector.BreakpointManager(WebI nspector.settings.breakpoints, WebInspector.workspace, WebInspector.targetManage r); 307 WebInspector.breakpointManager = new WebInspector.BreakpointManager(WebI nspector.settings.breakpoints, WebInspector.workspace, WebInspector.targetManage r);
308 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(We bInspector.workspace); 308 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(We bInspector.workspace);
309 this._executionContextSelector = new WebInspector.ExecutionContextSelect or(); 309 this._executionContextSelector = new WebInspector.ExecutionContextSelect or();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 new WebInspector.RenderingOptions(); 361 new WebInspector.RenderingOptions();
362 new WebInspector.Main.PauseListener(); 362 new WebInspector.Main.PauseListener();
363 new WebInspector.Main.WarningErrorCounter(); 363 new WebInspector.Main.WarningErrorCounter();
364 new WebInspector.Main.InspectedNodeRevealer(); 364 new WebInspector.Main.InspectedNodeRevealer();
365 365
366 this._addMainEventListeners(document); 366 this._addMainEventListeners(document);
367 367
368 var errorWarningCount = document.getElementById("error-warning-count"); 368 var errorWarningCount = document.getElementById("error-warning-count");
369 function showConsole() 369 function showConsole()
370 { 370 {
371 WebInspector.consoleModel.show(); 371 WebInspector.console.show();
372 } 372 }
373 errorWarningCount.addEventListener("click", showConsole, false); 373 errorWarningCount.addEventListener("click", showConsole, false);
374 374
375 WebInspector.extensionServerProxy.setFrontendReady(); 375 WebInspector.extensionServerProxy.setFrontendReady();
376 376
377 InspectorAgent.enable(inspectorAgentEnableCallback); 377 InspectorAgent.enable(inspectorAgentEnableCallback);
378 378
379 function inspectorAgentEnableCallback() 379 function inspectorAgentEnableCallback()
380 { 380 {
381 console.timeStamp("Main.inspectorAgentEnableCallback"); 381 console.timeStamp("Main.inspectorAgentEnableCallback");
(...skipping 25 matching lines...) Expand all
407 { 407 {
408 WebInspector.console.addEventListener(WebInspector.Console.Events.Messag eAdded, messageAdded); 408 WebInspector.console.addEventListener(WebInspector.Console.Events.Messag eAdded, messageAdded);
409 409
410 /** 410 /**
411 * @param {!WebInspector.Event} event 411 * @param {!WebInspector.Event} event
412 */ 412 */
413 function messageAdded(event) 413 function messageAdded(event)
414 { 414 {
415 var message = /** @type {!WebInspector.Console.Message} */ (event.da ta); 415 var message = /** @type {!WebInspector.Console.Message} */ (event.da ta);
416 if (message.show) 416 if (message.show)
417 WebInspector.consoleModel.show(); 417 WebInspector.console.show();
418 } 418 }
419 }, 419 },
420 420
421 _documentClick: function(event) 421 _documentClick: function(event)
422 { 422 {
423 var anchor = event.target.enclosingNodeOrSelfWithNodeName("a"); 423 var anchor = event.target.enclosingNodeOrSelfWithNodeName("a");
424 if (!anchor || !anchor.href) 424 if (!anchor || !anchor.href)
425 return; 425 return;
426 426
427 // Prevent the link from navigating, since we don't do any navigation by following links normally. 427 // Prevent the link from navigating, since we don't do any navigation by following links normally.
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 * @param {string} name 828 * @param {string} name
829 * @return {?WebInspector.Panel} 829 * @return {?WebInspector.Panel}
830 */ 830 */
831 WebInspector.panel = function(name) 831 WebInspector.panel = function(name)
832 { 832 {
833 return WebInspector.inspectorView.panel(name); 833 return WebInspector.inspectorView.panel(name);
834 } 834 }
835 835
836 /** 836 /**
837 * @constructor 837 * @constructor
838 * @implements {WebInspector.TargetManager.Observer}
839 */ 838 */
840 WebInspector.Main.WarningErrorCounter = function() 839 WebInspector.Main.WarningErrorCounter = function()
841 { 840 {
842 WebInspector.targetManager.observeTargets(this); 841 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this);
842 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageAdded, this._updateErrorAndWarningCounts, this);
843 } 843 }
844 844
845 WebInspector.Main.WarningErrorCounter.prototype = { 845 WebInspector.Main.WarningErrorCounter.prototype = {
846 /**
847 * @param {!WebInspector.Target} target
848 */
849 targetAdded: function(target)
850 {
851 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co nsoleCleared, this._updateErrorAndWarningCounts, this);
852 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Me ssageAdded, this._updateErrorAndWarningCounts, this);
853 this._updateErrorAndWarningCounts();
854 },
855
856 /**
857 * @param {!WebInspector.Target} target
858 */
859 targetRemoved: function(target)
860 {
861 target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events .ConsoleCleared, this._updateErrorAndWarningCounts, this);
862 target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events .MessageAdded, this._updateErrorAndWarningCounts, this);
863 },
864
865 _updateErrorAndWarningCounts: function() 846 _updateErrorAndWarningCounts: function()
866 { 847 {
867 var errors = 0; 848 var errors = 0;
868 var warnings = 0; 849 var warnings = 0;
869 var targets = WebInspector.targetManager.targets(); 850 var targets = WebInspector.targetManager.targets();
870 for (var i = 0; i < targets.length; ++i) { 851 for (var i = 0; i < targets.length; ++i) {
871 errors = errors + targets[i].consoleModel.errors; 852 errors = errors + targets[i].consoleModel.errors;
872 warnings = warnings + targets[i].consoleModel.warnings; 853 warnings = warnings + targets[i].consoleModel.warnings;
873 } 854 }
874 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings); 855 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 }, 925 },
945 926
946 /** 927 /**
947 * @param {!WebInspector.Event} event 928 * @param {!WebInspector.Event} event
948 */ 929 */
949 _inspectNode: function(event) 930 _inspectNode: function(event)
950 { 931 {
951 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data)); 932 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data));
952 } 933 }
953 } 934 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/main/App.js ('k') | Source/devtools/front_end/profiler/CPUProfileView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698