| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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', function(e) { |
| 24 function(e) { | 24 chrome.send('setContentFilter', [this.name, this.value]); |
| 25 chrome.send('setContentFilter', [this.name, this.value]); | 25 }); |
| 26 }); | |
| 27 }, | 26 }, |
| 28 }; | 27 }; |
| 29 | 28 |
| 30 /** | 29 /** |
| 31 * Whether the content setting is controlled by something else than the user's | 30 * Whether the content setting is controlled by something else than the user's |
| 32 * settings (either 'policy' or 'extension'). | 31 * settings (either 'policy' or 'extension'). |
| 33 */ | 32 */ |
| 34 cr.defineProperty(ContentSettingsRadio, 'controlledBy', cr.PropertyKind.ATTR); | 33 cr.defineProperty(ContentSettingsRadio, 'controlledBy', cr.PropertyKind.ATTR); |
| 35 | 34 |
| 36 ////////////////////////////////////////////////////////////////////////////// | 35 ////////////////////////////////////////////////////////////////////////////// |
| 37 // HandlersEnabledRadio class: | 36 // HandlersEnabledRadio class: |
| 38 | 37 |
| 39 // Define a constructor that uses an input element as its underlying element. | 38 // Define a constructor that uses an input element as its underlying element. |
| 40 var HandlersEnabledRadio = cr.ui.define('input'); | 39 var HandlersEnabledRadio = cr.ui.define('input'); |
| 41 | 40 |
| 42 HandlersEnabledRadio.prototype = { | 41 HandlersEnabledRadio.prototype = { |
| 43 __proto__: HTMLInputElement.prototype, | 42 __proto__: HTMLInputElement.prototype, |
| 44 | 43 |
| 45 /** | 44 /** |
| 46 * Initialization function for the cr.ui framework. | 45 * Initialization function for the cr.ui framework. |
| 47 */ | 46 */ |
| 48 decorate: function() { | 47 decorate: function() { |
| 49 this.type = 'radio'; | 48 this.type = 'radio'; |
| 50 var self = this; | 49 var self = this; |
| 51 | 50 |
| 52 this.addEventListener('change', | 51 this.addEventListener('change', function(e) { |
| 53 function(e) { | 52 chrome.send('setHandlersEnabled', [this.value == 'allow']); |
| 54 chrome.send('setHandlersEnabled', [this.value == 'allow']); | 53 }); |
| 55 }); | |
| 56 }, | 54 }, |
| 57 }; | 55 }; |
| 58 | 56 |
| 59 // Export | 57 // Export |
| 60 return { | 58 return { |
| 61 ContentSettingsRadio: ContentSettingsRadio, | 59 ContentSettingsRadio: ContentSettingsRadio, |
| 62 HandlersEnabledRadio: HandlersEnabledRadio | 60 HandlersEnabledRadio: HandlersEnabledRadio |
| 63 }; | 61 }; |
| 64 | 62 |
| 65 }); | 63 }); |
| 66 | |
| OLD | NEW |