Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 cr.define('cr.ui', function() { | 5 cr.define('cr.ui', function() { |
| 6 /** | 6 /** |
| 7 * An image button that brings up an informative bubble when activated by | 7 * An image button that brings up an informative bubble when activated by |
| 8 * keyboard or mouse. | 8 * keyboard or mouse. |
| 9 * @constructor | 9 * @constructor |
| 10 * @extends {HTMLSpanElement} | 10 * @extends {HTMLSpanElement} |
| 11 * @implements {EventListener} | |
| 11 */ | 12 */ |
| 12 var BubbleButton = cr.ui.define('span'); | 13 var BubbleButton = cr.ui.define('span'); |
| 13 | 14 |
| 14 BubbleButton.prototype = { | 15 BubbleButton.prototype = { |
| 15 __proto__: HTMLSpanElement.prototype, | 16 __proto__: HTMLSpanElement.prototype, |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * Decorates the base element to show the proper icon. | 19 * Decorates the base element to show the proper icon. |
| 19 */ | 20 */ |
| 20 decorate: function() { | 21 decorate: function() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 case 'mousedown': | 69 case 'mousedown': |
| 69 if (document.activeElement) | 70 if (document.activeElement) |
| 70 document.activeElement.blur(); | 71 document.activeElement.blur(); |
| 71 event.preventDefault(); | 72 event.preventDefault(); |
| 72 return; | 73 return; |
| 73 } | 74 } |
| 74 this.toggleBubble_(); | 75 this.toggleBubble_(); |
| 75 event.preventDefault(); | 76 event.preventDefault(); |
| 76 event.stopPropagation(); | 77 event.stopPropagation(); |
| 77 }, | 78 }, |
| 79 | |
| 80 /** | |
| 81 * Abstract method: subclasses should overwrite it. There is no way to mark | |
| 82 * method as abstract for Closure Compiler, as of | |
| 83 * https://github.com/google/closure-compiler/issues/104. | |
| 84 * @type {!Function|undefined} | |
| 85 * @protected | |
| 86 */ | |
| 87 toggleBubble_: undefined | |
|
Dan Beam
2014/09/06 02:22:39
nit: ,
Dan Beam
2014/09/06 02:22:39
nit: maybe instead:
toggleBubble: assertNotReac
Dan Beam
2014/09/06 02:22:39
@protected methods aren't suffixed with _, only @p
Vitaly Pavlenko
2014/09/06 22:54:09
Done.
Vitaly Pavlenko
2014/09/06 22:54:09
Done.
Vitaly Pavlenko
2014/09/06 22:54:09
Done.
| |
| 78 }; | 88 }; |
| 79 | 89 |
| 80 // Export. | 90 // Export. |
| 81 return { | 91 return { |
| 82 BubbleButton: BubbleButton | 92 BubbleButton: BubbleButton |
| 83 }; | 93 }; |
| 84 }); | 94 }); |
| OLD | NEW |