| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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('options', function() { | 5 cr.define('options', function() { |
| 6 | 6 |
| 7 ////////////////////////////////////////////////////////////////////////////// | 7 ////////////////////////////////////////////////////////////////////////////// |
| 8 // ContentSettingsRadio class: | 8 // ContentSettingsRadio class: |
| 9 | 9 |
| 10 // Define a constructor that uses an input element as its underlying element. | 10 // Define a constructor that uses an input element as its underlying element. |
| 11 var ContentSettingsRadio = cr.ui.define('input'); | 11 var ContentSettingsRadio = cr.ui.define('input'); |
| 12 | 12 |
| 13 ContentSettingsRadio.prototype = { | 13 ContentSettingsRadio.prototype = { |
| 14 __proto__: HTMLInputElement.prototype, | 14 __proto__: HTMLInputElement.prototype, |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Initialization function for the cr.ui framework. | 17 * Initialization function for the cr.ui framework. |
| 18 */ | 18 */ |
| 19 decorate: function() { | 19 decorate: function() { |
| 20 this.type = 'radio'; | 20 this.type = 'radio'; |
| 21 var self = this; | 21 var self = this; |
| 22 | 22 |
| 23 this.addEventListener('change', | 23 this.addEventListener('change', |
| 24 function(e) { | 24 function(e) { |
| 25 chrome.send('setContentFilter', [this.name, this.value]); | 25 chrome.send('setContentFilter', [this.name, this.value]); |
| 26 }); | 26 }); |
| 27 }, | 27 }, |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 ////////////////////////////////////////////////////////////////////////////// |
| 31 // HandlersEnabledRadio class: |
| 32 |
| 33 // Define a constructor that uses an input element as its underlying element. |
| 34 var HandlersEnabledRadio = cr.ui.define('input'); |
| 35 |
| 36 HandlersEnabledRadio.prototype = { |
| 37 __proto__: HTMLInputElement.prototype, |
| 38 |
| 39 /** |
| 40 * Initialization function for the cr.ui framework. |
| 41 */ |
| 42 decorate: function() { |
| 43 this.type = 'radio'; |
| 44 var self = this; |
| 45 |
| 46 this.addEventListener('change', |
| 47 function(e) { |
| 48 chrome.send('setHandlersEnabled', [this.value == 'allow']); |
| 49 }); |
| 50 }, |
| 51 }; |
| 52 |
| 30 // Export | 53 // Export |
| 31 return { | 54 return { |
| 32 ContentSettingsRadio: ContentSettingsRadio | 55 ContentSettingsRadio: ContentSettingsRadio, |
| 56 HandlersEnabledRadio: HandlersEnabledRadio |
| 33 }; | 57 }; |
| 34 | 58 |
| 35 }); | 59 }); |
| 36 | 60 |
| OLD | NEW |