Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 this._drawerTabbedLocation.enableMoreTabsButton(); | 51 this._drawerTabbedLocation.enableMoreTabsButton(); |
| 52 this._drawerTabbedPane = this._drawerTabbedLocation.tabbedPane(); | 52 this._drawerTabbedPane = this._drawerTabbedLocation.tabbedPane(); |
| 53 this._drawerTabbedPane.setMinimumSize(0, 27); | 53 this._drawerTabbedPane.setMinimumSize(0, 27); |
| 54 var closeDrawerButton = new WebInspector.ToolbarButton(WebInspector.UIString ("Close drawer"), "delete-toolbar-item"); | 54 var closeDrawerButton = new WebInspector.ToolbarButton(WebInspector.UIString ("Close drawer"), "delete-toolbar-item"); |
| 55 closeDrawerButton.addEventListener("click", this.closeDrawer.bind(this)); | 55 closeDrawerButton.addEventListener("click", this.closeDrawer.bind(this)); |
| 56 this._drawerTabbedPane.rightToolbar().appendToolbarItem(closeDrawerButton); | 56 this._drawerTabbedPane.rightToolbar().appendToolbarItem(closeDrawerButton); |
| 57 this._drawerSplitWidget.installResizer(this._drawerTabbedPane.headerElement( )); | 57 this._drawerSplitWidget.installResizer(this._drawerTabbedPane.headerElement( )); |
| 58 this._drawerSplitWidget.setSidebarWidget(this._drawerTabbedPane); | 58 this._drawerSplitWidget.setSidebarWidget(this._drawerTabbedPane); |
| 59 | 59 |
| 60 // Create main area tabbed pane. | 60 // Create main area tabbed pane. |
| 61 this._tabbedPane = new WebInspector.TabbedPane(); | 61 this._tabbedLocation = WebInspector.viewManager.createTabbedLocation(Inspect orFrontendHost.bringToFront.bind(InspectorFrontendHost), "panel", true, true); |
| 62 this._tabbedPane = this._tabbedLocation.tabbedPane(); | |
| 62 this._tabbedPane.registerRequiredCSS("ui/inspectorViewTabbedPane.css"); | 63 this._tabbedPane.registerRequiredCSS("ui/inspectorViewTabbedPane.css"); |
| 63 this._tabbedPane.setTabSlider(true); | 64 this._tabbedPane.setTabSlider(true); |
| 64 this._tabbedPane.setAllowTabReorder(true, false); | 65 this._tabbedPane.setAllowTabReorder(true, false); |
|
dgozman
2016/10/12 04:47:40
Ain't this a last parameter to createTabbedLocatio
pfeldman
2016/10/12 19:02:33
Done.
| |
| 65 this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabOrderCha nged, this._persistPanelOrder, this); | 66 this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabOrderCha nged, this._persistPanelOrder, this); |
| 67 this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabSelected , this._tabSelected, this); | |
| 68 | |
| 69 if (InspectorFrontendHost.isUnderTest()) | |
| 70 this._tabbedPane.setAutoSelectFirstItemOnShow(false); | |
| 66 this._tabOrderSetting = WebInspector.settings.createSetting("InspectorView.p anelOrder", {}); | 71 this._tabOrderSetting = WebInspector.settings.createSetting("InspectorView.p anelOrder", {}); |
|
dgozman
2016/10/12 04:47:40
Remove.
pfeldman
2016/10/12 19:02:33
Done.
| |
| 67 this._drawerSplitWidget.setMainWidget(this._tabbedPane); | 72 this._drawerSplitWidget.setMainWidget(this._tabbedPane); |
| 68 | 73 |
| 69 this._panels = {}; | |
| 70 // Used by tests. | |
| 71 WebInspector["panels"] = this._panels; | |
| 72 | |
| 73 this._history = []; | |
| 74 this._historyIterator = -1; | |
| 75 this._keyDownBound = this._keyDown.bind(this); | 74 this._keyDownBound = this._keyDown.bind(this); |
| 76 this._keyPressBound = this._keyPress.bind(this); | 75 this._keyPressBound = this._keyPress.bind(this); |
| 77 /** @type {!Object.<string, !WebInspector.PanelDescriptor>} */ | |
| 78 this._panelDescriptors = {}; | |
| 79 /** @type {!Object.<string, !Promise.<!WebInspector.Panel> >} */ | 76 /** @type {!Object.<string, !Promise.<!WebInspector.Panel> >} */ |
| 80 this._panelPromises = {}; | |
| 81 | 77 |
| 82 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi vePanel", "elements"); | 78 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi vePanel", "elements"); |
|
dgozman
2016/10/12 04:47:40
Unused.
pfeldman
2016/10/12 19:02:33
Done.
| |
| 83 | 79 |
| 84 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.ShowPanel, showPanel.bind(this)); | 80 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.ShowPanel, showPanel.bind(this)); |
| 85 this._loadPanelDesciptors(); | |
| 86 | 81 |
| 87 /** | 82 /** |
| 88 * @this {WebInspector.InspectorView} | 83 * @this {WebInspector.InspectorView} |
| 89 * @param {!WebInspector.Event} event | 84 * @param {!WebInspector.Event} event |
| 90 */ | 85 */ |
| 91 function showPanel(event) | 86 function showPanel(event) |
| 92 { | 87 { |
| 93 var panelName = /** @type {string} */ (event.data); | 88 var panelName = /** @type {string} */ (event.data); |
| 94 this.showPanel(panelName); | 89 this.showPanel(panelName); |
| 95 } | 90 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 119 /** | 114 /** |
| 120 * @override | 115 * @override |
| 121 * @param {string} locationName | 116 * @param {string} locationName |
| 122 * @return {?WebInspector.ViewLocation} | 117 * @return {?WebInspector.ViewLocation} |
| 123 */ | 118 */ |
| 124 resolveLocation: function(locationName) | 119 resolveLocation: function(locationName) |
| 125 { | 120 { |
| 126 return this._drawerTabbedLocation; | 121 return this._drawerTabbedLocation; |
| 127 }, | 122 }, |
| 128 | 123 |
| 129 _loadPanelDesciptors: function() | |
| 130 { | |
| 131 /** | |
| 132 * @param {!Runtime.Extension} extension | |
| 133 * @this {!WebInspector.InspectorView} | |
| 134 */ | |
| 135 function processPanelExtensions(extension) | |
| 136 { | |
| 137 var descriptor = new WebInspector.ExtensionPanelDescriptor(extension ); | |
| 138 var weight = this._tabOrderSetting.get()[descriptor.name()]; | |
| 139 if (weight === undefined) | |
| 140 weight = extension.descriptor()["order"]; | |
| 141 if (weight === undefined) | |
| 142 weight = 10000; | |
| 143 panelWeights.set(descriptor, weight); | |
| 144 } | |
| 145 | |
| 146 /** | |
| 147 * @param {!WebInspector.PanelDescriptor} left | |
| 148 * @param {!WebInspector.PanelDescriptor} right | |
| 149 */ | |
| 150 function orderComparator(left, right) | |
| 151 { | |
| 152 return panelWeights.get(left) > panelWeights.get(right); | |
| 153 } | |
| 154 | |
| 155 WebInspector.startBatchUpdate(); | |
| 156 /** @type {!Map<!WebInspector.PanelDescriptor, number>} */ | |
| 157 var panelWeights = new Map(); | |
| 158 self.runtime.extensions(WebInspector.Panel).forEach(processPanelExtensio ns.bind(this)); | |
| 159 var sortedPanels = panelWeights.keysArray().sort(orderComparator); | |
| 160 for (var panelDescriptor of sortedPanels) | |
| 161 this._innerAddPanel(panelDescriptor); | |
| 162 WebInspector.endBatchUpdate(); | |
| 163 }, | |
| 164 | |
| 165 createToolbars: function() | 124 createToolbars: function() |
| 166 { | 125 { |
| 167 this._tabbedPane.leftToolbar().appendLocationItems("main-toolbar-left"); | 126 this._tabbedPane.leftToolbar().appendLocationItems("main-toolbar-left"); |
| 168 this._tabbedPane.rightToolbar().appendLocationItems("main-toolbar-right" ); | 127 this._tabbedPane.rightToolbar().appendLocationItems("main-toolbar-right" ); |
| 169 }, | 128 }, |
| 170 | 129 |
| 171 /** | 130 /** |
| 172 * @param {!WebInspector.PanelDescriptor} panelDescriptor | 131 * @param {!WebInspector.View} view |
| 173 * @param {number=} index | |
| 174 */ | 132 */ |
| 175 _innerAddPanel: function(panelDescriptor, index) | 133 addPanel: function(view) |
| 176 { | 134 { |
| 177 var panelName = panelDescriptor.name(); | 135 this._tabbedLocation.appendView(view); |
| 178 this._panelDescriptors[panelName] = panelDescriptor; | |
| 179 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn spector.Widget(), undefined, undefined, undefined, index); | |
| 180 if (this._lastActivePanelSetting.get() === panelName) | |
| 181 this._tabbedPane.selectTab(panelName); | |
| 182 }, | 136 }, |
| 183 | 137 |
| 184 /** | 138 /** |
| 185 * @param {!WebInspector.PanelDescriptor} panelDescriptor | |
| 186 */ | |
| 187 addPanel: function(panelDescriptor) | |
| 188 { | |
| 189 var weight = this._tabOrderSetting.get()[panelDescriptor.name()]; | |
| 190 // Keep in sync with _persistPanelOrder(). | |
| 191 if (weight) | |
| 192 weight = Math.max(0, Math.round(weight / 10) - 1); | |
| 193 this._innerAddPanel(panelDescriptor, weight); | |
| 194 }, | |
| 195 | |
| 196 /** | |
| 197 * @param {string} panelName | 139 * @param {string} panelName |
| 198 * @return {boolean} | 140 * @return {boolean} |
| 199 */ | 141 */ |
| 200 hasPanel: function(panelName) | 142 hasPanel: function(panelName) |
| 201 { | 143 { |
| 202 return !!this._panelDescriptors[panelName]; | 144 return this._tabbedPane.hasTab(panelName); |
| 203 }, | 145 }, |
| 204 | 146 |
| 205 /** | 147 /** |
| 206 * @param {string} panelName | 148 * @param {string} panelName |
| 207 * @return {!Promise.<!WebInspector.Panel>} | 149 * @return {!Promise.<!WebInspector.Panel>} |
| 208 */ | 150 */ |
| 209 panel: function(panelName) | 151 panel: function(panelName) |
| 210 { | 152 { |
| 211 var panelDescriptor = this._panelDescriptors[panelName]; | 153 return /** @type {!Promise.<!WebInspector.Panel>} */ (WebInspector.viewM anager.view(panelName).widget()); |
| 212 if (!panelDescriptor) | |
| 213 return Promise.reject(new Error("Can't load panel without the descri ptor: " + panelName)); | |
| 214 | |
| 215 var promise = this._panelPromises[panelName]; | |
| 216 if (promise) | |
| 217 return promise; | |
| 218 | |
| 219 promise = panelDescriptor.panel(); | |
| 220 this._panelPromises[panelName] = promise; | |
| 221 | |
| 222 promise.then(cachePanel.bind(this)); | |
| 223 | |
| 224 /** | |
| 225 * @param {!WebInspector.Panel} panel | |
| 226 * @return {!WebInspector.Panel} | |
| 227 * @this {WebInspector.InspectorView} | |
| 228 */ | |
| 229 function cachePanel(panel) | |
| 230 { | |
| 231 delete this._panelPromises[panelName]; | |
| 232 this._panels[panelName] = panel; | |
| 233 return panel; | |
| 234 } | |
| 235 return promise; | |
| 236 }, | 154 }, |
| 237 | 155 |
| 238 /** | 156 /** |
| 239 * @param {boolean} allTargetsSuspended | 157 * @param {boolean} allTargetsSuspended |
| 240 */ | 158 */ |
| 241 onSuspendStateChanged: function(allTargetsSuspended) | 159 onSuspendStateChanged: function(allTargetsSuspended) |
| 242 { | 160 { |
| 243 this._currentPanelLocked = allTargetsSuspended; | 161 this._currentPanelLocked = allTargetsSuspended; |
| 244 this._tabbedPane.setCurrentTabLocked(this._currentPanelLocked); | 162 this._tabbedPane.setCurrentTabLocked(this._currentPanelLocked); |
| 245 this._tabbedPane.leftToolbar().setEnabled(!this._currentPanelLocked); | 163 this._tabbedPane.leftToolbar().setEnabled(!this._currentPanelLocked); |
| 246 this._tabbedPane.rightToolbar().setEnabled(!this._currentPanelLocked); | 164 this._tabbedPane.rightToolbar().setEnabled(!this._currentPanelLocked); |
| 247 }, | 165 }, |
| 248 | 166 |
| 249 /** | 167 /** |
| 168 * @return {boolean} | |
| 169 */ | |
| 170 canSelectPanel: function(panelName) | |
|
dgozman
2016/10/12 04:47:40
@param
pfeldman
2016/10/12 19:02:33
Done.
| |
| 171 { | |
| 172 return !this._currentPanelLocked || this._tabbedPane.selectedTabId === p anelName; | |
| 173 }, | |
| 174 | |
| 175 /** | |
| 250 * The returned Promise is resolved with null if another showPanel() | 176 * The returned Promise is resolved with null if another showPanel() |
|
dgozman
2016/10/12 04:47:40
This comment is no longer true.
pfeldman
2016/10/12 19:02:33
Done.
| |
| 251 * gets called while this.panel(panelName) Promise is in flight. | 177 * gets called while this.panel(panelName) Promise is in flight. |
| 252 * | 178 * |
| 253 * @param {string} panelName | 179 * @param {string} panelName |
| 254 * @return {!Promise.<?WebInspector.Panel>} | 180 * @return {!Promise.<?WebInspector.Panel>} |
| 255 */ | 181 */ |
| 256 showPanel: function(panelName) | 182 showPanel: function(panelName) |
| 257 { | 183 { |
| 258 if (this._currentPanelLocked) { | 184 return WebInspector.viewManager.showView(panelName); |
| 259 if (this._currentPanel !== this._panels[panelName]) | |
| 260 return Promise.reject(new Error("Current panel locked")); | |
| 261 return Promise.resolve(this._currentPanel); | |
| 262 } | |
| 263 | |
| 264 this._panelForShowPromise = this.panel(panelName); | |
| 265 return this._panelForShowPromise.then(setCurrentPanelIfNecessary.bind(th is, this._panelForShowPromise)); | |
| 266 | |
| 267 /** | |
| 268 * @param {!Promise.<!WebInspector.Panel>} panelPromise | |
| 269 * @param {!WebInspector.Panel} panel | |
| 270 * @return {?WebInspector.Panel} | |
| 271 * @this {WebInspector.InspectorView} | |
| 272 */ | |
| 273 function setCurrentPanelIfNecessary(panelPromise, panel) | |
| 274 { | |
| 275 if (this._panelForShowPromise !== panelPromise) | |
| 276 return null; | |
| 277 | |
| 278 this.setCurrentPanel(panel); | |
| 279 return panel; | |
| 280 } | |
| 281 }, | 185 }, |
| 282 | 186 |
| 283 /** | 187 /** |
| 284 * @param {string} panelName | 188 * @param {string} panelName |
| 285 * @param {string} iconType | 189 * @param {string} iconType |
| 286 * @param {string=} iconTooltip | 190 * @param {string=} iconTooltip |
| 287 */ | 191 */ |
| 288 setPanelIcon: function(panelName, iconType, iconTooltip) | 192 setPanelIcon: function(panelName, iconType, iconTooltip) |
| 289 { | 193 { |
| 290 this._tabbedPane.setTabIcon(panelName, iconType, iconTooltip); | 194 this._tabbedPane.setTabIcon(panelName, iconType, iconTooltip); |
| 291 }, | 195 }, |
| 292 | 196 |
| 293 /** | 197 /** |
| 294 * @return {!WebInspector.Panel} | 198 * @return {!WebInspector.Panel} |
| 295 */ | 199 */ |
| 296 currentPanel: function() | 200 currentPanelDeprecated: function() |
| 297 { | 201 { |
| 298 return this._currentPanel; | 202 return /** @type {!WebInspector.Panel} */ (WebInspector.viewManager.mate rializedWidget(this._tabbedPane.selectedTabId || "")); |
|
dgozman
2016/10/12 04:47:40
Why not this._tabbedPane.tabView(this._tabbedPane.
pfeldman
2016/10/12 19:02:33
It would return a different widget (view's interna
| |
| 299 }, | |
| 300 | |
| 301 showInitialPanel: function() | |
| 302 { | |
| 303 if (InspectorFrontendHost.isUnderTest()) | |
| 304 return; | |
| 305 this._showInitialPanel(); | |
| 306 }, | |
| 307 | |
| 308 _showInitialPanel: function() | |
| 309 { | |
| 310 this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabSele cted, this._tabSelected, this); | |
| 311 this._tabSelected(); | |
| 312 }, | |
| 313 | |
| 314 /** | |
| 315 * @param {string} panelName | |
| 316 */ | |
| 317 showInitialPanelForTest: function(panelName) | |
| 318 { | |
| 319 this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabSele cted, this._tabSelected, this); | |
| 320 this.setCurrentPanel(this._panels[panelName]); | |
| 321 }, | |
| 322 | |
| 323 _tabSelected: function() | |
| 324 { | |
| 325 var panelName = this._tabbedPane.selectedTabId; | |
| 326 if (!panelName) | |
| 327 return; | |
| 328 | |
| 329 this.showPanel(panelName); | |
| 330 }, | |
| 331 | |
| 332 /** | |
| 333 * @param {!WebInspector.Panel} panel | |
| 334 * @param {boolean=} suppressBringToFront | |
| 335 * @return {!WebInspector.Panel} | |
| 336 */ | |
| 337 setCurrentPanel: function(panel, suppressBringToFront) | |
| 338 { | |
| 339 delete this._panelForShowPromise; | |
| 340 | |
| 341 if (this._currentPanelLocked) | |
| 342 return this._currentPanel; | |
| 343 | |
| 344 if (!suppressBringToFront) | |
| 345 InspectorFrontendHost.bringToFront(); | |
| 346 | |
| 347 if (this._currentPanel === panel) | |
| 348 return panel; | |
| 349 | |
| 350 this._currentPanel = panel; | |
| 351 if (!this._panels[panel.name]) | |
| 352 this._panels[panel.name] = panel; | |
| 353 this._tabbedPane.changeTabView(panel.name, panel); | |
| 354 this._tabbedPane.removeEventListener(WebInspector.TabbedPane.Events.TabS elected, this._tabSelected, this); | |
| 355 this._tabbedPane.selectTab(panel.name); | |
| 356 this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabSele cted, this._tabSelected, this); | |
| 357 | |
| 358 this._lastActivePanelSetting.set(panel.name); | |
| 359 this._pushToHistory(panel.name); | |
| 360 WebInspector.userMetrics.panelShown(panel.name); | |
| 361 panel.focus(); | |
| 362 | |
| 363 return panel; | |
| 364 }, | 203 }, |
| 365 | 204 |
| 366 showDrawer: function() | 205 showDrawer: function() |
| 367 { | 206 { |
| 207 InspectorFrontendHost.bringToFront(); | |
| 368 if (!this._drawerTabbedPane.isShowing()) | 208 if (!this._drawerTabbedPane.isShowing()) |
| 369 this._drawerSplitWidget.showBoth(); | 209 this._drawerSplitWidget.showBoth(); |
| 370 this._drawerTabbedPane.focus(); | 210 this._drawerTabbedPane.focus(); |
| 371 }, | 211 }, |
| 372 | 212 |
| 373 /** | 213 /** |
| 374 * @return {boolean} | 214 * @return {boolean} |
| 375 */ | 215 */ |
| 376 drawerVisible: function() | 216 drawerVisible: function() |
| 377 { | 217 { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 442 // so for a ]/[-related keydown we delay the panel switch using a timer, to see if there is a keypress event following this one. | 282 // so for a ]/[-related keydown we delay the panel switch using a timer, to see if there is a keypress event following this one. |
| 443 // If there is, we cancel the timer and do not consider this a panel swi tch. | 283 // If there is, we cancel the timer and do not consider this a panel swi tch. |
| 444 if (!WebInspector.isWin() || (event.key !== "[" && event.key !== "]")) { | 284 if (!WebInspector.isWin() || (event.key !== "[" && event.key !== "]")) { |
| 445 this._keyDownInternal(event); | 285 this._keyDownInternal(event); |
| 446 return; | 286 return; |
| 447 } | 287 } |
| 448 | 288 |
| 449 this._keyDownTimer = setTimeout(this._keyDownInternal.bind(this, event), 0); | 289 this._keyDownTimer = setTimeout(this._keyDownInternal.bind(this, event), 0); |
| 450 }, | 290 }, |
| 451 | 291 |
| 452 _keyDownInternal: function(event) | 292 _keyDownInternal: function(event) |
|
dgozman
2016/10/12 04:47:40
Seems like this method does nothing.
pfeldman
2016/10/12 19:02:33
Done.
| |
| 453 { | 293 { |
| 454 if (this._currentPanelLocked) | 294 if (this._currentPanelLocked) |
| 455 return; | 295 return; |
| 456 | 296 |
| 457 var direction = 0; | 297 var direction = 0; |
| 458 | 298 |
| 459 if (event.key === "[") | 299 if (event.key === "[") |
| 460 direction = -1; | 300 direction = -1; |
| 461 | 301 |
| 462 if (event.key === "]") | 302 if (event.key === "]") |
| 463 direction = 1; | 303 direction = 1; |
| 464 | 304 |
| 465 if (!direction) | 305 if (!direction) |
| 466 return; | 306 return; |
| 467 | |
| 468 if (!event.shiftKey && !event.altKey) { | |
| 469 if (!WebInspector.Dialog.hasInstance()) | |
| 470 this._changePanelInDirection(direction); | |
| 471 event.consume(true); | |
| 472 return; | |
| 473 } | |
| 474 | |
| 475 if (event.altKey && this._moveInHistory(direction)) | |
| 476 event.consume(true); | |
| 477 }, | |
| 478 | |
| 479 /** | |
| 480 * @param {number} direction | |
| 481 */ | |
| 482 _changePanelInDirection: function(direction) | |
| 483 { | |
| 484 var panelOrder = this._tabbedPane.allTabs(); | |
| 485 var index = panelOrder.indexOf(this.currentPanel().name); | |
| 486 index = (index + panelOrder.length + direction) % panelOrder.length; | |
| 487 this.showPanel(panelOrder[index]); | |
| 488 }, | |
| 489 | |
| 490 /** | |
| 491 * @param {number} move | |
| 492 */ | |
| 493 _moveInHistory: function(move) | |
|
dgozman
2016/10/12 04:47:40
Dropping history! Yay!
| |
| 494 { | |
| 495 var newIndex = this._historyIterator + move; | |
| 496 if (newIndex >= this._history.length || newIndex < 0) | |
| 497 return false; | |
| 498 | |
| 499 this._inHistory = true; | |
| 500 this._historyIterator = newIndex; | |
| 501 if (!WebInspector.Dialog.hasInstance()) | |
| 502 this.setCurrentPanel(this._panels[this._history[this._historyIterato r]]); | |
| 503 delete this._inHistory; | |
| 504 | |
| 505 return true; | |
| 506 }, | |
| 507 | |
| 508 _pushToHistory: function(panelName) | |
| 509 { | |
| 510 if (this._inHistory) | |
| 511 return; | |
| 512 | |
| 513 this._history.splice(this._historyIterator + 1, this._history.length - t his._historyIterator - 1); | |
| 514 if (!this._history.length || this._history[this._history.length - 1] !== panelName) | |
| 515 this._history.push(panelName); | |
| 516 this._historyIterator = this._history.length - 1; | |
| 517 }, | 307 }, |
| 518 | 308 |
| 519 onResize: function() | 309 onResize: function() |
| 520 { | 310 { |
| 521 WebInspector.Dialog.modalHostRepositioned(); | 311 WebInspector.Dialog.modalHostRepositioned(); |
| 522 }, | 312 }, |
| 523 | 313 |
| 524 /** | 314 /** |
| 525 * @return {!Element} | 315 * @return {!Element} |
| 526 */ | 316 */ |
| 527 topResizerElement: function() | 317 topResizerElement: function() |
| 528 { | 318 { |
| 529 return this._tabbedPane.headerElement(); | 319 return this._tabbedPane.headerElement(); |
| 530 }, | 320 }, |
| 531 | 321 |
| 532 toolbarItemResized: function() | 322 toolbarItemResized: function() |
| 533 { | 323 { |
| 534 this._tabbedPane.headerResized(); | 324 this._tabbedPane.headerResized(); |
| 535 }, | 325 }, |
| 536 | 326 |
| 537 /** | 327 /** |
| 538 * @param {!WebInspector.Event} event | 328 * @param {!WebInspector.Event} event |
| 539 */ | 329 */ |
| 540 _persistPanelOrder: function(event) | 330 _persistPanelOrder: function(event) |
|
dgozman
2016/10/12 04:47:40
This is done in TabbedLocation.
pfeldman
2016/10/12 19:02:33
Done.
| |
| 541 { | 331 { |
| 542 var tabs = /** @type {!Array.<!WebInspector.TabbedPaneTab>} */(event.dat a); | 332 var tabs = /** @type {!Array.<!WebInspector.TabbedPaneTab>} */(event.dat a); |
| 543 var tabOrders = this._tabOrderSetting.get(); | 333 var tabOrders = this._tabOrderSetting.get(); |
| 544 for (var i = 0; i < tabs.length; i++) | 334 for (var i = 0; i < tabs.length; i++) |
| 545 tabOrders[tabs[i].id] = (i + 1) * 10; | 335 tabOrders[tabs[i].id] = (i + 1) * 10; |
| 546 this._tabOrderSetting.set(tabOrders); | 336 this._tabOrderSetting.set(tabOrders); |
| 547 }, | 337 }, |
| 548 | 338 |
| 549 /** | 339 /** |
| 340 * @param {!WebInspector.Event} event | |
| 341 */ | |
| 342 _tabSelected: function(event) | |
| 343 { | |
| 344 var tabId = /** @type {string} */(event.data["tabId"]); | |
| 345 WebInspector.userMetrics.panelShown(tabId); | |
| 346 }, | |
| 347 | |
| 348 /** | |
| 550 * @param {!WebInspector.SplitWidget} splitWidget | 349 * @param {!WebInspector.SplitWidget} splitWidget |
| 551 */ | 350 */ |
| 552 setOwnerSplit: function(splitWidget) | 351 setOwnerSplit: function(splitWidget) |
| 553 { | 352 { |
| 554 this._ownerSplitWidget = splitWidget; | 353 this._ownerSplitWidget = splitWidget; |
| 555 }, | 354 }, |
| 556 | 355 |
| 557 minimize: function() | 356 minimize: function() |
| 558 { | 357 { |
| 559 if (this._ownerSplitWidget) | 358 if (this._ownerSplitWidget) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 591 */ | 390 */ |
| 592 handleAction: function(context, actionId) | 391 handleAction: function(context, actionId) |
| 593 { | 392 { |
| 594 if (WebInspector.inspectorView.drawerVisible()) | 393 if (WebInspector.inspectorView.drawerVisible()) |
| 595 WebInspector.inspectorView.closeDrawer(); | 394 WebInspector.inspectorView.closeDrawer(); |
| 596 else | 395 else |
| 597 WebInspector.inspectorView.showDrawer(); | 396 WebInspector.inspectorView.showDrawer(); |
| 598 return true; | 397 return true; |
| 599 } | 398 } |
| 600 } | 399 } |
| OLD | NEW |