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 |
11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
13 * distribution. | 13 * distribution. |
14 * * Neither the name of Google Inc. nor the names of its | 14 * * Neither the name of Google Inc. nor the names of its |
15 * contributors may be used to endorse or promote products derived from | 15 * contributors may be used to endorse or promote products derived from |
16 * this software without specific prior written permission. | 16 * this software without specific prior written permission. |
17 * | 17 * |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | |
31 /** | 30 /** |
32 * @constructor | |
33 * @extends {WebInspector.VBox} | |
34 * @implements {WebInspector.ViewLocationResolver} | 31 * @implements {WebInspector.ViewLocationResolver} |
| 32 * @unrestricted |
35 */ | 33 */ |
36 WebInspector.InspectorView = function() | 34 WebInspector.InspectorView = class extends WebInspector.VBox { |
37 { | 35 constructor() { |
38 WebInspector.VBox.call(this); | 36 super(); |
39 WebInspector.Dialog.setModalHostView(this); | 37 WebInspector.Dialog.setModalHostView(this); |
40 this.setMinimumSize(240, 72); | 38 this.setMinimumSize(240, 72); |
41 | 39 |
42 // DevTools sidebar is a vertical split of panels tabbed pane and a drawer. | 40 // DevTools sidebar is a vertical split of panels tabbed pane and a drawer. |
43 this._drawerSplitWidget = new WebInspector.SplitWidget(false, true, "Inspect
or.drawerSplitViewState", 200, 200); | 41 this._drawerSplitWidget = new WebInspector.SplitWidget(false, true, 'Inspect
or.drawerSplitViewState', 200, 200); |
44 this._drawerSplitWidget.hideSidebar(); | 42 this._drawerSplitWidget.hideSidebar(); |
45 this._drawerSplitWidget.hideDefaultResizer(); | 43 this._drawerSplitWidget.hideDefaultResizer(); |
46 this._drawerSplitWidget.enableShowModeSaving(); | 44 this._drawerSplitWidget.enableShowModeSaving(); |
47 this._drawerSplitWidget.show(this.element); | 45 this._drawerSplitWidget.show(this.element); |
48 | 46 |
49 // Create drawer tabbed pane. | 47 // Create drawer tabbed pane. |
50 this._drawerTabbedLocation = WebInspector.viewManager.createTabbedLocation(t
his._showDrawer.bind(this, false), "drawer-view", true); | 48 this._drawerTabbedLocation = |
| 49 WebInspector.viewManager.createTabbedLocation(this._showDrawer.bind(this
, false), 'drawer-view', true); |
51 this._drawerTabbedLocation.enableMoreTabsButton(); | 50 this._drawerTabbedLocation.enableMoreTabsButton(); |
52 this._drawerTabbedPane = this._drawerTabbedLocation.tabbedPane(); | 51 this._drawerTabbedPane = this._drawerTabbedLocation.tabbedPane(); |
53 this._drawerTabbedPane.setMinimumSize(0, 27); | 52 this._drawerTabbedPane.setMinimumSize(0, 27); |
54 var closeDrawerButton = new WebInspector.ToolbarButton(WebInspector.UIString
("Close drawer"), "delete-toolbar-item"); | 53 var closeDrawerButton = |
55 closeDrawerButton.addEventListener("click", this._closeDrawer.bind(this)); | 54 new WebInspector.ToolbarButton(WebInspector.UIString('Close drawer'), 'd
elete-toolbar-item'); |
| 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._tabbedLocation = WebInspector.viewManager.createTabbedLocation(Inspect
orFrontendHost.bringToFront.bind(InspectorFrontendHost), "panel", true, true); | 61 this._tabbedLocation = WebInspector.viewManager.createTabbedLocation( |
| 62 InspectorFrontendHost.bringToFront.bind(InspectorFrontendHost), 'panel',
true, true); |
62 this._tabbedPane = this._tabbedLocation.tabbedPane(); | 63 this._tabbedPane = this._tabbedLocation.tabbedPane(); |
63 this._tabbedPane.registerRequiredCSS("ui/inspectorViewTabbedPane.css"); | 64 this._tabbedPane.registerRequiredCSS('ui/inspectorViewTabbedPane.css'); |
64 this._tabbedPane.setTabSlider(true); | 65 this._tabbedPane.setTabSlider(true); |
65 this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabSelected
, this._tabSelected, this); | 66 this._tabbedPane.addEventListener(WebInspector.TabbedPane.Events.TabSelected
, this._tabSelected, this); |
66 | 67 |
67 if (InspectorFrontendHost.isUnderTest()) | 68 if (InspectorFrontendHost.isUnderTest()) |
68 this._tabbedPane.setAutoSelectFirstItemOnShow(false); | 69 this._tabbedPane.setAutoSelectFirstItemOnShow(false); |
69 this._drawerSplitWidget.setMainWidget(this._tabbedPane); | 70 this._drawerSplitWidget.setMainWidget(this._tabbedPane); |
70 | 71 |
71 this._keyDownBound = this._keyDown.bind(this); | 72 this._keyDownBound = this._keyDown.bind(this); |
72 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.ShowPanel, showPanel.bind(this)); | 73 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.ShowPanel, showPanel.bind(this)); |
73 | 74 |
74 /** | 75 /** |
75 * @this {WebInspector.InspectorView} | 76 * @this {WebInspector.InspectorView} |
76 * @param {!WebInspector.Event} event | 77 * @param {!WebInspector.Event} event |
77 */ | 78 */ |
78 function showPanel(event) | 79 function showPanel(event) { |
79 { | 80 var panelName = /** @type {string} */ (event.data); |
80 var panelName = /** @type {string} */ (event.data); | 81 this.showPanel(panelName); |
81 this.showPanel(panelName); | |
82 } | 82 } |
| 83 } |
| 84 |
| 85 /** |
| 86 * @return {!WebInspector.InspectorView} |
| 87 */ |
| 88 static instance() { |
| 89 return /** @type {!WebInspector.InspectorView} */ (self.runtime.sharedInstan
ce(WebInspector.InspectorView)); |
| 90 } |
| 91 |
| 92 /** |
| 93 * @override |
| 94 */ |
| 95 wasShown() { |
| 96 this.element.ownerDocument.addEventListener('keydown', this._keyDownBound, f
alse); |
| 97 } |
| 98 |
| 99 /** |
| 100 * @override |
| 101 */ |
| 102 willHide() { |
| 103 this.element.ownerDocument.removeEventListener('keydown', this._keyDownBound
, false); |
| 104 } |
| 105 |
| 106 /** |
| 107 * @override |
| 108 * @param {string} locationName |
| 109 * @return {?WebInspector.ViewLocation} |
| 110 */ |
| 111 resolveLocation(locationName) { |
| 112 return this._drawerTabbedLocation; |
| 113 } |
| 114 |
| 115 createToolbars() { |
| 116 this._tabbedPane.leftToolbar().appendLocationItems('main-toolbar-left'); |
| 117 this._tabbedPane.rightToolbar().appendLocationItems('main-toolbar-right'); |
| 118 } |
| 119 |
| 120 /** |
| 121 * @param {!WebInspector.View} view |
| 122 */ |
| 123 addPanel(view) { |
| 124 this._tabbedLocation.appendView(view); |
| 125 } |
| 126 |
| 127 /** |
| 128 * @param {string} panelName |
| 129 * @return {boolean} |
| 130 */ |
| 131 hasPanel(panelName) { |
| 132 return this._tabbedPane.hasTab(panelName); |
| 133 } |
| 134 |
| 135 /** |
| 136 * @param {string} panelName |
| 137 * @return {!Promise.<!WebInspector.Panel>} |
| 138 */ |
| 139 panel(panelName) { |
| 140 return /** @type {!Promise.<!WebInspector.Panel>} */ (WebInspector.viewManag
er.view(panelName).widget()); |
| 141 } |
| 142 |
| 143 /** |
| 144 * @param {boolean} allTargetsSuspended |
| 145 */ |
| 146 onSuspendStateChanged(allTargetsSuspended) { |
| 147 this._currentPanelLocked = allTargetsSuspended; |
| 148 this._tabbedPane.setCurrentTabLocked(this._currentPanelLocked); |
| 149 this._tabbedPane.leftToolbar().setEnabled(!this._currentPanelLocked); |
| 150 this._tabbedPane.rightToolbar().setEnabled(!this._currentPanelLocked); |
| 151 } |
| 152 |
| 153 /** |
| 154 * @param {string} panelName |
| 155 * @return {boolean} |
| 156 */ |
| 157 canSelectPanel(panelName) { |
| 158 return !this._currentPanelLocked || this._tabbedPane.selectedTabId === panel
Name; |
| 159 } |
| 160 |
| 161 /** |
| 162 * @param {string} panelName |
| 163 * @return {!Promise.<?WebInspector.Panel>} |
| 164 */ |
| 165 showPanel(panelName) { |
| 166 return WebInspector.viewManager.showView(panelName); |
| 167 } |
| 168 |
| 169 /** |
| 170 * @param {string} panelName |
| 171 * @param {string} iconType |
| 172 * @param {string=} iconTooltip |
| 173 */ |
| 174 setPanelIcon(panelName, iconType, iconTooltip) { |
| 175 this._tabbedPane.setTabIcon(panelName, iconType, iconTooltip); |
| 176 } |
| 177 |
| 178 /** |
| 179 * @return {!WebInspector.Panel} |
| 180 */ |
| 181 currentPanelDeprecated() { |
| 182 return /** @type {!WebInspector.Panel} */ ( |
| 183 WebInspector.viewManager.materializedWidget(this._tabbedPane.selectedTab
Id || '')); |
| 184 } |
| 185 |
| 186 /** |
| 187 * @param {boolean} focus |
| 188 */ |
| 189 _showDrawer(focus) { |
| 190 if (this._drawerTabbedPane.isShowing()) |
| 191 return; |
| 192 this._drawerSplitWidget.showBoth(); |
| 193 if (focus) |
| 194 this._focusRestorer = new WebInspector.WidgetFocusRestorer(this._drawerTab
bedPane); |
| 195 else |
| 196 this._focusRestorer = null; |
| 197 } |
| 198 |
| 199 /** |
| 200 * @return {boolean} |
| 201 */ |
| 202 drawerVisible() { |
| 203 return this._drawerTabbedPane.isShowing(); |
| 204 } |
| 205 |
| 206 _closeDrawer() { |
| 207 if (!this._drawerTabbedPane.isShowing()) |
| 208 return; |
| 209 if (this._focusRestorer) |
| 210 this._focusRestorer.restore(); |
| 211 this._drawerSplitWidget.hideSidebar(true); |
| 212 } |
| 213 |
| 214 /** |
| 215 * @param {boolean} minimized |
| 216 */ |
| 217 setDrawerMinimized(minimized) { |
| 218 this._drawerSplitWidget.setSidebarMinimized(minimized); |
| 219 this._drawerSplitWidget.setResizable(!minimized); |
| 220 } |
| 221 |
| 222 /** |
| 223 * @return {boolean} |
| 224 */ |
| 225 isDrawerMinimized() { |
| 226 return this._drawerSplitWidget.isSidebarMinimized(); |
| 227 } |
| 228 |
| 229 _keyDown(event) { |
| 230 if (!WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) |
| 231 return; |
| 232 |
| 233 var keyboardEvent = /** @type {!KeyboardEvent} */ (event); |
| 234 // Ctrl/Cmd + 1-9 should show corresponding panel. |
| 235 var panelShortcutEnabled = WebInspector.moduleSetting('shortcutPanelSwitch')
.get(); |
| 236 if (panelShortcutEnabled && !event.shiftKey && !event.altKey) { |
| 237 var panelIndex = -1; |
| 238 if (event.keyCode > 0x30 && event.keyCode < 0x3A) |
| 239 panelIndex = event.keyCode - 0x31; |
| 240 else if ( |
| 241 event.keyCode > 0x60 && event.keyCode < 0x6A && |
| 242 keyboardEvent.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) |
| 243 panelIndex = event.keyCode - 0x61; |
| 244 if (panelIndex !== -1) { |
| 245 var panelName = this._tabbedPane.allTabs()[panelIndex]; |
| 246 if (panelName) { |
| 247 if (!WebInspector.Dialog.hasInstance() && !this._currentPanelLocked) |
| 248 this.showPanel(panelName); |
| 249 event.consume(true); |
| 250 } |
| 251 } |
| 252 } |
| 253 } |
| 254 |
| 255 /** |
| 256 * @override |
| 257 */ |
| 258 onResize() { |
| 259 WebInspector.Dialog.modalHostRepositioned(); |
| 260 } |
| 261 |
| 262 /** |
| 263 * @return {!Element} |
| 264 */ |
| 265 topResizerElement() { |
| 266 return this._tabbedPane.headerElement(); |
| 267 } |
| 268 |
| 269 toolbarItemResized() { |
| 270 this._tabbedPane.headerResized(); |
| 271 } |
| 272 |
| 273 /** |
| 274 * @param {!WebInspector.Event} event |
| 275 */ |
| 276 _tabSelected(event) { |
| 277 var tabId = /** @type {string} */ (event.data['tabId']); |
| 278 WebInspector.userMetrics.panelShown(tabId); |
| 279 } |
| 280 |
| 281 /** |
| 282 * @param {!WebInspector.SplitWidget} splitWidget |
| 283 */ |
| 284 setOwnerSplit(splitWidget) { |
| 285 this._ownerSplitWidget = splitWidget; |
| 286 } |
| 287 |
| 288 minimize() { |
| 289 if (this._ownerSplitWidget) |
| 290 this._ownerSplitWidget.setSidebarMinimized(true); |
| 291 } |
| 292 |
| 293 restore() { |
| 294 if (this._ownerSplitWidget) |
| 295 this._ownerSplitWidget.setSidebarMinimized(false); |
| 296 } |
83 }; | 297 }; |
84 | 298 |
85 /** | |
86 * @return {!WebInspector.InspectorView} | |
87 */ | |
88 WebInspector.InspectorView.instance = function() | |
89 { | |
90 return /** @type {!WebInspector.InspectorView} */ (self.runtime.sharedInstan
ce(WebInspector.InspectorView)); | |
91 }; | |
92 | |
93 WebInspector.InspectorView.prototype = { | |
94 wasShown: function() | |
95 { | |
96 this.element.ownerDocument.addEventListener("keydown", this._keyDownBoun
d, false); | |
97 }, | |
98 | |
99 willHide: function() | |
100 { | |
101 this.element.ownerDocument.removeEventListener("keydown", this._keyDownB
ound, false); | |
102 }, | |
103 | |
104 /** | |
105 * @override | |
106 * @param {string} locationName | |
107 * @return {?WebInspector.ViewLocation} | |
108 */ | |
109 resolveLocation: function(locationName) | |
110 { | |
111 return this._drawerTabbedLocation; | |
112 }, | |
113 | |
114 createToolbars: function() | |
115 { | |
116 this._tabbedPane.leftToolbar().appendLocationItems("main-toolbar-left"); | |
117 this._tabbedPane.rightToolbar().appendLocationItems("main-toolbar-right"
); | |
118 }, | |
119 | |
120 /** | |
121 * @param {!WebInspector.View} view | |
122 */ | |
123 addPanel: function(view) | |
124 { | |
125 this._tabbedLocation.appendView(view); | |
126 }, | |
127 | |
128 /** | |
129 * @param {string} panelName | |
130 * @return {boolean} | |
131 */ | |
132 hasPanel: function(panelName) | |
133 { | |
134 return this._tabbedPane.hasTab(panelName); | |
135 }, | |
136 | |
137 /** | |
138 * @param {string} panelName | |
139 * @return {!Promise.<!WebInspector.Panel>} | |
140 */ | |
141 panel: function(panelName) | |
142 { | |
143 return /** @type {!Promise.<!WebInspector.Panel>} */ (WebInspector.viewM
anager.view(panelName).widget()); | |
144 }, | |
145 | |
146 /** | |
147 * @param {boolean} allTargetsSuspended | |
148 */ | |
149 onSuspendStateChanged: function(allTargetsSuspended) | |
150 { | |
151 this._currentPanelLocked = allTargetsSuspended; | |
152 this._tabbedPane.setCurrentTabLocked(this._currentPanelLocked); | |
153 this._tabbedPane.leftToolbar().setEnabled(!this._currentPanelLocked); | |
154 this._tabbedPane.rightToolbar().setEnabled(!this._currentPanelLocked); | |
155 }, | |
156 | |
157 /** | |
158 * @param {string} panelName | |
159 * @return {boolean} | |
160 */ | |
161 canSelectPanel: function(panelName) | |
162 { | |
163 return !this._currentPanelLocked || this._tabbedPane.selectedTabId === p
anelName; | |
164 }, | |
165 | |
166 /** | |
167 * @param {string} panelName | |
168 * @return {!Promise.<?WebInspector.Panel>} | |
169 */ | |
170 showPanel: function(panelName) | |
171 { | |
172 return WebInspector.viewManager.showView(panelName); | |
173 }, | |
174 | |
175 /** | |
176 * @param {string} panelName | |
177 * @param {string} iconType | |
178 * @param {string=} iconTooltip | |
179 */ | |
180 setPanelIcon: function(panelName, iconType, iconTooltip) | |
181 { | |
182 this._tabbedPane.setTabIcon(panelName, iconType, iconTooltip); | |
183 }, | |
184 | |
185 /** | |
186 * @return {!WebInspector.Panel} | |
187 */ | |
188 currentPanelDeprecated: function() | |
189 { | |
190 return /** @type {!WebInspector.Panel} */ (WebInspector.viewManager.mate
rializedWidget(this._tabbedPane.selectedTabId || "")); | |
191 }, | |
192 | |
193 /** | |
194 * @param {boolean} focus | |
195 */ | |
196 _showDrawer: function(focus) | |
197 { | |
198 if (this._drawerTabbedPane.isShowing()) | |
199 return; | |
200 this._drawerSplitWidget.showBoth(); | |
201 if (focus) | |
202 this._focusRestorer = new WebInspector.WidgetFocusRestorer(this._dra
werTabbedPane); | |
203 else | |
204 this._focusRestorer = null; | |
205 }, | |
206 | |
207 /** | |
208 * @return {boolean} | |
209 */ | |
210 drawerVisible: function() | |
211 { | |
212 return this._drawerTabbedPane.isShowing(); | |
213 }, | |
214 | |
215 _closeDrawer: function() | |
216 { | |
217 if (!this._drawerTabbedPane.isShowing()) | |
218 return; | |
219 if (this._focusRestorer) | |
220 this._focusRestorer.restore(); | |
221 this._drawerSplitWidget.hideSidebar(true); | |
222 }, | |
223 | |
224 /** | |
225 * @param {boolean} minimized | |
226 */ | |
227 setDrawerMinimized: function(minimized) | |
228 { | |
229 this._drawerSplitWidget.setSidebarMinimized(minimized); | |
230 this._drawerSplitWidget.setResizable(!minimized); | |
231 }, | |
232 | |
233 /** | |
234 * @return {boolean} | |
235 */ | |
236 isDrawerMinimized: function() | |
237 { | |
238 return this._drawerSplitWidget.isSidebarMinimized(); | |
239 }, | |
240 | |
241 _keyDown: function(event) | |
242 { | |
243 if (!WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) | |
244 return; | |
245 | |
246 var keyboardEvent = /** @type {!KeyboardEvent} */ (event); | |
247 // Ctrl/Cmd + 1-9 should show corresponding panel. | |
248 var panelShortcutEnabled = WebInspector.moduleSetting("shortcutPanelSwit
ch").get(); | |
249 if (panelShortcutEnabled && !event.shiftKey && !event.altKey) { | |
250 var panelIndex = -1; | |
251 if (event.keyCode > 0x30 && event.keyCode < 0x3A) | |
252 panelIndex = event.keyCode - 0x31; | |
253 else if (event.keyCode > 0x60 && event.keyCode < 0x6A && keyboardEve
nt.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) | |
254 panelIndex = event.keyCode - 0x61; | |
255 if (panelIndex !== -1) { | |
256 var panelName = this._tabbedPane.allTabs()[panelIndex]; | |
257 if (panelName) { | |
258 if (!WebInspector.Dialog.hasInstance() && !this._currentPane
lLocked) | |
259 this.showPanel(panelName); | |
260 event.consume(true); | |
261 } | |
262 } | |
263 } | |
264 }, | |
265 | |
266 onResize: function() | |
267 { | |
268 WebInspector.Dialog.modalHostRepositioned(); | |
269 }, | |
270 | |
271 /** | |
272 * @return {!Element} | |
273 */ | |
274 topResizerElement: function() | |
275 { | |
276 return this._tabbedPane.headerElement(); | |
277 }, | |
278 | |
279 toolbarItemResized: function() | |
280 { | |
281 this._tabbedPane.headerResized(); | |
282 }, | |
283 | |
284 /** | |
285 * @param {!WebInspector.Event} event | |
286 */ | |
287 _tabSelected: function(event) | |
288 { | |
289 var tabId = /** @type {string} */(event.data["tabId"]); | |
290 WebInspector.userMetrics.panelShown(tabId); | |
291 }, | |
292 | |
293 /** | |
294 * @param {!WebInspector.SplitWidget} splitWidget | |
295 */ | |
296 setOwnerSplit: function(splitWidget) | |
297 { | |
298 this._ownerSplitWidget = splitWidget; | |
299 }, | |
300 | |
301 minimize: function() | |
302 { | |
303 if (this._ownerSplitWidget) | |
304 this._ownerSplitWidget.setSidebarMinimized(true); | |
305 }, | |
306 | |
307 restore: function() | |
308 { | |
309 if (this._ownerSplitWidget) | |
310 this._ownerSplitWidget.setSidebarMinimized(false); | |
311 }, | |
312 | |
313 __proto__: WebInspector.VBox.prototype | |
314 }; | |
315 | 299 |
316 /** | 300 /** |
317 * @type {!WebInspector.InspectorView} | 301 * @type {!WebInspector.InspectorView} |
318 */ | 302 */ |
319 WebInspector.inspectorView; | 303 WebInspector.inspectorView; |
320 | 304 |
321 /** | 305 /** |
322 * @constructor | |
323 * @implements {WebInspector.ActionDelegate} | 306 * @implements {WebInspector.ActionDelegate} |
| 307 * @unrestricted |
324 */ | 308 */ |
325 WebInspector.InspectorView.DrawerToggleActionDelegate = function() | 309 WebInspector.InspectorView.DrawerToggleActionDelegate = class { |
326 { | 310 /** |
| 311 * @override |
| 312 * @param {!WebInspector.Context} context |
| 313 * @param {string} actionId |
| 314 * @return {boolean} |
| 315 */ |
| 316 handleAction(context, actionId) { |
| 317 if (WebInspector.inspectorView.drawerVisible()) |
| 318 WebInspector.inspectorView._closeDrawer(); |
| 319 else |
| 320 WebInspector.inspectorView._showDrawer(true); |
| 321 return true; |
| 322 } |
327 }; | 323 }; |
328 | |
329 WebInspector.InspectorView.DrawerToggleActionDelegate.prototype = { | |
330 /** | |
331 * @override | |
332 * @param {!WebInspector.Context} context | |
333 * @param {string} actionId | |
334 * @return {boolean} | |
335 */ | |
336 handleAction: function(context, actionId) | |
337 { | |
338 if (WebInspector.inspectorView.drawerVisible()) | |
339 WebInspector.inspectorView._closeDrawer(); | |
340 else | |
341 WebInspector.inspectorView._showDrawer(true); | |
342 return true; | |
343 } | |
344 }; | |
OLD | NEW |