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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 this._tabbedPane.setRetainTabOrder(true); | 49 this._tabbedPane.setRetainTabOrder(true); |
50 this._tabbedPane.show(this._drawerSplitView.mainElement()); | 50 this._tabbedPane.show(this._drawerSplitView.mainElement()); |
51 this._drawer = new WebInspector.Drawer(this._drawerSplitView); | 51 this._drawer = new WebInspector.Drawer(this._drawerSplitView); |
52 | 52 |
53 // Patch tabbed pane header with toolbar actions. | 53 // Patch tabbed pane header with toolbar actions. |
54 this._toolbarElement = createElement("div"); | 54 this._toolbarElement = createElement("div"); |
55 this._toolbarElement.className = "toolbar toolbar-background toolbar-colors"
; | 55 this._toolbarElement.className = "toolbar toolbar-background toolbar-colors"
; |
56 var headerElement = this._tabbedPane.headerElement(); | 56 var headerElement = this._tabbedPane.headerElement(); |
57 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement
); | 57 headerElement.parentElement.insertBefore(this._toolbarElement, headerElement
); |
58 | 58 |
59 this._leftToolbarElement = this._toolbarElement.createChild("div", "toolbar-
controls-left"); | 59 this._leftToolbar = new WebInspector.StatusBar(this._toolbarElement); |
60 this._toolbarElement.appendChild(headerElement); | 60 this._toolbarElement.appendChild(headerElement); |
61 this._rightToolbarElement = this._toolbarElement.createChild("div", "toolbar
-controls-right"); | 61 this._rightToolbar = new WebInspector.StatusBar(this._toolbarElement); |
62 this._toolbarItems = []; | |
63 | 62 |
64 this._closeButtonToolbarItem = createElementWithClass("div", "toolbar-close-
button-item"); | 63 this._closeButtonToolbarItem = createElementWithClass("div", "toolbar-close-
button-item"); |
65 var closeButtonElement = this._closeButtonToolbarItem.createChild("div", "cl
ose-button"); | 64 var closeButtonElement = this._closeButtonToolbarItem.createChild("div", "cl
ose-button"); |
66 closeButtonElement.addEventListener("click", InspectorFrontendHost.closeWind
ow.bind(InspectorFrontendHost), true); | 65 closeButtonElement.addEventListener("click", InspectorFrontendHost.closeWind
ow.bind(InspectorFrontendHost), true); |
67 this._rightToolbarElement.appendChild(this._closeButtonToolbarItem); | 66 this._toolbarElement.appendChild(this._closeButtonToolbarItem); |
68 | 67 |
69 this._panels = {}; | 68 this._panels = {}; |
70 // Used by tests. | 69 // Used by tests. |
71 WebInspector["panels"] = this._panels; | 70 WebInspector["panels"] = this._panels; |
72 | 71 |
73 this._history = []; | 72 this._history = []; |
74 this._historyIterator = -1; | 73 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>} */ | 76 /** @type {!Object.<string, !WebInspector.PanelDescriptor>} */ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 this.addPanel(new WebInspector.RuntimeExtensionPanelDescriptor(exten
sion)); | 123 this.addPanel(new WebInspector.RuntimeExtensionPanelDescriptor(exten
sion)); |
125 } | 124 } |
126 WebInspector.endBatchUpdate(); | 125 WebInspector.endBatchUpdate(); |
127 }, | 126 }, |
128 | 127 |
129 /** | 128 /** |
130 * @param {!WebInspector.StatusBarItem} item | 129 * @param {!WebInspector.StatusBarItem} item |
131 */ | 130 */ |
132 appendToLeftToolbar: function(item) | 131 appendToLeftToolbar: function(item) |
133 { | 132 { |
134 this._toolbarItems.push(item); | 133 this._leftToolbar.appendStatusBarItem(item); |
135 this._leftToolbarElement.appendChild(item.element); | |
136 }, | 134 }, |
137 | 135 |
138 /** | 136 /** |
139 * @param {!WebInspector.StatusBarItem} item | 137 * @param {!WebInspector.StatusBarItem} item |
140 */ | 138 */ |
141 appendToRightToolbar: function(item) | 139 appendToRightToolbar: function(item) |
142 { | 140 { |
143 this._toolbarItems.push(item); | 141 this._rightToolbar.appendStatusBarItem(item); |
144 this._rightToolbarElement.insertBefore(item.element, this._closeButtonTo
olbarItem); | |
145 }, | 142 }, |
146 | 143 |
147 /** | 144 /** |
148 * @param {!WebInspector.PanelDescriptor} panelDescriptor | 145 * @param {!WebInspector.PanelDescriptor} panelDescriptor |
149 */ | 146 */ |
150 addPanel: function(panelDescriptor) | 147 addPanel: function(panelDescriptor) |
151 { | 148 { |
152 var panelName = panelDescriptor.name(); | 149 var panelName = panelDescriptor.name(); |
153 this._panelDescriptors[panelName] = panelDescriptor; | 150 this._panelDescriptors[panelName] = panelDescriptor; |
154 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn
spector.View()); | 151 this._tabbedPane.appendTab(panelName, panelDescriptor.title(), new WebIn
spector.View()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return promise; | 195 return promise; |
199 }, | 196 }, |
200 | 197 |
201 /** | 198 /** |
202 * @param {!WebInspector.Event} event | 199 * @param {!WebInspector.Event} event |
203 */ | 200 */ |
204 _onSuspendStateChanged: function(event) | 201 _onSuspendStateChanged: function(event) |
205 { | 202 { |
206 this._currentPanelLocked = WebInspector.targetManager.allTargetsSuspende
d(); | 203 this._currentPanelLocked = WebInspector.targetManager.allTargetsSuspende
d(); |
207 this._tabbedPane.setCurrentTabLocked(this._currentPanelLocked); | 204 this._tabbedPane.setCurrentTabLocked(this._currentPanelLocked); |
208 for (var i = 0; i < this._toolbarItems.length; ++i) | 205 this._leftToolbar.setEnabled(!this._currentPanelLocked); |
209 this._toolbarItems[i].setEnabled(!this._currentPanelLocked); | 206 this._rightToolbar.setEnabled(!this._currentPanelLocked); |
210 }, | 207 }, |
211 | 208 |
212 /** | 209 /** |
213 * The returned Promise is resolved with null if another showPanel() | 210 * The returned Promise is resolved with null if another showPanel() |
214 * gets called while this.panel(panelName) Promise is in flight. | 211 * gets called while this.panel(panelName) Promise is in flight. |
215 * | 212 * |
216 * @param {string} panelName | 213 * @param {string} panelName |
217 * @return {!Promise.<?WebInspector.Panel>} | 214 * @return {!Promise.<?WebInspector.Panel>} |
218 */ | 215 */ |
219 showPanel: function(panelName) | 216 showPanel: function(panelName) |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 543 |
547 WebInspector.InspectorView.ToggleDrawerButtonProvider.prototype = { | 544 WebInspector.InspectorView.ToggleDrawerButtonProvider.prototype = { |
548 /** | 545 /** |
549 * @return {?WebInspector.StatusBarItem} | 546 * @return {?WebInspector.StatusBarItem} |
550 */ | 547 */ |
551 item: function() | 548 item: function() |
552 { | 549 { |
553 return WebInspector.inspectorView._drawer.toggleButton(); | 550 return WebInspector.inspectorView._drawer.toggleButton(); |
554 } | 551 } |
555 } | 552 } |
OLD | NEW |