Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 __proto__: WebInspector.StatusBarItem.prototype | 229 __proto__: WebInspector.StatusBarItem.prototype |
| 230 } | 230 } |
| 231 | 231 |
| 232 /** | 232 /** |
| 233 * @constructor | 233 * @constructor |
| 234 * @extends {WebInspector.StatusBarItem} | 234 * @extends {WebInspector.StatusBarItem} |
| 235 * @param {string} title | 235 * @param {string} title |
| 236 * @param {string} className | 236 * @param {string} className |
| 237 * @param {number=} states | 237 * @param {number=} states |
| 238 */ | 238 */ |
| 239 WebInspector.StatusBarButton = function(title, className, states) | 239 WebInspector.StatusBarButtonBase = function(title, className, states) |
| 240 { | 240 { |
| 241 WebInspector.StatusBarItem.call(this, "button"); | 241 WebInspector.StatusBarItem.call(this, "button"); |
| 242 this.element.className = className + " status-bar-item"; | 242 this.element.className = className + " status-bar-item"; |
| 243 this.element.addEventListener("click", this._clicked.bind(this), false); | 243 this.element.addEventListener("click", this._clicked.bind(this), false); |
| 244 this._longClickController = new WebInspector.LongClickController(this.elemen t); | 244 this._longClickController = new WebInspector.LongClickController(this.elemen t); |
| 245 this._longClickController.addEventListener(WebInspector.LongClickController. Events.LongClick, this._onLongClick.bind(this)); | 245 this._longClickController.addEventListener(WebInspector.LongClickController. Events.LongClick, this._onLongClick.bind(this)); |
| 246 this._longClickController.addEventListener(WebInspector.LongClickController. Events.LongPress, this._onLongPress.bind(this)); | 246 this._longClickController.addEventListener(WebInspector.LongClickController. Events.LongPress, this._onLongPress.bind(this)); |
| 247 | 247 |
| 248 this.glyph = this.element.createChild("div", "glyph"); | |
| 249 this.glyphShadow = this.element.createChild("div", "glyph shadow"); | |
| 250 | |
| 251 this.states = states; | 248 this.states = states; |
| 252 if (!states) | 249 if (!states) |
| 253 this.states = 2; | 250 this.states = 2; |
| 254 | 251 |
| 255 if (states == 2) | 252 if (states == 2) |
| 256 this._state = false; | 253 this._state = false; |
| 257 else | 254 else |
| 258 this._state = 0; | 255 this._state = 0; |
| 259 | 256 |
| 260 this.title = title; | 257 this.title = title; |
| 261 this.className = className; | 258 this.className = className; |
| 262 } | 259 } |
| 263 | 260 |
| 264 WebInspector.StatusBarButton.prototype = { | 261 WebInspector.StatusBarButtonBase.prototype = { |
| 265 /** | 262 /** |
| 266 * @param {!WebInspector.Event} event | 263 * @param {!WebInspector.Event} event |
| 267 */ | 264 */ |
| 268 _onLongClick: function(event) | 265 _onLongClick: function(event) |
| 269 { | 266 { |
| 270 this.dispatchEventToListeners("longClickDown"); | 267 this.dispatchEventToListeners("longClickDown"); |
| 271 }, | 268 }, |
| 272 | 269 |
| 273 /** | 270 /** |
| 274 * @param {!WebInspector.Event} event | 271 * @param {!WebInspector.Event} event |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 break; | 456 break; |
| 460 } | 457 } |
| 461 } | 458 } |
| 462 } | 459 } |
| 463 }, | 460 }, |
| 464 | 461 |
| 465 __proto__: WebInspector.StatusBarItem.prototype | 462 __proto__: WebInspector.StatusBarItem.prototype |
| 466 } | 463 } |
| 467 | 464 |
| 468 /** | 465 /** |
| 466 * @constructor | |
| 467 * @extends {WebInspector.StatusBarButtonBase} | |
| 468 * @param {string} title | |
| 469 * @param {string} className | |
| 470 * @param {number=} states | |
| 471 */ | |
| 472 WebInspector.StatusBarButton = function(title, className, states) | |
| 473 { | |
| 474 WebInspector.StatusBarButtonBase.call(this, title, className, states); | |
| 475 | |
| 476 this.element.createChild("div", "glyph"); | |
|
aandrey
2014/10/18 13:12:36
did you really mean to nuke "glyph shadow" ?
| |
| 477 } | |
| 478 | |
| 479 WebInspector.StatusBarButton.prototype = { | |
| 480 __proto__: WebInspector.StatusBarButtonBase.prototype | |
| 481 } | |
| 482 | |
| 483 /** | |
| 484 * @constructor | |
| 485 * @extends {WebInspector.StatusBarButtonBase} | |
| 486 * @param {string} title | |
| 487 * @param {string} className | |
| 488 * @param {string} text | |
| 489 * @param {number=} states | |
| 490 */ | |
| 491 WebInspector.StatusBarTextButton = function(title, className, text, states) | |
| 492 { | |
| 493 WebInspector.StatusBarButtonBase.call(this, title, className, states); | |
| 494 | |
| 495 this._textElement = this.element.createChild("div", "status-bar-button-text" ); | |
| 496 this._textElement.textContent = text; | |
| 497 } | |
| 498 | |
| 499 WebInspector.StatusBarTextButton.prototype = { | |
| 500 __proto__: WebInspector.StatusBarButtonBase.prototype | |
| 501 } | |
| 502 | |
| 503 /** | |
| 469 * @interface | 504 * @interface |
| 470 */ | 505 */ |
| 471 WebInspector.StatusBarItem.Provider = function() | 506 WebInspector.StatusBarItem.Provider = function() |
| 472 { | 507 { |
| 473 } | 508 } |
| 474 | 509 |
| 475 WebInspector.StatusBarItem.Provider.prototype = { | 510 WebInspector.StatusBarItem.Provider.prototype = { |
| 476 /** | 511 /** |
| 477 * @return {?WebInspector.StatusBarItem} | 512 * @return {?WebInspector.StatusBarItem} |
| 478 */ | 513 */ |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 711 var options = []; | 746 var options = []; |
| 712 for (var index = 0; index < this._states.length; index++) { | 747 for (var index = 0; index < this._states.length; index++) { |
| 713 if (this._states[index] !== this.state && this._states[index] !== th is._currentState) | 748 if (this._states[index] !== this.state && this._states[index] !== th is._currentState) |
| 714 options.push(this._buttons[index]); | 749 options.push(this._buttons[index]); |
| 715 } | 750 } |
| 716 return options; | 751 return options; |
| 717 }, | 752 }, |
| 718 | 753 |
| 719 __proto__: WebInspector.StatusBarButton.prototype | 754 __proto__: WebInspector.StatusBarButton.prototype |
| 720 } | 755 } |
| OLD | NEW |