| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @interface | 6 * @interface |
| 7 */ | 7 */ |
| 8 WebInspector.View = function() | 8 WebInspector.View = function() |
| 9 { | 9 { |
| 10 } | 10 } |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 /** | 428 /** |
| 429 * @constructor | 429 * @constructor |
| 430 * @extends {WebInspector.VBox} | 430 * @extends {WebInspector.VBox} |
| 431 * @param {!WebInspector.View} view | 431 * @param {!WebInspector.View} view |
| 432 */ | 432 */ |
| 433 WebInspector.ViewManager._ContainerWidget = function(view) | 433 WebInspector.ViewManager._ContainerWidget = function(view) |
| 434 { | 434 { |
| 435 WebInspector.VBox.call(this); | 435 WebInspector.VBox.call(this); |
| 436 this.element.classList.add("flex-auto", "view-container", "overflow-auto"); | 436 this.element.classList.add("flex-auto", "view-container", "overflow-auto"); |
| 437 this._view = view; | 437 this._view = view; |
| 438 this.element.tabIndex = 0; |
| 439 this.setDefaultFocusedElement(this.element); |
| 438 } | 440 } |
| 439 | 441 |
| 440 WebInspector.ViewManager._ContainerWidget.prototype = { | 442 WebInspector.ViewManager._ContainerWidget.prototype = { |
| 441 /** | 443 /** |
| 442 * @return {!Promise} | 444 * @return {!Promise} |
| 443 */ | 445 */ |
| 444 _materialize: function() | 446 _materialize: function() |
| 445 { | 447 { |
| 446 if (this._materializePromise) | 448 if (this._materializePromise) |
| 447 return this._materializePromise; | 449 return this._materializePromise; |
| 448 var promises = []; | 450 var promises = []; |
| 449 promises.push(this._view.toolbarItems().then(WebInspector.ViewManager._p
opulateToolbar.bind(WebInspector.ViewManager, this.element))); | 451 promises.push(this._view.toolbarItems().then(WebInspector.ViewManager._p
opulateToolbar.bind(WebInspector.ViewManager, this.element))); |
| 450 promises.push(this._view.widget().then(widget => widget.show(this.elemen
t))); | 452 promises.push(this._view.widget().then(widget => { |
| 453 // Move focus from |this| to loaded |widget| if any. |
| 454 var shouldFocus = this.element.hasFocus(); |
| 455 this.setDefaultFocusedElement(null); |
| 456 widget.show(this.element); |
| 457 if (shouldFocus) |
| 458 widget.focus(); |
| 459 })); |
| 451 this._materializePromise = Promise.all(promises); | 460 this._materializePromise = Promise.all(promises); |
| 452 return this._materializePromise; | 461 return this._materializePromise; |
| 453 }, | 462 }, |
| 454 | 463 |
| 455 __proto__: WebInspector.VBox.prototype | 464 __proto__: WebInspector.VBox.prototype |
| 456 } | 465 } |
| 457 | 466 |
| 458 /** | 467 /** |
| 459 * @constructor | 468 * @constructor |
| 460 * @extends {WebInspector.VBox} | 469 * @extends {WebInspector.VBox} |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 | 698 |
| 690 /** | 699 /** |
| 691 * @override | 700 * @override |
| 692 * @param {!WebInspector.View} view | 701 * @param {!WebInspector.View} view |
| 693 * @param {?WebInspector.View=} insertBefore | 702 * @param {?WebInspector.View=} insertBefore |
| 694 * @return {!Promise} | 703 * @return {!Promise} |
| 695 */ | 704 */ |
| 696 showView: function(view, insertBefore) | 705 showView: function(view, insertBefore) |
| 697 { | 706 { |
| 698 this.appendView(view, insertBefore); | 707 this.appendView(view, insertBefore); |
| 708 this._tabbedPane.selectTab(view.viewId()); |
| 699 this._tabbedPane.focus(); | 709 this._tabbedPane.focus(); |
| 700 this._tabbedPane.selectTab(view.viewId()); | |
| 701 return this._materializeWidget(view); | 710 return this._materializeWidget(view); |
| 702 }, | 711 }, |
| 703 | 712 |
| 704 /** | 713 /** |
| 705 * @param {!WebInspector.View} view | 714 * @param {!WebInspector.View} view |
| 706 * @override | 715 * @override |
| 707 */ | 716 */ |
| 708 removeView: function(view) | 717 removeView: function(view) |
| 709 { | 718 { |
| 710 if (!this._tabbedPane.hasTab(view.viewId())) | 719 if (!this._tabbedPane.hasTab(view.viewId())) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 this.appendView(view); | 858 this.appendView(view); |
| 850 }, | 859 }, |
| 851 | 860 |
| 852 __proto__: WebInspector.ViewManager._Location.prototype | 861 __proto__: WebInspector.ViewManager._Location.prototype |
| 853 } | 862 } |
| 854 | 863 |
| 855 /** | 864 /** |
| 856 * @type {!WebInspector.ViewManager} | 865 * @type {!WebInspector.ViewManager} |
| 857 */ | 866 */ |
| 858 WebInspector.viewManager; | 867 WebInspector.viewManager; |
| OLD | NEW |