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

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

Issue 732603002: DevTools: align more status bar button usages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/devtools/front_end/toolbox/responsiveDesignView.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 /** 363 /**
364 * @param {?function():!Array.<!WebInspector.StatusBarButton>} buttonsProvid er 364 * @param {?function():!Array.<!WebInspector.StatusBarButton>} buttonsProvid er
365 */ 365 */
366 setLongClickOptionsEnabled: function(buttonsProvider) 366 setLongClickOptionsEnabled: function(buttonsProvider)
367 { 367 {
368 if (buttonsProvider) { 368 if (buttonsProvider) {
369 if (!this._longClickOptionsData) { 369 if (!this._longClickOptionsData) {
370 this.makeLongClickEnabled(); 370 this.makeLongClickEnabled();
371 371
372 this.longClickGlyph = this.element.createChild("div", "fill long -click-glyph"); 372 this.longClickGlyph = this.element.createChild("div", "fill long -click-glyph");
373 this.longClickGlyphShadow = this.element.createChild("div", "fil l long-click-glyph shadow");
374 373
375 var longClickDownListener = this._showOptions.bind(this); 374 var longClickDownListener = this._showOptions.bind(this);
376 this.addEventListener("longClickDown", longClickDownListener, th is); 375 this.addEventListener("longClickDown", longClickDownListener, th is);
377 376
378 this._longClickOptionsData = { 377 this._longClickOptionsData = {
379 glyphElement: this.longClickGlyph, 378 glyphElement: this.longClickGlyph,
380 glyphShadowElement: this.longClickGlyphShadow,
381 longClickDownListener: longClickDownListener 379 longClickDownListener: longClickDownListener
382 }; 380 };
383 } 381 }
384 this._longClickOptionsData.buttonsProvider = buttonsProvider; 382 this._longClickOptionsData.buttonsProvider = buttonsProvider;
385 } else { 383 } else {
386 if (!this._longClickOptionsData) 384 if (!this._longClickOptionsData)
387 return; 385 return;
388 this.element.removeChild(this._longClickOptionsData.glyphElement); 386 this.element.removeChild(this._longClickOptionsData.glyphElement);
389 this.element.removeChild(this._longClickOptionsData.glyphShadowEleme nt);
390 387
391 this.removeEventListener("longClickDown", this._longClickOptionsData .longClickDownListener, this); 388 this.removeEventListener("longClickDown", this._longClickOptionsData .longClickDownListener, this);
392 delete this._longClickOptionsData; 389 delete this._longClickOptionsData;
393 390
394 this.unmakeLongClickEnabled(); 391 this.unmakeLongClickEnabled();
395 } 392 }
396 }, 393 },
397 394
398 _showOptions: function() 395 _showOptions: function()
399 { 396 {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 { 487 {
491 this.element.style.backgroundImage = "url(" + iconURL + ")"; 488 this.element.style.backgroundImage = "url(" + iconURL + ")";
492 this._glyphElement.classList.add("hidden"); 489 this._glyphElement.classList.add("hidden");
493 }, 490 },
494 491
495 __proto__: WebInspector.StatusBarButtonBase.prototype 492 __proto__: WebInspector.StatusBarButtonBase.prototype
496 } 493 }
497 494
498 /** 495 /**
499 * @constructor 496 * @constructor
500 * @param {!Element} parentElement 497 * @param {!Element=} parentElement
501 */ 498 */
502 WebInspector.StatusBar = function(parentElement) 499 WebInspector.StatusBar = function(parentElement)
503 { 500 {
504 /** @type {!Array.<!WebInspector.StatusBarItem>} */ 501 /** @type {!Array.<!WebInspector.StatusBarItem>} */
505 this._items = []; 502 this._items = [];
506 this.element = parentElement.createChild("div", "status-bar"); 503 this.element = parentElement ? parentElement.createChild("div", "status-bar" ) : createElementWithClass("div", "status-bar");
507 } 504 }
508 505
509 WebInspector.StatusBar.prototype = { 506 WebInspector.StatusBar.prototype = {
510 /** 507 /**
511 * @param {boolean} enabled 508 * @param {boolean} enabled
512 */ 509 */
513 setEnabled: function(enabled) 510 setEnabled: function(enabled)
514 { 511 {
515 for (var item of this._items) 512 for (var item of this._items)
516 item.setEnabled(enabled); 513 item.setEnabled(enabled);
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 var options = []; 812 var options = [];
816 for (var index = 0; index < this._states.length; index++) { 813 for (var index = 0; index < this._states.length; index++) {
817 if (this._states[index] !== this.state() && this._states[index] !== this._currentState) 814 if (this._states[index] !== this.state() && this._states[index] !== this._currentState)
818 options.push(this._buttons[index]); 815 options.push(this._buttons[index]);
819 } 816 }
820 return options; 817 return options;
821 }, 818 },
822 819
823 __proto__: WebInspector.StatusBarButton.prototype 820 __proto__: WebInspector.StatusBarButton.prototype
824 } 821 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/toolbox/responsiveDesignView.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698