Chromium Code Reviews| 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 var shouldFocus = this.element.hasFocus(); | |
| 454 this.setDefaultFocusedElement(null); | |
| 455 widget.show(this.element); | |
| 456 if (shouldFocus) | |
| 457 widget.focus(); | |
| 458 })); | |
|
luoe
2016/09/30 18:25:36
Can we separate out this function?
promises.push(
dgozman
2016/09/30 20:27:19
Good question. I feel like we are steering towards
| |
| 451 this._materializePromise = Promise.all(promises); | 459 this._materializePromise = Promise.all(promises); |
| 452 return this._materializePromise; | 460 return this._materializePromise; |
| 453 }, | 461 }, |
| 454 | 462 |
| 455 __proto__: WebInspector.VBox.prototype | 463 __proto__: WebInspector.VBox.prototype |
| 456 } | 464 } |
| 457 | 465 |
| 458 /** | 466 /** |
| 459 * @constructor | 467 * @constructor |
| 460 * @extends {WebInspector.VBox} | 468 * @extends {WebInspector.VBox} |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 | 697 |
| 690 /** | 698 /** |
| 691 * @override | 699 * @override |
| 692 * @param {!WebInspector.View} view | 700 * @param {!WebInspector.View} view |
| 693 * @param {?WebInspector.View=} insertBefore | 701 * @param {?WebInspector.View=} insertBefore |
| 694 * @return {!Promise} | 702 * @return {!Promise} |
| 695 */ | 703 */ |
| 696 showView: function(view, insertBefore) | 704 showView: function(view, insertBefore) |
| 697 { | 705 { |
| 698 this.appendView(view, insertBefore); | 706 this.appendView(view, insertBefore); |
| 707 this._tabbedPane.selectTab(view.viewId()); | |
| 699 this._tabbedPane.focus(); | 708 this._tabbedPane.focus(); |
| 700 this._tabbedPane.selectTab(view.viewId()); | |
| 701 return this._materializeWidget(view); | 709 return this._materializeWidget(view); |
| 702 }, | 710 }, |
| 703 | 711 |
| 704 /** | 712 /** |
| 705 * @param {!WebInspector.View} view | 713 * @param {!WebInspector.View} view |
| 706 * @override | 714 * @override |
| 707 */ | 715 */ |
| 708 removeView: function(view) | 716 removeView: function(view) |
| 709 { | 717 { |
| 710 if (!this._tabbedPane.hasTab(view.viewId())) | 718 if (!this._tabbedPane.hasTab(view.viewId())) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 849 this.appendView(view); | 857 this.appendView(view); |
| 850 }, | 858 }, |
| 851 | 859 |
| 852 __proto__: WebInspector.ViewManager._Location.prototype | 860 __proto__: WebInspector.ViewManager._Location.prototype |
| 853 } | 861 } |
| 854 | 862 |
| 855 /** | 863 /** |
| 856 * @type {!WebInspector.ViewManager} | 864 * @type {!WebInspector.ViewManager} |
| 857 */ | 865 */ |
| 858 WebInspector.viewManager; | 866 WebInspector.viewManager; |
| OLD | NEW |