| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-site-settings-page' is the settings page containing privacy and | 7 * 'settings-site-settings-page' is the settings page containing privacy and |
| 8 * security site settings. | 8 * security site settings. |
| 9 */ | 9 */ |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 if (key == settings.ContentSettingsTypes.USB_DEVICES || | 47 if (key == settings.ContentSettingsTypes.USB_DEVICES || |
| 48 key == settings.ContentSettingsTypes.ZOOM_LEVELS) | 48 key == settings.ContentSettingsTypes.ZOOM_LEVELS) |
| 49 continue; | 49 continue; |
| 50 this.updateDefaultValueLabel_(key); | 50 this.updateDefaultValueLabel_(key); |
| 51 } | 51 } |
| 52 | 52 |
| 53 this.addWebUIListener( | 53 this.addWebUIListener( |
| 54 'contentSettingCategoryChanged', | 54 'contentSettingCategoryChanged', |
| 55 this.updateDefaultValueLabel_.bind(this)); | 55 this.updateDefaultValueLabel_.bind(this)); |
| 56 this.addWebUIListener( | 56 this.addWebUIListener( |
| 57 'setHandlersEnabled', | 57 'setHandlersEnabled', this.updateHandlersEnabled_.bind(this)); |
| 58 this.updateHandlersEnabled_.bind(this)); | |
| 59 this.browserProxy.observeProtocolHandlersEnabledState(); | 58 this.browserProxy.observeProtocolHandlersEnabledState(); |
| 60 }, | 59 }, |
| 61 | 60 |
| 62 /** | 61 /** |
| 63 * @param {string} category The category to update. | 62 * @param {string} category The category to update. |
| 64 * @private | 63 * @private |
| 65 */ | 64 */ |
| 66 updateDefaultValueLabel_: function(category) { | 65 updateDefaultValueLabel_: function(category) { |
| 67 this.browserProxy.getDefaultValueForContentType( | 66 this.browserProxy.getDefaultValueForContentType(category).then( |
| 68 category).then(function(defaultValue) { | 67 function(defaultValue) { |
| 69 this.set( | 68 this.set( |
| 70 'default_.' + Polymer.CaseMap.dashToCamelCase(category), | 69 'default_.' + Polymer.CaseMap.dashToCamelCase(category), |
| 71 this.computeCategoryDesc( | 70 this.computeCategoryDesc( |
| 72 category, | 71 category, defaultValue.setting, |
| 73 defaultValue.setting, | |
| 74 /*showRecommendation=*/false)); | 72 /*showRecommendation=*/false)); |
| 75 }.bind(this)); | 73 }.bind(this)); |
| 76 }, | 74 }, |
| 77 | 75 |
| 78 /** | 76 /** |
| 79 * The protocol handlers have a separate enabled/disabled notifier. | 77 * The protocol handlers have a separate enabled/disabled notifier. |
| 80 * @param {boolean} enabled | 78 * @param {boolean} enabled |
| 81 * @private | 79 * @private |
| 82 */ | 80 */ |
| 83 updateHandlersEnabled_: function(enabled) { | 81 updateHandlersEnabled_: function(enabled) { |
| 84 var category = settings.ContentSettingsTypes.PROTOCOL_HANDLERS; | 82 var category = settings.ContentSettingsTypes.PROTOCOL_HANDLERS; |
| 85 this.set( | 83 this.set( |
| 86 'default_.' + Polymer.CaseMap.dashToCamelCase(category), | 84 'default_.' + Polymer.CaseMap.dashToCamelCase(category), |
| 87 this.computeCategoryDesc( | 85 this.computeCategoryDesc( |
| 88 category, | 86 category, enabled ? settings.PermissionValues.ALLOW : |
| 89 enabled ? | 87 settings.PermissionValues.BLOCK, |
| 90 settings.PermissionValues.ALLOW : | |
| 91 settings.PermissionValues.BLOCK, | |
| 92 /*showRecommendation=*/false)); | 88 /*showRecommendation=*/false)); |
| 93 }, | 89 }, |
| 94 | 90 |
| 95 /** | 91 /** |
| 96 * Navigate to the route specified in the event dataset. | 92 * Navigate to the route specified in the event dataset. |
| 97 * @param {!Event} event The tap event. | 93 * @param {!Event} event The tap event. |
| 98 * @private | 94 * @private |
| 99 */ | 95 */ |
| 100 onTapNavigate_: function(event) { | 96 onTapNavigate_: function(event) { |
| 101 var dataSet = /** @type {{route: string}} */(event.currentTarget.dataset); | 97 var dataSet = /** @type {{route: string}} */ (event.currentTarget.dataset); |
| 102 settings.navigateTo(settings.Route[dataSet.route]); | 98 settings.navigateTo(settings.Route[dataSet.route]); |
| 103 }, | 99 }, |
| 104 }); | 100 }); |
| OLD | NEW |