OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 for (var i = 0; i < tabs.length; ++i) { | 292 for (var i = 0; i < tabs.length; ++i) { |
293 if (tabs[i].id !== id) | 293 if (tabs[i].id !== id) |
294 result.push(tabs[i].id); | 294 result.push(tabs[i].id); |
295 } | 295 } |
296 return result; | 296 return result; |
297 }, | 297 }, |
298 | 298 |
299 /** | 299 /** |
300 * @param {string} id | 300 * @param {string} id |
301 * @param {boolean=} userGesture | 301 * @param {boolean=} userGesture |
| 302 * @return {boolean} |
302 */ | 303 */ |
303 selectTab: function(id, userGesture) | 304 selectTab: function(id, userGesture) |
304 { | 305 { |
305 var focused = this.hasFocus(); | 306 var focused = this.hasFocus(); |
306 var tab = this._tabsById[id]; | 307 var tab = this._tabsById[id]; |
307 if (!tab) | 308 if (!tab) |
308 return; | 309 return false; |
309 if (this._currentTab && this._currentTab.id === id) | 310 if (this._currentTab && this._currentTab.id === id) |
310 return; | 311 return true; |
311 | 312 |
312 this._hideCurrentTab(); | 313 this._hideCurrentTab(); |
313 this._showTab(tab); | 314 this._showTab(tab); |
314 this._currentTab = tab; | 315 this._currentTab = tab; |
315 | 316 |
316 this._tabsHistory.splice(this._tabsHistory.indexOf(tab), 1); | 317 this._tabsHistory.splice(this._tabsHistory.indexOf(tab), 1); |
317 this._tabsHistory.splice(0, 0, tab); | 318 this._tabsHistory.splice(0, 0, tab); |
318 | 319 |
319 this._updateTabElements(); | 320 this._updateTabElements(); |
320 if (focused) | 321 if (focused) |
321 this.focus(); | 322 this.focus(); |
322 | 323 |
323 var eventData = { tabId: id, view: tab.view, isUserGesture: userGesture
}; | 324 var eventData = { tabId: id, view: tab.view, isUserGesture: userGesture
}; |
324 this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabSele
cted, eventData); | 325 this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabSele
cted, eventData); |
| 326 return true; |
325 }, | 327 }, |
326 | 328 |
327 /** | 329 /** |
328 * @param {number} tabsCount | 330 * @param {number} tabsCount |
329 * @return {!Array.<string>} | 331 * @return {!Array.<string>} |
330 */ | 332 */ |
331 lastOpenedTabIds: function(tabsCount) | 333 lastOpenedTabIds: function(tabsCount) |
332 { | 334 { |
333 function tabToTabId(tab) { | 335 function tabToTabId(tab) { |
334 return tab.id; | 336 return tab.id; |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 { | 1171 { |
1170 if (this._views.contains(id)) | 1172 if (this._views.contains(id)) |
1171 return /** @type {!WebInspector.View} */ (this._views.get(id)); | 1173 return /** @type {!WebInspector.View} */ (this._views.get(id)); |
1172 var view = this._extensions[id] ? /** @type {!WebInspector.View} */ (thi
s._extensions[id].instance()) : null; | 1174 var view = this._extensions[id] ? /** @type {!WebInspector.View} */ (thi
s._extensions[id].instance()) : null; |
1173 this._views.put(id, view); | 1175 this._views.put(id, view); |
1174 if (this._viewCallback && view) | 1176 if (this._viewCallback && view) |
1175 this._viewCallback(id, view); | 1177 this._viewCallback(id, view); |
1176 return view; | 1178 return view; |
1177 } | 1179 } |
1178 } | 1180 } |
OLD | NEW |