Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/Widget.js

Issue 2157713002: DevTools: introduce View: a named widget with the toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 { 628 {
629 this._resizeCallback(); 629 this._resizeCallback();
630 }, 630 },
631 631
632 __proto__: WebInspector.VBox.prototype 632 __proto__: WebInspector.VBox.prototype
633 } 633 }
634 634
635 /** 635 /**
636 * @constructor 636 * @constructor
637 * @extends {WebInspector.VBox} 637 * @extends {WebInspector.VBox}
638 * @param {string} title
639 * @param {boolean=} isWebComponent
638 */ 640 */
639 WebInspector.VBoxWithToolbarItems = function() 641 WebInspector.View = function(title, isWebComponent)
640 { 642 {
641 WebInspector.VBox.call(this); 643 WebInspector.VBox.call(this, isWebComponent);
644 this._title = title;
645 /** @type {!Array<!WebInspector.ToolbarItem>} */
646 this._toolbarItems = [];
642 } 647 }
643 648
644 WebInspector.VBoxWithToolbarItems.prototype = { 649 WebInspector.View.prototype = {
650 /**
651 * @return {string}
652 */
653 title: function()
654 {
655 return this._title;
656 },
657
658 /**
659 * @param {function()} callback
660 */
661 setRevealCallback: function(callback)
662 {
663 this._revealCallback = callback;
664 if (this._setRevealRequested) {
665 callback();
666 delete this._setRevealRequested;
667 }
668 },
669
670 /**
671 * @param {function(boolean)} callback
672 */
673 setRequestVisibleCallback: function(callback)
674 {
675 this._requestVisibleCallback = callback;
676 if (this._setVisibleRequested !== undefined) {
677 callback(this._setVisibleRequested);
678 delete this._setVisibleRequested;
679 }
680 },
681
682 requestReveal: function()
683 {
684 if (this._revealCallback)
685 this._revealCallback();
686 else
687 this._setRevealRequested = true;
688 },
689
690 /**
691 * @param {boolean} visible
692 */
693 requestSetVisible: function(visible)
694 {
695 if (this._requestVisibleCallback)
696 this._requestVisibleCallback(visible);
697 else
698 this._setVisibleRequested = visible;
699 },
700
701 /**
702 * @param {!WebInspector.ToolbarItem} item
703 */
704 addToolbarItem: function(item)
705 {
706 this._toolbarItems.push(item);
707 },
708
645 /** 709 /**
646 * @return {!Array<!WebInspector.ToolbarItem>} 710 * @return {!Array<!WebInspector.ToolbarItem>}
647 */ 711 */
648 toolbarItems: function() 712 toolbarItems: function()
649 { 713 {
650 return []; 714 return this._toolbarItems;
651 }, 715 },
652 716
653 __proto__: WebInspector.VBox.prototype 717 __proto__: WebInspector.VBox.prototype
654 } 718 }
655 719
656 /** 720 /**
657 * @override 721 * @override
658 * @param {?Node} child 722 * @param {?Node} child
659 * @return {?Node} 723 * @return {?Node}
660 * @suppress {duplicate} 724 * @suppress {duplicate}
(...skipping 27 matching lines...) Expand all
688 { 752 {
689 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att empt to remove element containing widget via regular DOM operation"); 753 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att empt to remove element containing widget via regular DOM operation");
690 return WebInspector.Widget._originalRemoveChild.call(this, child); 754 return WebInspector.Widget._originalRemoveChild.call(this, child);
691 } 755 }
692 756
693 Element.prototype.removeChildren = function() 757 Element.prototype.removeChildren = function()
694 { 758 {
695 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme nt containing widget via regular DOM operation"); 759 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme nt containing widget via regular DOM operation");
696 WebInspector.Widget._originalRemoveChildren.call(this); 760 WebInspector.Widget._originalRemoveChildren.call(this);
697 } 761 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698