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

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

Issue 663083004: [DevTools] Remove remaining usages of global properties. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed review comments Created 6 years, 2 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
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TracingTimelineUIUtils.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 else if (extensions[i].descriptor()["location"] === "toolbar-rig ht") 122 else if (extensions[i].descriptor()["location"] === "toolbar-rig ht")
123 WebInspector.inspectorView.appendToRightToolbar(item); 123 WebInspector.inspectorView.appendToRightToolbar(item);
124 } 124 }
125 } 125 }
126 }, 126 },
127 127
128 _loaded: function() 128 _loaded: function()
129 { 129 {
130 console.timeStamp("Main._loaded"); 130 console.timeStamp("Main._loaded");
131 131
132 WebInspector.initializeUIUtils();
133 this._createSettings(); 132 this._createSettings();
134 this._createAppUI(); 133 this._createAppUI();
135 }, 134 },
136 135
137 _createSettings: function() 136 _createSettings: function()
138 { 137 {
139 WebInspector.settings = new WebInspector.Settings(); 138 WebInspector.settings = new WebInspector.Settings();
140 this._initializeExperiments(); 139 this._initializeExperiments();
141 140
142 // This setting is needed for backwards compatibility with Devtools Code School extension. DO NOT REMOVE 141 // This setting is needed for backwards compatibility with Devtools Code School extension. DO NOT REMOVE
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 Runtime.experiments.enableForTest("documentation"); 174 Runtime.experiments.enableForTest("documentation");
176 } else { 175 } else {
177 Runtime.experiments.setDefaultExperiments([ 176 Runtime.experiments.setDefaultExperiments([
178 "timelineOnTraceEvents", 177 "timelineOnTraceEvents",
179 "disableAgentsWhenProfile", 178 "disableAgentsWhenProfile",
180 "timelineJSCPUProfile", 179 "timelineJSCPUProfile",
181 ]); 180 ]);
182 } 181 }
183 }, 182 },
184 183
184 /**
185 * @private // FIXME: this is a workaround for validator bug (http://crbug.c om/425506).
186 * @suppressGlobalPropertiesCheck
187 */
185 _createAppUI: function() 188 _createAppUI: function()
186 { 189 {
187 console.timeStamp("Main._createApp"); 190 console.timeStamp("Main._createApp");
188 191
189 WebInspector.installPortStyles(); 192 WebInspector.initializeUIUtils(window);
193 WebInspector.installPortStyles(document);
190 if (Runtime.queryParam("toolbarColor") && Runtime.queryParam("textColor" )) 194 if (Runtime.queryParam("toolbarColor") && Runtime.queryParam("textColor" ))
191 WebInspector.setToolbarColors(Runtime.queryParam("toolbarColor"), Ru ntime.queryParam("textColor")); 195 WebInspector.setToolbarColors(document, /** @type {string} */ (Runti me.queryParam("toolbarColor")), /** @type {string} */ (Runtime.queryParam("textC olor")));
192 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.E vents.SetToolbarColors, updateToolbarColors); 196 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.E vents.SetToolbarColors, updateToolbarColors);
193 /** 197 /**
194 * @param {!WebInspector.Event} event 198 * @param {!WebInspector.Event} event
199 * @suppressGlobalPropertiesCheck
195 */ 200 */
196 function updateToolbarColors(event) 201 function updateToolbarColors(event)
197 { 202 {
198 WebInspector.setToolbarColors(/** @type {string} */ (event.data["bac kgroundColor"]), /** @type {string} */ (event.data["color"])); 203 WebInspector.setToolbarColors(document, /** @type {string} */ (event .data["backgroundColor"]), /** @type {string} */ (event.data["color"]));
199 } 204 }
200 205
201 this._addMainEventListeners(); 206 this._addMainEventListeners(document);
202 207
203 var canDock = !!Runtime.queryParam("can_dock"); 208 var canDock = !!Runtime.queryParam("can_dock");
204 WebInspector.zoomManager = new WebInspector.ZoomManager(InspectorFronten dHost); 209 WebInspector.zoomManager = new WebInspector.ZoomManager(window, Inspecto rFrontendHost);
205 WebInspector.inspectorView = new WebInspector.InspectorView(); 210 WebInspector.inspectorView = new WebInspector.InspectorView();
206 WebInspector.ContextMenu.initialize(); 211 WebInspector.ContextMenu.initialize();
207 WebInspector.ContextMenu.installHandler(document); 212 WebInspector.ContextMenu.installHandler(document);
208 WebInspector.dockController = new WebInspector.DockController(canDock); 213 WebInspector.dockController = new WebInspector.DockController(canDock);
209 WebInspector.overridesSupport = new WebInspector.OverridesSupport(canDoc k); 214 WebInspector.overridesSupport = new WebInspector.OverridesSupport(canDoc k);
210 WebInspector.multitargetConsoleModel = new WebInspector.MultitargetConso leModel(); 215 WebInspector.multitargetConsoleModel = new WebInspector.MultitargetConso leModel();
211 216
212 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); 217 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
213 // set order of some sections explicitly 218 // set order of some sections explicitly
214 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); 219 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));
(...skipping 20 matching lines...) Expand all
235 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; }); 240 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; });
236 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L inkHandler()); 241 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L inkHandler());
237 242
238 new WebInspector.WorkspaceController(WebInspector.workspace); 243 new WebInspector.WorkspaceController(WebInspector.workspace);
239 new WebInspector.RenderingOptions(); 244 new WebInspector.RenderingOptions();
240 new WebInspector.Main.PauseListener(); 245 new WebInspector.Main.PauseListener();
241 new WebInspector.Main.InspectedNodeRevealer(); 246 new WebInspector.Main.InspectedNodeRevealer();
242 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints SidebarPane(); 247 WebInspector.domBreakpointsSidebarPane = new WebInspector.DOMBreakpoints SidebarPane();
243 248
244 WebInspector.actionRegistry = new WebInspector.ActionRegistry(); 249 WebInspector.actionRegistry = new WebInspector.ActionRegistry();
245 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns pector.actionRegistry); 250 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns pector.actionRegistry, document);
246 WebInspector.ShortcutsScreen.registerShortcuts(); 251 WebInspector.ShortcutsScreen.registerShortcuts();
247 this._registerForwardedShortcuts(); 252 this._registerForwardedShortcuts();
248 this._registerMessageSinkListener(); 253 this._registerMessageSinkListener();
249 254
250 if (canDock) 255 if (canDock)
251 WebInspector.app = new WebInspector.AdvancedApp(); 256 WebInspector.app = new WebInspector.AdvancedApp();
252 else if (Runtime.queryParam("remoteFrontend")) 257 else if (Runtime.queryParam("remoteFrontend"))
253 WebInspector.app = new WebInspector.ScreencastApp(); 258 WebInspector.app = new WebInspector.ScreencastApp();
254 else 259 else
255 WebInspector.app = new WebInspector.SimpleApp(); 260 WebInspector.app = new WebInspector.SimpleApp();
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 panel["handlePasteEvent"](event); 536 panel["handlePasteEvent"](event);
532 }, 537 },
533 538
534 _contextMenuEventFired: function(event) 539 _contextMenuEventFired: function(event)
535 { 540 {
536 if (event.handled || event.target.classList.contains("popup-glasspane")) 541 if (event.handled || event.target.classList.contains("popup-glasspane"))
537 event.preventDefault(); 542 event.preventDefault();
538 }, 543 },
539 544
540 /** 545 /**
541 * @private // FIXME: this is a workaround for validator bug (crbug.com/4255 06). 546 * @param {!Document} document
542 * @suppressGlobalPropertiesCheck
543 */ 547 */
544 _addMainEventListeners: function() 548 _addMainEventListeners: function(document)
545 { 549 {
546 document.addEventListener("keydown", this._postDocumentKeyDown.bind(this ), false); 550 document.addEventListener("keydown", this._postDocumentKeyDown.bind(this ), false);
547 document.addEventListener("beforecopy", this._documentCanCopy.bind(this) , true); 551 document.addEventListener("beforecopy", this._documentCanCopy.bind(this) , true);
548 document.addEventListener("copy", this._documentCopy.bind(this), false); 552 document.addEventListener("copy", this._documentCopy.bind(this), false);
549 document.addEventListener("cut", this._documentCut.bind(this), false); 553 document.addEventListener("cut", this._documentCut.bind(this), false);
550 document.addEventListener("paste", this._documentPaste.bind(this), false ); 554 document.addEventListener("paste", this._documentPaste.bind(this), false );
551 document.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true); 555 document.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true);
552 document.addEventListener("click", this._documentClick.bind(this), false ); 556 document.addEventListener("click", this._documentClick.bind(this), false );
553 }, 557 },
554 558
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 /** 888 /**
885 * @param {!WebInspector.Event} event 889 * @param {!WebInspector.Event} event
886 */ 890 */
887 _inspectNode: function(event) 891 _inspectNode: function(event)
888 { 892 {
889 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data)); 893 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data));
890 } 894 }
891 } 895 }
892 896
893 new WebInspector.Main(); 897 new WebInspector.Main();
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TracingTimelineUIUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698