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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js

Issue 2546473005: [DevTools] Remove unnecessary checks for project types. (Closed)
Patch Set: fixed comment Created 4 years 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 533
534 _togglePauseOnExceptions() { 534 _togglePauseOnExceptions() {
535 Common.moduleSetting('pauseOnExceptionEnabled').set(!this._pauseOnExceptionB utton.toggled()); 535 Common.moduleSetting('pauseOnExceptionEnabled').set(!this._pauseOnExceptionB utton.toggled());
536 } 536 }
537 537
538 /** 538 /**
539 * @return {boolean} 539 * @return {boolean}
540 */ 540 */
541 _runSnippet() { 541 _runSnippet() {
542 var uiSourceCode = this._sourcesView.currentUISourceCode(); 542 var uiSourceCode = this._sourcesView.currentUISourceCode();
543 if (uiSourceCode.project().type() !== Workspace.projectTypes.Snippets) 543 if (!uiSourceCode)
544 return false; 544 return false;
545 545
546 var currentExecutionContext = UI.context.flavor(SDK.ExecutionContext); 546 var currentExecutionContext = UI.context.flavor(SDK.ExecutionContext);
547 if (!currentExecutionContext) 547 if (!currentExecutionContext)
548 return false; 548 return false;
549 549
550 Snippets.scriptSnippetModel.evaluateScriptSnippet(currentExecutionContext, u iSourceCode); 550 Snippets.scriptSnippetModel.evaluateScriptSnippet(currentExecutionContext, u iSourceCode);
551 return true; 551 return true;
552 } 552 }
553 553
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 /** 824 /**
825 * @param {!Event} event 825 * @param {!Event} event
826 * @param {!UI.ContextMenu} contextMenu 826 * @param {!UI.ContextMenu} contextMenu
827 * @param {!Object} target 827 * @param {!Object} target
828 */ 828 */
829 _appendUISourceCodeItems(event, contextMenu, target) { 829 _appendUISourceCodeItems(event, contextMenu, target) {
830 if (!(target instanceof Workspace.UISourceCode)) 830 if (!(target instanceof Workspace.UISourceCode))
831 return; 831 return;
832 832
833 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (target); 833 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (target);
834 var projectType = uiSourceCode.project().type(); 834 if (!uiSourceCode.isFromServiceProject() &&
835
836 if (projectType !== Workspace.projectTypes.Debugger &&
837 !event.target.isSelfOrDescendant(this._navigatorTabbedLocation.widget(). element)) { 835 !event.target.isSelfOrDescendant(this._navigatorTabbedLocation.widget(). element)) {
838 contextMenu.appendItem( 836 contextMenu.appendItem(
839 Common.UIString.capitalize('Reveal in ^navigator'), this._handleContex tMenuReveal.bind(this, uiSourceCode)); 837 Common.UIString.capitalize('Reveal in ^navigator'), this._handleContex tMenuReveal.bind(this, uiSourceCode));
840 contextMenu.appendSeparator(); 838 contextMenu.appendSeparator();
841 } 839 }
842 this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode); 840 this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode);
843 if (projectType !== Workspace.projectTypes.FileSystem) { 841 if (!uiSourceCode.project().canSetFileContent()) {
844 contextMenu.appendItem( 842 contextMenu.appendItem(
845 Common.UIString.capitalize('Local ^modifications\u2026'), this._showLo calHistory.bind(this, uiSourceCode)); 843 Common.UIString.capitalize('Local ^modifications\u2026'), this._showLo calHistory.bind(this, uiSourceCode));
846 } 844 }
847 } 845 }
848 846
849 /** 847 /**
850 * @param {!Event} event 848 * @param {!Event} event
851 * @param {!UI.ContextMenu} contextMenu 849 * @param {!UI.ContextMenu} contextMenu
852 * @param {!Object} target 850 * @param {!Object} target
853 */ 851 */
(...skipping 15 matching lines...) Expand all
869 var projectType = uiSourceCode.project().type(); 867 var projectType = uiSourceCode.project().type();
870 868
871 var contentType = uiSourceCode.contentType(); 869 var contentType = uiSourceCode.contentType();
872 if (contentType.hasScripts()) { 870 if (contentType.hasScripts()) {
873 var target = UI.context.flavor(SDK.Target); 871 var target = UI.context.flavor(SDK.Target);
874 var debuggerModel = SDK.DebuggerModel.fromTarget(target); 872 var debuggerModel = SDK.DebuggerModel.fromTarget(target);
875 if (debuggerModel && debuggerModel.isPaused()) { 873 if (debuggerModel && debuggerModel.isPaused()) {
876 contextMenu.appendItem( 874 contextMenu.appendItem(
877 Common.UIString.capitalize('Continue to ^here'), this._continueToLoc ation.bind(this, uiLocation)); 875 Common.UIString.capitalize('Continue to ^here'), this._continueToLoc ation.bind(this, uiLocation));
878 } 876 }
877 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, uiSourc eCode);
879 } 878 }
880
881 if (contentType.hasScripts() && projectType !== Workspace.projectTypes.Snipp ets)
882 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, uiSourc eCode);
883 } 879 }
884 880
885 /** 881 /**
886 * @param {!Workspace.UISourceCode} uiSourceCode 882 * @param {!Workspace.UISourceCode} uiSourceCode
887 */ 883 */
888 _handleContextMenuReveal(uiSourceCode) { 884 _handleContextMenuReveal(uiSourceCode) {
889 this.editorView.showBoth(); 885 this.editorView.showBoth();
890 this._revealInNavigator(uiSourceCode); 886 this._revealInNavigator(uiSourceCode);
891 } 887 }
892 888
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 */ 1318 */
1323 willHide() { 1319 willHide() {
1324 UI.inspectorView.setDrawerMinimized(false); 1320 UI.inspectorView.setDrawerMinimized(false);
1325 setImmediate(() => Sources.SourcesPanel.updateResizerAndSidebarButtons(Sourc es.SourcesPanel.instance())); 1321 setImmediate(() => Sources.SourcesPanel.updateResizerAndSidebarButtons(Sourc es.SourcesPanel.instance()));
1326 } 1322 }
1327 1323
1328 _showViewInWrapper() { 1324 _showViewInWrapper() {
1329 this._view.show(this.element); 1325 this._view.show(this.element);
1330 } 1326 }
1331 }; 1327 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698