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

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

Issue 2204303003: DevTools: encapsulate extensible tabbed widget into the view manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 4 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) 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 this._splitWidget.show(this.element); 57 this._splitWidget.show(this.element);
58 58
59 // Create scripts navigator 59 // Create scripts navigator
60 const initialNavigatorWidth = 225; 60 const initialNavigatorWidth = 225;
61 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth); 61 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth);
62 this.editorView.enableShowModeSaving(); 62 this.editorView.enableShowModeSaving();
63 this.editorView.element.tabIndex = 0; 63 this.editorView.element.tabIndex = 0;
64 this._splitWidget.setMainWidget(this.editorView); 64 this._splitWidget.setMainWidget(this.editorView);
65 65
66 // Create navigator tabbed pane with toolbar. 66 // Create navigator tabbed pane with toolbar.
67 this._navigatorTabbedPane = new WebInspector.ExtensibleTabbedPane("navigator -view", true); 67 this._navigatorTabbedLocation = WebInspector.viewManager.createTabbedLocatio n("navigator-view", true);
68 var tabbedPane = this._navigatorTabbedPane.tabbedPane(); 68 var tabbedPane = this._navigatorTabbedLocation.tabbedPane();
69 tabbedPane.setMinimumSize(100, 25); 69 tabbedPane.setMinimumSize(100, 25);
70 tabbedPane.setShrinkableTabs(true); 70 tabbedPane.setShrinkableTabs(true);
71 tabbedPane.element.classList.add("navigator-tabbed-pane"); 71 tabbedPane.element.classList.add("navigator-tabbed-pane");
72 var navigatorToolbar = new WebInspector.Toolbar(""); 72 var navigatorToolbar = new WebInspector.Toolbar("");
73 var navigatorMenuButton = new WebInspector.ToolbarMenuButton(this._populateN avigatorMenu.bind(this), true); 73 var navigatorMenuButton = new WebInspector.ToolbarMenuButton(this._populateN avigatorMenu.bind(this), true);
74 navigatorMenuButton.setTitle(WebInspector.UIString("More options")); 74 navigatorMenuButton.setTitle(WebInspector.UIString("More options"));
75 navigatorToolbar.appendToolbarItem(navigatorMenuButton); 75 navigatorToolbar.appendToolbarItem(navigatorMenuButton);
76 tabbedPane.appendAfterTabStrip(navigatorToolbar.element); 76 tabbedPane.appendAfterTabStrip(navigatorToolbar.element);
77 this.editorView.setSidebarWidget(this._navigatorTabbedPane); 77 this.editorView.setSidebarWidget(tabbedPane);
78 78
79 this._sourcesView = new WebInspector.SourcesView(); 79 this._sourcesView = new WebInspector.SourcesView();
80 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel ected, this._editorSelected.bind(this)); 80 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel ected, this._editorSelected.bind(this));
81 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo sed, this._editorClosed.bind(this)); 81 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo sed, this._editorClosed.bind(this));
82 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); 82 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this));
83 this.editorView.setMainWidget(this._sourcesView); 83 this.editorView.setMainWidget(this._sourcesView);
84 84
85 this.sidebarPanes = {}; 85 this.sidebarPanes = {};
86 this.sidebarPanes.threads = null; 86 this.sidebarPanes.threads = null;
87 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba rPane(); 87 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba rPane();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 WebInspector.inspectorView.setDrawerMinimized(false); 212 WebInspector.inspectorView.setDrawerMinimized(false);
213 WebInspector.SourcesPanel.updateResizer(this); 213 WebInspector.SourcesPanel.updateResizer(this);
214 } 214 }
215 }, 215 },
216 216
217 /** 217 /**
218 * @override 218 * @override
219 * @param {string} locationName 219 * @param {string} locationName
220 * @return {?WebInspector.ViewLocation} 220 * @return {?WebInspector.ViewLocation}
221 */ 221 */
222 resolveLocation: function(locationName) 222 revealLocation: function(locationName)
223 { 223 {
224 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.ins tance()); 224 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.ins tance());
225 return this._navigatorTabbedPane; 225 return this._navigatorTabbedLocation;
226 }, 226 },
227 227
228 /** 228 /**
229 * @return {boolean} 229 * @return {boolean}
230 */ 230 */
231 _ensureSourcesViewVisible: function() 231 _ensureSourcesViewVisible: function()
232 { 232 {
233 if (WebInspector.SourcesPanel.WrapperView.isShowing()) 233 if (WebInspector.SourcesPanel.WrapperView.isShowing())
234 return true; 234 return true;
235 return this === WebInspector.inspectorView.setCurrentPanel(this); 235 return this === WebInspector.inspectorView.setCurrentPanel(this);
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 * @param {!Object} target 922 * @param {!Object} target
923 */ 923 */
924 _appendUISourceCodeItems: function(event, contextMenu, target) 924 _appendUISourceCodeItems: function(event, contextMenu, target)
925 { 925 {
926 if (!(target instanceof WebInspector.UISourceCode)) 926 if (!(target instanceof WebInspector.UISourceCode))
927 return; 927 return;
928 928
929 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (target); 929 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (target);
930 var projectType = uiSourceCode.project().type(); 930 var projectType = uiSourceCode.project().type();
931 931
932 if (projectType !== WebInspector.projectTypes.Debugger && !event.target. isSelfOrDescendant(this._navigatorTabbedPane.element)) { 932 if (projectType !== WebInspector.projectTypes.Debugger && !event.target. isSelfOrDescendant(this._navigatorTabbedLocation.widget().element)) {
933 contextMenu.appendItem(WebInspector.UIString.capitalize("Reveal in ^ navigator"), this._handleContextMenuReveal.bind(this, uiSourceCode)); 933 contextMenu.appendItem(WebInspector.UIString.capitalize("Reveal in ^ navigator"), this._handleContextMenuReveal.bind(this, uiSourceCode));
934 contextMenu.appendSeparator(); 934 contextMenu.appendSeparator();
935 } 935 }
936 this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode); 936 this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode);
937 if (projectType !== WebInspector.projectTypes.FileSystem) 937 if (projectType !== WebInspector.projectTypes.FileSystem)
938 contextMenu.appendItem(WebInspector.UIString.capitalize("Local ^modi fications\u2026"), this._showLocalHistory.bind(this, uiSourceCode)); 938 contextMenu.appendItem(WebInspector.UIString.capitalize("Local ^modi fications\u2026"), this._showLocalHistory.bind(this, uiSourceCode));
939 }, 939 },
940 940
941 /** 941 /**
942 * @param {!WebInspector.ContextMenu} contextMenu 942 * @param {!WebInspector.ContextMenu} contextMenu
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 __proto__: WebInspector.VBox.prototype 1473 __proto__: WebInspector.VBox.prototype
1474 } 1474 }
1475 1475
1476 /** 1476 /**
1477 * @return {boolean} 1477 * @return {boolean}
1478 */ 1478 */
1479 WebInspector.SourcesPanel.WrapperView.isShowing = function() 1479 WebInspector.SourcesPanel.WrapperView.isShowing = function()
1480 { 1480 {
1481 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); 1481 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing();
1482 } 1482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698