| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 this._errorWarningCountElement = this._rightToolbarElement.createChild("div"
, "hidden"); | 62 this._errorWarningCountElement = this._rightToolbarElement.createChild("div"
, "hidden"); |
| 63 this._errorWarningCountElement.id = "error-warning-count"; | 63 this._errorWarningCountElement.id = "error-warning-count"; |
| 64 | 64 |
| 65 this._closeButtonToolbarItem = document.createElementWithClass("div", "toolb
ar-close-button-item"); | 65 this._closeButtonToolbarItem = document.createElementWithClass("div", "toolb
ar-close-button-item"); |
| 66 var closeButtonElement = this._closeButtonToolbarItem.createChild("div", "cl
ose-button"); | 66 var closeButtonElement = this._closeButtonToolbarItem.createChild("div", "cl
ose-button"); |
| 67 closeButtonElement.addEventListener("click", InspectorFrontendHost.closeWind
ow.bind(InspectorFrontendHost), true); | 67 closeButtonElement.addEventListener("click", InspectorFrontendHost.closeWind
ow.bind(InspectorFrontendHost), true); |
| 68 this._rightToolbarElement.appendChild(this._closeButtonToolbarItem); | 68 this._rightToolbarElement.appendChild(this._closeButtonToolbarItem); |
| 69 | 69 |
| 70 this.appendToRightToolbar(this._drawer.toggleButtonElement()); | 70 this.appendToRightToolbar(this._drawer.toggleButtonElement()); |
| 71 | 71 |
| 72 this._panels = {}; |
| 73 // Used by tests. |
| 74 WebInspector["panels"] = this._panels; |
| 75 |
| 72 this._history = []; | 76 this._history = []; |
| 73 this._historyIterator = -1; | 77 this._historyIterator = -1; |
| 74 document.addEventListener("keydown", this._keyDown.bind(this), false); | 78 document.addEventListener("keydown", this._keyDown.bind(this), false); |
| 75 document.addEventListener("keypress", this._keyPress.bind(this), false); | 79 document.addEventListener("keypress", this._keyPress.bind(this), false); |
| 76 this._panelDescriptors = {}; | 80 this._panelDescriptors = {}; |
| 77 | 81 |
| 78 // Windows and Mac have two different definitions of '[' and ']', so accept
both of each. | 82 // Windows and Mac have two different definitions of '[' and ']', so accept
both of each. |
| 79 this._openBracketIdentifiers = ["U+005B", "U+00DB"].keySet(); | 83 this._openBracketIdentifiers = ["U+005B", "U+00DB"].keySet(); |
| 80 this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet(); | 84 this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet(); |
| 81 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi
vePanel", "elements"); | 85 this._lastActivePanelSetting = WebInspector.settings.createSetting("lastActi
vePanel", "elements"); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 { | 126 { |
| 123 var panelName = panelDescriptor.name(); | 127 var panelName = panelDescriptor.name(); |
| 124 this._panelDescriptors[panelName] = panelDescriptor; | 128 this._panelDescriptors[panelName] = panelDescriptor; |
| 125 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn
spector.View()); | 129 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn
spector.View()); |
| 126 if (this._lastActivePanelSetting.get() === panelName) | 130 if (this._lastActivePanelSetting.get() === panelName) |
| 127 this._tabbedPane.selectTab(panelName); | 131 this._tabbedPane.selectTab(panelName); |
| 128 }, | 132 }, |
| 129 | 133 |
| 130 /** | 134 /** |
| 131 * @param {string} panelName | 135 * @param {string} panelName |
| 136 * @return {boolean} |
| 137 */ |
| 138 hasPanel: function(panelName) |
| 139 { |
| 140 return !!this._panelDescriptors[panelName]; |
| 141 }, |
| 142 |
| 143 /** |
| 144 * @param {string} panelName |
| 132 * @return {?WebInspector.Panel} | 145 * @return {?WebInspector.Panel} |
| 133 */ | 146 */ |
| 134 panel: function(panelName) | 147 panel: function(panelName) |
| 135 { | 148 { |
| 136 var panelDescriptor = this._panelDescriptors[panelName]; | 149 var panelDescriptor = this._panelDescriptors[panelName]; |
| 137 var panelOrder = this._tabbedPane.allTabs(); | 150 var panelOrder = this._tabbedPane.allTabs(); |
| 138 if (!panelDescriptor && panelOrder.length) | 151 if (!panelDescriptor && panelOrder.length) |
| 139 panelDescriptor = this._panelDescriptors[panelOrder[0]]; | 152 panelDescriptor = this._panelDescriptors[panelOrder[0]]; |
| 140 return panelDescriptor ? panelDescriptor.panel() : null; | 153 var panel = panelDescriptor ? panelDescriptor.panel() : null; |
| 154 if (panel) |
| 155 this._panels[panelName] = panel; |
| 156 return panel; |
| 141 }, | 157 }, |
| 142 | 158 |
| 143 /** | 159 /** |
| 144 * @param {string} panelName | 160 * @param {string} panelName |
| 145 * @return {?WebInspector.Panel} | 161 * @return {?WebInspector.Panel} |
| 146 */ | 162 */ |
| 147 showPanel: function(panelName) | 163 showPanel: function(panelName) |
| 148 { | 164 { |
| 149 var panel = this.panel(panelName); | 165 var panel = this.panel(panelName); |
| 150 if (panel) | 166 if (panel) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 { | 208 { |
| 193 this._drawer.setDrawerEditorAvailable(available); | 209 this._drawer.setDrawerEditorAvailable(available); |
| 194 }, | 210 }, |
| 195 | 211 |
| 196 _tabSelected: function() | 212 _tabSelected: function() |
| 197 { | 213 { |
| 198 var panelName = this._tabbedPane.selectedTabId; | 214 var panelName = this._tabbedPane.selectedTabId; |
| 199 if (!panelName) | 215 if (!panelName) |
| 200 return; | 216 return; |
| 201 var panel = this._panelDescriptors[this._tabbedPane.selectedTabId].panel
(); | 217 var panel = this._panelDescriptors[this._tabbedPane.selectedTabId].panel
(); |
| 218 this._panels[panelName] = panel; |
| 202 this._tabbedPane.changeTabView(panelName, panel); | 219 this._tabbedPane.changeTabView(panelName, panel); |
| 203 | 220 |
| 204 this._currentPanel = panel; | 221 this._currentPanel = panel; |
| 205 this._lastActivePanelSetting.set(panel.name); | 222 this._lastActivePanelSetting.set(panel.name); |
| 206 this._pushToHistory(panel.name); | 223 this._pushToHistory(panel.name); |
| 207 WebInspector.userMetrics.panelShown(panel.name); | 224 WebInspector.userMetrics.panelShown(panel.name); |
| 208 panel.focus(); | 225 panel.focus(); |
| 209 }, | 226 }, |
| 210 | 227 |
| 211 /** | 228 /** |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 378 |
| 362 _moveInHistory: function(move) | 379 _moveInHistory: function(move) |
| 363 { | 380 { |
| 364 var newIndex = this._historyIterator + move; | 381 var newIndex = this._historyIterator + move; |
| 365 if (newIndex >= this._history.length || newIndex < 0) | 382 if (newIndex >= this._history.length || newIndex < 0) |
| 366 return false; | 383 return false; |
| 367 | 384 |
| 368 this._inHistory = true; | 385 this._inHistory = true; |
| 369 this._historyIterator = newIndex; | 386 this._historyIterator = newIndex; |
| 370 if (!WebInspector.Dialog.currentInstance()) | 387 if (!WebInspector.Dialog.currentInstance()) |
| 371 this.setCurrentPanel(WebInspector.panels[this._history[this._history
Iterator]]); | 388 this.setCurrentPanel(this._panels[this._history[this._historyIterato
r]]); |
| 372 delete this._inHistory; | 389 delete this._inHistory; |
| 373 | 390 |
| 374 return true; | 391 return true; |
| 375 }, | 392 }, |
| 376 | 393 |
| 377 _pushToHistory: function(panelName) | 394 _pushToHistory: function(panelName) |
| 378 { | 395 { |
| 379 if (this._inHistory) | 396 if (this._inHistory) |
| 380 return; | 397 return; |
| 381 | 398 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 window.addEventListener("scroll", this._onScrollBound, false); | 522 window.addEventListener("scroll", this._onScrollBound, false); |
| 506 else | 523 else |
| 507 window.removeEventListener("scroll", this._onScrollBound, false); | 524 window.removeEventListener("scroll", this._onScrollBound, false); |
| 508 | 525 |
| 509 WebInspector.VBox.prototype.doResize.call(this); | 526 WebInspector.VBox.prototype.doResize.call(this); |
| 510 this._onScroll(); | 527 this._onScroll(); |
| 511 }, | 528 }, |
| 512 | 529 |
| 513 __proto__: WebInspector.VBox.prototype | 530 __proto__: WebInspector.VBox.prototype |
| 514 }; | 531 }; |
| OLD | NEW |