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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 this._muteSettingListener = false; | 957 this._muteSettingListener = false; |
| 958 } | 958 } |
| 959 }; | 959 }; |
| 960 | 960 |
| 961 /** | 961 /** |
| 962 * @unrestricted | 962 * @unrestricted |
| 963 */ | 963 */ |
| 964 UI.ToolbarCheckbox = class extends UI.ToolbarItem { | 964 UI.ToolbarCheckbox = class extends UI.ToolbarItem { |
| 965 /** | 965 /** |
| 966 * @param {string} text | 966 * @param {string} text |
| 967 * @param {string=} title | 967 * @param {string=} tooltip |
| 968 * @param {!Common.Setting=} setting | |
| 969 * @param {function()=} listener | 968 * @param {function()=} listener |
| 970 */ | 969 */ |
| 971 constructor(text, title, setting, listener) { | 970 constructor(text, tooltip, listener) { |
| 972 super(UI.createCheckboxLabel(text)); | 971 super(UI.createCheckboxLabel(text)); |
| 973 this.element.classList.add('checkbox'); | 972 this.element.classList.add('checkbox'); |
| 974 this.inputElement = this.element.checkboxElement; | 973 this.inputElement = this.element.checkboxElement; |
| 975 if (title) | 974 if (tooltip) |
| 976 this.element.title = title; | 975 this.element.title = tooltip; |
| 977 if (setting) | |
| 978 UI.SettingsUI.bindCheckbox(this.inputElement, setting); | |
| 979 if (listener) | 976 if (listener) |
| 980 this.inputElement.addEventListener('click', listener, false); | 977 this.inputElement.addEventListener('click', listener, false); |
| 981 } | 978 } |
| 982 | 979 |
| 983 /** | 980 /** |
| 984 * @return {boolean} | 981 * @return {boolean} |
| 985 */ | 982 */ |
| 986 checked() { | 983 checked() { |
| 987 return this.inputElement.checked; | 984 return this.inputElement.checked; |
| 988 } | 985 } |
| 989 | 986 |
| 990 /** | 987 /** |
| 991 * @param {boolean} value | 988 * @param {boolean} value |
| 992 */ | 989 */ |
| 993 setChecked(value) { | 990 setChecked(value) { |
| 994 this.inputElement.checked = value; | 991 this.inputElement.checked = value; |
| 995 } | 992 } |
| 996 | 993 |
| 997 /** | 994 /** |
| 998 * @override | 995 * @override |
| 999 * @param {boolean} enabled | 996 * @param {boolean} enabled |
| 1000 */ | 997 */ |
| 1001 _applyEnabledState(enabled) { | 998 _applyEnabledState(enabled) { |
| 1002 super._applyEnabledState(enabled); | 999 super._applyEnabledState(enabled); |
| 1003 this.inputElement.disabled = !enabled; | 1000 this.inputElement.disabled = !enabled; |
| 1004 } | 1001 } |
| 1005 }; | 1002 }; |
| 1003 | |
| 1004 UI.ToolbarSettingCheckbox = class extends UI.ToolbarCheckbox { | |
| 1005 /** | |
| 1006 * @param {!Common.Setting} setting | |
| 1007 * @param {string=} tooltip | |
| 1008 * @param {function()=} listener | |
| 1009 */ | |
| 1010 constructor(setting, tooltip, listener) { | |
|
pfeldman
2017/02/07 20:10:28
Here you should allow optional title and no listen
luoe
2017/02/13 06:27:20
Done.
| |
| 1011 super(setting.title() || '', tooltip, listener); | |
| 1012 UI.SettingsUI.bindCheckbox(this.inputElement, setting); | |
| 1013 } | |
| 1014 }; | |
| OLD | NEW |