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

Side by Side Diff: Source/devtools/front_end/ui/Toolbar.js

Issue 1172643002: DevTools: migrate sidebar pane's titleElement to use Toolbar. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 13 matching lines...) Expand all
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 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @param {!Element=} parentElement 33 * @param {!Element=} parentElement
34 * @param {boolean=} withBorder
34 */ 35 */
35 WebInspector.Toolbar = function(parentElement) 36 WebInspector.Toolbar = function(parentElement, withBorder)
36 { 37 {
37 /** @type {!Array.<!WebInspector.ToolbarItem>} */ 38 /** @type {!Array.<!WebInspector.ToolbarItem>} */
38 this._items = []; 39 this._items = [];
39 this.element = parentElement ? parentElement.createChild("div", "toolbar") : createElementWithClass("div", "toolbar"); 40 this.element = parentElement ? parentElement.createChild("div", "toolbar") : createElementWithClass("div", "toolbar");
40
41 this._shadowRoot = WebInspector.createShadowRootWithCoreStyles(this.element) ; 41 this._shadowRoot = WebInspector.createShadowRootWithCoreStyles(this.element) ;
42 this._shadowRoot.appendChild(WebInspector.Widget.createStyleElement("ui/tool bar.css")); 42 this._shadowRoot.appendChild(WebInspector.Widget.createStyleElement("ui/tool bar.css"));
43 this._contentElement = this._shadowRoot.createChild("div", "toolbar-shadow") ; 43 this._contentElement = this._shadowRoot.createChild("div", "toolbar-shadow") ;
44 this._contentElement.createChild("content"); 44 this._contentElement.createChild("content");
45 if (withBorder)
dgozman 2015/06/09 13:27:02 Drop this one.
pfeldman 2015/06/09 13:40:59 Done.
46 this._contentElement.classList.add("with-border");
45 } 47 }
46 48
47 WebInspector.Toolbar.prototype = { 49 WebInspector.Toolbar.prototype = {
48 makeNarrow: function() 50 makeNarrow: function()
49 { 51 {
50 this._contentElement.classList.add("narrow"); 52 this._contentElement.classList.add("narrow");
51 }, 53 },
52 54
53 makeVertical: function() 55 makeVertical: function()
54 { 56 {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 function mouseUp(e) 533 function mouseUp(e)
532 { 534 {
533 if (e.which !== 1) 535 if (e.which !== 1)
534 return; 536 return;
535 optionsGlassPane.dispose(); 537 optionsGlassPane.dispose();
536 document.documentElement.removeEventListener("mouseup", mouseUp, fal se); 538 document.documentElement.removeEventListener("mouseup", mouseUp, fal se);
537 539
538 for (var i = 0; i < buttons.length; ++i) { 540 for (var i = 0; i < buttons.length; ++i) {
539 if (buttons[i].element.classList.contains("emulate-active")) { 541 if (buttons[i].element.classList.contains("emulate-active")) {
540 buttons[i].element.classList.remove("emulate-active"); 542 buttons[i].element.classList.remove("emulate-active");
541 buttons[i]._clicked(); 543 buttons[i]._clicked(e);
542 break; 544 break;
543 } 545 }
544 } 546 }
545 } 547 }
546 }, 548 },
547 549
548 __proto__: WebInspector.ToolbarItem.prototype 550 __proto__: WebInspector.ToolbarItem.prototype
549 } 551 }
550 552
551 /** 553 /**
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 }, 920 },
919 921
920 __proto__: WebInspector.ToolbarButton.prototype 922 __proto__: WebInspector.ToolbarButton.prototype
921 } 923 }
922 924
923 /** 925 /**
924 * @constructor 926 * @constructor
925 * @extends {WebInspector.Toolbar} 927 * @extends {WebInspector.Toolbar}
926 * @param {string} location 928 * @param {string} location
927 * @param {!Element=} parentElement 929 * @param {!Element=} parentElement
930 * @param {boolean=} withBorder
928 */ 931 */
929 WebInspector.ExtensibleToolbar = function(location, parentElement) 932 WebInspector.ExtensibleToolbar = function(location, parentElement, withBorder)
930 { 933 {
931 WebInspector.Toolbar.call(this, parentElement); 934 WebInspector.Toolbar.call(this, parentElement, withBorder);
932 this._loadItems(location); 935 this._loadItems(location);
933 } 936 }
934 937
935 WebInspector.ExtensibleToolbar.prototype = { 938 WebInspector.ExtensibleToolbar.prototype = {
936 /** 939 /**
937 * @param {string} location 940 * @param {string} location
938 */ 941 */
939 _loadItems: function(location) 942 _loadItems: function(location)
940 { 943 {
941 var extensions = self.runtime.extensions(WebInspector.ToolbarItem.Provid er); 944 var extensions = self.runtime.extensions(WebInspector.ToolbarItem.Provid er);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 for (var i = 0; i < items.length; ++i) { 994 for (var i = 0; i < items.length; ++i) {
992 var item = items[i]; 995 var item = items[i];
993 if (item) 996 if (item)
994 this.appendToolbarItem(item); 997 this.appendToolbarItem(item);
995 } 998 }
996 } 999 }
997 }, 1000 },
998 1001
999 __proto__: WebInspector.Toolbar.prototype 1002 __proto__: WebInspector.Toolbar.prototype
1000 } 1003 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698