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

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

Issue 388963004: DevTools: get rid of the global capabilities set. (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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 this._loaded(); 44 this._loaded();
45 window.removeEventListener("DOMContentLoaded", boundListener, false); 45 window.removeEventListener("DOMContentLoaded", boundListener, false);
46 } 46 }
47 window.addEventListener("DOMContentLoaded", boundListener, false); 47 window.addEventListener("DOMContentLoaded", boundListener, false);
48 } 48 }
49 49
50 WebInspector.Main.prototype = { 50 WebInspector.Main.prototype = {
51 _registerModules: function() 51 _registerModules: function()
52 { 52 {
53 var configuration; 53 var configuration;
54 if (!Capabilities.isMainFrontend) { 54 if (WebInspector.isWorkerFrontend()) {
55 configuration = ["main", "sources", "timeline", "profiler", "console ", "source_frame"]; 55 configuration = ["main", "sources", "timeline", "profiler", "console ", "source_frame"];
56 } else { 56 } else {
57 configuration = ["main", "elements", "network", "sources", "timeline ", "profiler", "resources", "audits", "console", "source_frame", "extensions", " settings"]; 57 configuration = ["main", "elements", "network", "sources", "timeline ", "profiler", "resources", "audits", "console", "source_frame", "extensions", " settings"];
58 if (WebInspector.experimentsSettings.layersPanel.isEnabled()) 58 if (WebInspector.experimentsSettings.layersPanel.isEnabled())
59 configuration.push("layers"); 59 configuration.push("layers");
60 if (WebInspector.experimentsSettings.devicesPanel.isEnabled() && !We bInspector.targetManager.activeTarget().isMobile()) 60 if (WebInspector.experimentsSettings.devicesPanel.isEnabled() && !We bInspector.targetManager.activeTarget().isMobile())
61 configuration.push("devices"); 61 configuration.push("devices");
62 } 62 }
63 WebInspector.moduleManager.registerModules(configuration); 63 WebInspector.moduleManager.registerModules(configuration);
64 }, 64 },
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 RuntimeAgent.isRunRequired(isRunRequiredCallback.bind(this)); 139 RuntimeAgent.isRunRequired(isRunRequiredCallback.bind(this));
140 } 140 }
141 141
142 /** 142 /**
143 * @this {WebInspector.Main} 143 * @this {WebInspector.Main}
144 */ 144 */
145 function isRunRequiredCallback(error, result) 145 function isRunRequiredCallback(error, result)
146 { 146 {
147 if (result) { 147 if (result) {
148 pauseAndResume.call(this); 148 pauseAndResume.call(this);
149 } else if (!Capabilities.isMainFrontend) { 149 } else if (WebInspector.isWorkerFrontend()) {
150 calculateTitle.call(this); 150 calculateTitle.call(this);
151 } 151 }
152 } 152 }
153 153
154 /** 154 /**
155 * @this {WebInspector.Main} 155 * @this {WebInspector.Main}
156 */ 156 */
157 function pauseAndResume() 157 function pauseAndResume()
158 { 158 {
159 DebuggerAgent.pause(); 159 DebuggerAgent.pause();
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 /** 286 /**
287 * @param {!WebInspector.Target} mainTarget 287 * @param {!WebInspector.Target} mainTarget
288 */ 288 */
289 _mainTargetCreated: function(mainTarget) 289 _mainTargetCreated: function(mainTarget)
290 { 290 {
291 console.timeStamp("Main._mainTargetCreated"); 291 console.timeStamp("Main._mainTargetCreated");
292 WebInspector.dockController = new WebInspector.DockController(!!WebInspe ctor.queryParam("can_dock")); 292 WebInspector.dockController = new WebInspector.DockController(!!WebInspe ctor.queryParam("can_dock"));
293 WebInspector.overridesSupport = new WebInspector.OverridesSupport(WebIns pector.dockController.canDock()); 293 WebInspector.overridesSupport = new WebInspector.OverridesSupport(WebIns pector.dockController.canDock());
294 294
295 if (mainTarget.canScreencast) 295 if (mainTarget.hasCapability(WebInspector.Target.Capabilities.canScreenc ast))
296 WebInspector.app = new WebInspector.ScreencastApp(); 296 WebInspector.app = new WebInspector.ScreencastApp();
297 else if (WebInspector.dockController.canDock()) 297 else if (WebInspector.dockController.canDock())
298 WebInspector.app = new WebInspector.AdvancedApp(); 298 WebInspector.app = new WebInspector.AdvancedApp();
299 else 299 else
300 WebInspector.app = new WebInspector.SimpleApp(); 300 WebInspector.app = new WebInspector.SimpleApp();
301 301
302 WebInspector.dockController.initialize(); 302 WebInspector.dockController.initialize();
303 303
304 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); 304 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
305 this._registerShortcuts(); 305 this._registerShortcuts();
306 306
307 // set order of some sections explicitly 307 // set order of some sections explicitly
308 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); 308 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));
309 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Pan el")); 309 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Pan el"));
310 310
311 if (WebInspector.experimentsSettings.workersInMainWindow.isEnabled()) 311 if (WebInspector.experimentsSettings.workersInMainWindow.isEnabled())
312 WebInspector.workerTargetManager = new WebInspector.WorkerTargetMana ger(mainTarget, WebInspector.targetManager); 312 WebInspector.workerTargetManager = new WebInspector.WorkerTargetMana ger(mainTarget, WebInspector.targetManager);
313 313
314 WebInspector.consoleModel.addEventListener(WebInspector.ConsoleModel.Eve nts.ConsoleCleared, this._resetErrorAndWarningCounts, this); 314 WebInspector.consoleModel.addEventListener(WebInspector.ConsoleModel.Eve nts.ConsoleCleared, this._resetErrorAndWarningCounts, this);
315 WebInspector.consoleModel.addEventListener(WebInspector.ConsoleModel.Eve nts.MessageAdded, this._updateErrorAndWarningCounts, this); 315 WebInspector.consoleModel.addEventListener(WebInspector.ConsoleModel.Eve nts.MessageAdded, this._updateErrorAndWarningCounts, this);
316 316
317 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.E vents.DebuggerPaused, this._debuggerPaused, this); 317 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.E vents.DebuggerPaused, this._debuggerPaused, this);
318 318
319 InspectorBackend.registerInspectorDispatcher(this); 319 InspectorBackend.registerInspectorDispatcher(this);
320 320
321 if (Capabilities.isMainFrontend) { 321 if (!WebInspector.isWorkerFrontend()) {
322 WebInspector.inspectElementModeController = new WebInspector.Inspect ElementModeController(); 322 WebInspector.inspectElementModeController = new WebInspector.Inspect ElementModeController();
323 WebInspector.workerFrontendManager = new WebInspector.WorkerFrontend Manager(); 323 WebInspector.workerFrontendManager = new WebInspector.WorkerFrontend Manager();
324 } else { 324 } else {
325 mainTarget.workerManager.addEventListener(WebInspector.WorkerManager .Events.WorkerDisconnected, onWorkerDisconnected); 325 mainTarget.workerManager.addEventListener(WebInspector.WorkerManager .Events.WorkerDisconnected, onWorkerDisconnected);
326 } 326 }
327 327
328 function onWorkerDisconnected() 328 function onWorkerDisconnected()
329 { 329 {
330 var screen = new WebInspector.WorkerTerminatedScreen(); 330 var screen = new WebInspector.WorkerTerminatedScreen();
331 var listener = hideScreen.bind(null, screen); 331 var listener = hideScreen.bind(null, screen);
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 }); 828 });
829 829
830 /** 830 /**
831 * @param {string} name 831 * @param {string} name
832 * @return {?WebInspector.Panel} 832 * @return {?WebInspector.Panel}
833 */ 833 */
834 WebInspector.panel = function(name) 834 WebInspector.panel = function(name)
835 { 835 {
836 return WebInspector.inspectorView.panel(name); 836 return WebInspector.inspectorView.panel(name);
837 } 837 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698