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

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

Issue 1264133002: Devtools: [WIP] Implement enhanced devtools extension language APIs Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modify override dropdown to apply to console completions & transpile Created 5 years, 4 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
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 WebInspector.fileManager = new WebInspector.FileManager(); 203 WebInspector.fileManager = new WebInspector.FileManager();
204 WebInspector.isolatedFileSystemManager = new WebInspector.IsolatedFileSy stemManager(); 204 WebInspector.isolatedFileSystemManager = new WebInspector.IsolatedFileSy stemManager();
205 WebInspector.workspace = new WebInspector.Workspace(WebInspector.isolate dFileSystemManager.mapping()); 205 WebInspector.workspace = new WebInspector.Workspace(WebInspector.isolate dFileSystemManager.mapping());
206 WebInspector.networkMapping = new WebInspector.NetworkMapping(WebInspect or.workspace, WebInspector.isolatedFileSystemManager.mapping()); 206 WebInspector.networkMapping = new WebInspector.NetworkMapping(WebInspect or.workspace, WebInspector.isolatedFileSystemManager.mapping());
207 WebInspector.networkProjectManager = new WebInspector.NetworkProjectMana ger(WebInspector.targetManager, WebInspector.workspace, WebInspector.networkMapp ing); 207 WebInspector.networkProjectManager = new WebInspector.NetworkProjectMana ger(WebInspector.targetManager, WebInspector.workspace, WebInspector.networkMapp ing);
208 WebInspector.presentationConsoleMessageHelper = new WebInspector.Present ationConsoleMessageHelper(WebInspector.workspace); 208 WebInspector.presentationConsoleMessageHelper = new WebInspector.Present ationConsoleMessageHelper(WebInspector.workspace);
209 WebInspector.cssWorkspaceBinding = new WebInspector.CSSWorkspaceBinding( WebInspector.targetManager, WebInspector.workspace, WebInspector.networkMapping) ; 209 WebInspector.cssWorkspaceBinding = new WebInspector.CSSWorkspaceBinding( WebInspector.targetManager, WebInspector.workspace, WebInspector.networkMapping) ;
210 WebInspector.debuggerWorkspaceBinding = new WebInspector.DebuggerWorkspa ceBinding(WebInspector.targetManager, WebInspector.workspace, WebInspector.netwo rkMapping); 210 WebInspector.debuggerWorkspaceBinding = new WebInspector.DebuggerWorkspa ceBinding(WebInspector.targetManager, WebInspector.workspace, WebInspector.netwo rkMapping);
211 WebInspector.fileSystemWorkspaceBinding = new WebInspector.FileSystemWor kspaceBinding(WebInspector.isolatedFileSystemManager, WebInspector.workspace, We bInspector.networkMapping); 211 WebInspector.fileSystemWorkspaceBinding = new WebInspector.FileSystemWor kspaceBinding(WebInspector.isolatedFileSystemManager, WebInspector.workspace, We bInspector.networkMapping);
212 WebInspector.breakpointManager = new WebInspector.BreakpointManager(null , WebInspector.workspace, WebInspector.networkMapping, WebInspector.targetManage r, WebInspector.debuggerWorkspaceBinding); 212 WebInspector.breakpointManager = new WebInspector.BreakpointManager(null , WebInspector.workspace, WebInspector.networkMapping, WebInspector.targetManage r, WebInspector.debuggerWorkspaceBinding);
213 WebInspector.extensionServer = new WebInspector.ExtensionServer(); 213 WebInspector.extensionServer = new WebInspector.ExtensionServer(new WebI nspector.ExtensionServer.UIDelegateImpl());
214 214
215 new WebInspector.OverlayController(); 215 new WebInspector.OverlayController();
216 new WebInspector.ContentScriptProjectDecorator(); 216 new WebInspector.ContentScriptProjectDecorator();
217 new WebInspector.ExecutionContextSelector(WebInspector.targetManager, We bInspector.context); 217 new WebInspector.ExecutionContextSelector(WebInspector.targetManager, We bInspector.context);
218 218
219 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall y"); 219 var autoselectPanel = WebInspector.UIString("a panel chosen automaticall y");
220 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope nLinkHandler", autoselectPanel); 220 var openAnchorLocationSetting = WebInspector.settings.createSetting("ope nLinkHandler", autoselectPanel);
221 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist ry(openAnchorLocationSetting); 221 WebInspector.openAnchorLocationRegistry = new WebInspector.HandlerRegist ry(openAnchorLocationSetting);
222 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; }); 222 WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel, function() { return false; });
223 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L inkHandler()); 223 WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.L inkHandler());
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 var p = this.helpContentElement.createChild("p"); 837 var p = this.helpContentElement.createChild("p");
838 p.classList.add("help-section"); 838 p.classList.add("help-section");
839 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once it restarts we will attach to it automatically."); 839 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once it restarts we will attach to it automatically.");
840 } 840 }
841 841
842 WebInspector.WorkerTerminatedScreen.prototype = { 842 WebInspector.WorkerTerminatedScreen.prototype = {
843 843
844 __proto__: WebInspector.HelpScreen.prototype 844 __proto__: WebInspector.HelpScreen.prototype
845 } 845 }
846 846
847 // TODO: Expose the 'sources' panel features more cleanly; files are
pfeldman 2015/08/13 21:15:46 This needs to use runtime DI
wes 2015/08/14 00:55:05 It can also probably be moved out of Main and back
848 // opened via the `WebInspector.Revealer` construct (which does similar things
849 // to the below) - we need something similar for each of these, probably.
850 /**
851 * @constructor
852 * @implements {WebInspector.ExtensionServer.UIDelegate}
853 */
854 WebInspector.ExtensionServer.UIDelegateImpl = function() {}
855 WebInspector.ExtensionServer.UIDelegateImpl.prototype = {
856 /**
857 * @override
858 * @param {!WebInspector.UISourceCode} code
859 * @param {!Array<{kind: string, text: string, location: {startLine: number, startColumn: number, endLine: number, endColumn: number}}>} messages
860 * @suppress {missingProperties}
861 */
862 setResourceLineMessages: function(code, messages) {
863 self.runtime.loadModulePromise("sources").then(function() { //sources is n't autoloaded, but it tracks line messages - load it
pfeldman 2015/08/13 21:15:46 For example check out UISourceCode revealers (Reve
wes 2015/08/14 00:55:05 I actually mentioned that class in my TODO above.
pfeldman 2015/08/17 21:15:51 I think we need to introduce proper markers the UI
wes 2015/08/25 18:13:18 IMO, binding messages to lines is very limiting. I
864 var frame = WebInspector.SourcesPanel.instance().sourcesView().viewF orFile(code);
865 frame.setMessagesForSource(messages.map(function(m){
866 return new WebInspector.SourceFrameMessage(m.text, WebInspector. SourceFrameMessage.Level[m.kind], {
867 line: m.location.startLine,
868 column: m.location.startColumn
869 }, {
870 line: m.location.endLine,
871 column: m.location.endColumn
872 });
873 }));
874 });
875 },
876
877 /**
878 * @override
879 * @param {!WebInspector.UISourceCode} code
880 * @return {!Promise<!SourceFrameMessageGetter>}
881 * @suppress {missingProperties}
882 */
883 getResourceLineMessages: function(code) {
wes 2015/08/14 00:55:05 We mentioned removing the `get` line messages (and
884 return self.runtime.loadModulePromise("sources").then(function() {
885 var frame = WebInspector.SourcesPanel.instance().sourcesView().viewF orFile(code);
886 return /** @type {!SourceFrameMessageGetter} */ (frame.getMessagesFr omSource());
887 });
888 },
889
890 /**
891 * @override
892 * @param {string} highlightText
893 * @param {!Array<!SearchResultArray>} groupedResults
894 * @suppress {missingProperties}
895 */
896 displaySearchResults: function(highlightText, groupedResults) {
897 //TODO: remove private refs, replace with (likely new) public ones
898 self.runtime.loadModulePromise("sources").then(function() { //sources is n't autoloaded - ensure it exists since we're about to swap to it!
899 var searchResultsPanel = WebInspector.AdvancedSearchView._instance;
900 if (!searchResultsPanel) {
901 searchResultsPanel = new WebInspector.AdvancedSearchView();
902 }
903
904 searchResultsPanel._nothingFound();
905 searchResultsPanel._searchConfig = new WebInspector.SearchConfig(hig hlightText, true, false); //TODO: HACK - really should be able to highlight arbi trary spans
906 searchResultsPanel._searchResultsPane = searchResultsPanel._searchSc ope.createSearchResultsPane(searchResultsPanel._searchConfig);
907 searchResultsPanel._resetResults();
908 searchResultsPanel._searchResultsElement.appendChild(searchResultsPa nel._searchResultsPane.element);
909
910
911 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel .instance());
912 WebInspector.inspectorView.showViewInDrawer("sources.search");
913
914 groupedResults.map(function(sourceResult) { //map to file search res ult
915 var code = WebInspector.networkMapping.uiSourceCodeFromURL(sourc eResult.source);
916 if (!code) {
917 return;
918 }
919 return new WebInspector.FileBasedSearchResult(
920 code,
921 sourceResult.map(function(item){
922 return new WebInspector.ContentProvider.SearchMatch(item .line, item.lineContent);
923 })
924 );
925 }).forEach(function(searchResult) {
926 if (!searchResult) return;
927 searchResultsPanel._addSearchResult(searchResult);
928 searchResultsPanel._searchResultsPane.addSearchResult(searchResu lt);
929 });
930 });
931 },
932
933 /**
934 * @override
935 * @param {!Array<string>} mimes
936 * @param {?} mode
937 */
938 addSimpleCodeMirrorMode: function(mimes, mode) {
939 self.runtime.loadModulePromise("source_frame").then(function() { //also not autoloaded (Though TBH this could just add waiting ones on start, rather th an loading it when we want to add one)
940 for (var i=0; i<mimes.length; i++) {
941 CodeMirror.defineSimpleMode(mimes[i], mode);
942 }
943 });
944 }
945 }
946
847 new WebInspector.Main(); 947 new WebInspector.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698