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

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

Issue 283063003: DevTools: Implement extension-based status bar buttons (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated patch Created 6 years, 6 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } else { 56 } else {
57 configuration = ["components", "main", "elements", "network", "sourc es", "timeline", "profiler", "resources", "audits", "console", "source_frame", " extensions", "settings", "search"]; 57 configuration = ["components", "main", "elements", "network", "sourc es", "timeline", "profiler", "resources", "audits", "console", "source_frame", " extensions", "settings", "search"];
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()) 60 if (WebInspector.experimentsSettings.devicesPanel.isEnabled())
61 configuration.push("devices"); 61 configuration.push("devices");
62 } 62 }
63 WebInspector.moduleManager.registerModules(configuration); 63 WebInspector.moduleManager.registerModules(configuration);
64 }, 64 },
65 65
66 _createGlobalStatusBarItems: function()
67 {
68 var extensions = WebInspector.moduleManager.extensions(WebInspector.Stat usBarButton.Provider);
69 extensions.forEach(function(extension) {
70 var button;
71 switch (extension.descriptor()["location"]) {
72 case "toolbar-left":
73 button = createButton(extension);
74 if (button)
75 WebInspector.inspectorView.appendToLeftToolbar(button.elemen t);
76 break;
77 case "toolbar-right":
78 button = createButton(extension);
79 if (button)
80 WebInspector.inspectorView.appendToRightToolbar(button.eleme nt);
81 break;
82 }
83 if (button && extension.descriptor()["actionId"]) {
84 button.addEventListener("click", function() {
85 WebInspector.actionRegistry.execute(extension.descriptor()["a ctionId"]);
86 });
87 }
88 });
89
90 function createButton(extension)
91 {
92 var descriptor = extension.descriptor();
93 if (descriptor.className)
94 return extension.instance().button();
95 return new WebInspector.StatusBarButton(WebInspector.UIString(descri ptor["title"]), descriptor["elementClass"]);
96 }
97 },
98
66 _calculateWorkerInspectorTitle: function() 99 _calculateWorkerInspectorTitle: function()
67 { 100 {
68 var expression = "location.href"; 101 var expression = "location.href";
69 if (WebInspector.queryParam("isSharedWorker")) 102 if (WebInspector.queryParam("isSharedWorker"))
70 expression += " + (this.name ? ' (' + this.name + ')' : '')"; 103 expression += " + (this.name ? ' (' + this.name + ')' : '')";
71 RuntimeAgent.invoke_evaluate({expression:expression, doNotPauseOnExcepti onsAndMuteConsole:true, returnByValue: true}, evalCallback); 104 RuntimeAgent.invoke_evaluate({expression:expression, doNotPauseOnExcepti onsAndMuteConsole:true, returnByValue: true}, evalCallback);
72 105
73 /** 106 /**
74 * @param {?Protocol.Error} error 107 * @param {?Protocol.Error} error
75 * @param {!RuntimeAgent.RemoteObject} result 108 * @param {!RuntimeAgent.RemoteObject} result
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 { 263 {
231 WebInspector.dockController = new WebInspector.DockController(!!WebInspe ctor.queryParam("can_dock")); 264 WebInspector.dockController = new WebInspector.DockController(!!WebInspe ctor.queryParam("can_dock"));
232 265
233 if (mainTarget.canScreencast) 266 if (mainTarget.canScreencast)
234 WebInspector.app = new WebInspector.ScreencastApp(); 267 WebInspector.app = new WebInspector.ScreencastApp();
235 else if (WebInspector.dockController.canDock()) 268 else if (WebInspector.dockController.canDock())
236 WebInspector.app = new WebInspector.AdvancedApp(); 269 WebInspector.app = new WebInspector.AdvancedApp();
237 else 270 else
238 WebInspector.app = new WebInspector.SimpleApp(); 271 WebInspector.app = new WebInspector.SimpleApp();
239 272
240 WebInspector.dockController.initialize();
241
242 new WebInspector.VersionController().updateVersion(); 273 new WebInspector.VersionController().updateVersion();
243 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); 274 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
244 this._registerShortcuts(); 275 this._registerShortcuts();
245 276
246 // set order of some sections explicitly 277 // set order of some sections explicitly
247 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); 278 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));
248 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Pan el")); 279 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Pan el"));
249 WebInspector.ShortcutsScreen.registerShortcuts(); 280 WebInspector.ShortcutsScreen.registerShortcuts();
250 281
251 if (WebInspector.experimentsSettings.workersInMainWindow.isEnabled()) 282 if (WebInspector.experimentsSettings.workersInMainWindow.isEnabled())
(...skipping 25 matching lines...) Expand all
277 */ 308 */
278 function hideScreen(screen) 309 function hideScreen(screen)
279 { 310 {
280 mainTarget.debuggerModel.removeEventListener(WebInspector.Debugg erModel.Events.GlobalObjectCleared, listener); 311 mainTarget.debuggerModel.removeEventListener(WebInspector.Debugg erModel.Events.GlobalObjectCleared, listener);
281 screen.hide(); 312 screen.hide();
282 } 313 }
283 314
284 screen.showModal(); 315 screen.showModal();
285 } 316 }
286 317
287 WebInspector.settingsController = new WebInspector.SettingsController();
288
289 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints SidebarPane(); 318 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints SidebarPane();
290 319
291 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall y"); 320 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall y");
292 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope nLinkHandler", autoselectPanel); 321 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope nLinkHandler", autoselectPanel);
293 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist ry(openAnchorLocationSetting); 322 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist ry(openAnchorLocationSetting);
294 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; }); 323 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; });
295 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L inkHandler()); 324 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L inkHandler());
296 325
297 new WebInspector.WorkspaceController(WebInspector.workspace); 326 new WebInspector.WorkspaceController(WebInspector.workspace);
298 327
299 WebInspector.overridesSupport = new WebInspector.OverridesSupport(WebIns pector.experimentsSettings.responsiveDesign.isEnabled() && WebInspector.dockCont roller.canDock()); 328 WebInspector.overridesSupport = new WebInspector.OverridesSupport(WebIns pector.experimentsSettings.responsiveDesign.isEnabled() && WebInspector.dockCont roller.canDock());
300 329
301 WebInspector.liveEditSupport = new WebInspector.LiveEditSupport(WebInspe ctor.workspace); 330 WebInspector.liveEditSupport = new WebInspector.LiveEditSupport(WebInspe ctor.workspace);
302 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto r.workspace, WebInspector.networkWorkspaceBinding); 331 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto r.workspace, WebInspector.networkWorkspaceBinding);
303 332
304 // Create settings before loading modules. 333 // Create settings before loading modules.
305 WebInspector.settings.initializeBackendSettings(); 334 WebInspector.settings.initializeBackendSettings();
306 335
307 this._registerModules(); 336 this._registerModules();
308 WebInspector.actionRegistry = new WebInspector.ActionRegistry(); 337 WebInspector.actionRegistry = new WebInspector.ActionRegistry();
309 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns pector.actionRegistry); 338 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns pector.actionRegistry);
310 this._registerForwardedShortcuts(); 339 this._registerForwardedShortcuts();
311 this._registerMessageSinkListener(); 340 this._registerMessageSinkListener();
312 341
313 WebInspector.zoomManager = new WebInspector.ZoomManager(); 342 WebInspector.zoomManager = new WebInspector.ZoomManager();
314 WebInspector.inspectorView = new WebInspector.InspectorView(); 343 WebInspector.inspectorView = new WebInspector.InspectorView();
315 WebInspector.app.createRootView(); 344 WebInspector.app.createRootView();
316 WebInspector.app.createGlobalStatusBarItems(); 345 this._createGlobalStatusBarItems();
317 346
318 this._addMainEventListeners(document); 347 this._addMainEventListeners(document);
319 348
320 function onResize()
321 {
322 if (WebInspector.settingsController)
323 WebInspector.settingsController.resize();
324 }
325 window.addEventListener("resize", onResize, true);
326
327 var errorWarningCount = document.getElementById("error-warning-count"); 349 var errorWarningCount = document.getElementById("error-warning-count");
328 350
329 function showConsole() 351 function showConsole()
330 { 352 {
331 WebInspector.console.show(); 353 WebInspector.console.show();
332 } 354 }
333 errorWarningCount.addEventListener("click", showConsole, false); 355 errorWarningCount.addEventListener("click", showConsole, false);
334 this._updateErrorAndWarningCounts(); 356 this._updateErrorAndWarningCounts();
335 357
336 WebInspector.extensionServerProxy.setFrontendReady(); 358 WebInspector.extensionServerProxy.setFrontendReady();
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 796
775 WebInspector.__defineGetter__("inspectedPageURL", function() 797 WebInspector.__defineGetter__("inspectedPageURL", function()
776 { 798 {
777 return WebInspector.resourceTreeModel.inspectedPageURL(); 799 return WebInspector.resourceTreeModel.inspectedPageURL();
778 }); 800 });
779 801
780 WebInspector.panel = function(name) 802 WebInspector.panel = function(name)
781 { 803 {
782 return WebInspector.inspectorView.panel(name); 804 return WebInspector.inspectorView.panel(name);
783 } 805 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698