| 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 17 matching lines...) Expand all Loading... |
| 28 type: String, | 28 type: String, |
| 29 notify: true, | 29 notify: true, |
| 30 }, | 30 }, |
| 31 }, | 31 }, |
| 32 | 32 |
| 33 ready: function() { | 33 ready: function() { |
| 34 this.ContentSettingsTypes = settings.ContentSettingsTypes; | 34 this.ContentSettingsTypes = settings.ContentSettingsTypes; |
| 35 this.ALL_SITES = settings.ALL_SITES; | 35 this.ALL_SITES = settings.ALL_SITES; |
| 36 | 36 |
| 37 // Look up the default value for each category and show it. | 37 // Look up the default value for each category and show it. |
| 38 this.setDefaultValue_(this.ContentSettingsTypes.AUTOMATIC_DOWNLOADS, |
| 39 '#automaticDownloads'); |
| 40 this.setDefaultValue_(this.ContentSettingsTypes.BACKGROUND_SYNC, |
| 41 '#backgroundSync'); |
| 42 this.setDefaultValue_(this.ContentSettingsTypes.CAMERA, '#camera'); |
| 38 this.setDefaultValue_(this.ContentSettingsTypes.COOKIES, '#cookies'); | 43 this.setDefaultValue_(this.ContentSettingsTypes.COOKIES, '#cookies'); |
| 39 this.setDefaultValue_(this.ContentSettingsTypes.GEOLOCATION, | 44 this.setDefaultValue_(this.ContentSettingsTypes.GEOLOCATION, |
| 40 '#geolocation'); | 45 '#geolocation'); |
| 41 this.setDefaultValue_(this.ContentSettingsTypes.CAMERA, '#camera'); | 46 this.setDefaultValue_(this.ContentSettingsTypes.IMAGES, '#images'); |
| 42 this.setDefaultValue_(this.ContentSettingsTypes.MIC, '#mic'); | |
| 43 this.setDefaultValue_(this.ContentSettingsTypes.JAVASCRIPT, | 47 this.setDefaultValue_(this.ContentSettingsTypes.JAVASCRIPT, |
| 44 '#javascript'); | 48 '#javascript'); |
| 45 this.setDefaultValue_(this.ContentSettingsTypes.POPUPS, '#popups'); | 49 this.setDefaultValue_(this.ContentSettingsTypes.KEYGEN, '#keygen'); |
| 50 this.setDefaultValue_(this.ContentSettingsTypes.MIC, '#mic'); |
| 46 this.setDefaultValue_(this.ContentSettingsTypes.NOTIFICATIONS, | 51 this.setDefaultValue_(this.ContentSettingsTypes.NOTIFICATIONS, |
| 47 '#notifications'); | 52 '#notifications'); |
| 48 this.setDefaultValue_(this.ContentSettingsTypes.IMAGES, '#images'); | 53 this.setDefaultValue_(this.ContentSettingsTypes.PLUGINS, '#plugins'); |
| 49 | 54 this.setDefaultValue_(this.ContentSettingsTypes.POPUPS, '#popups'); |
| 55 this.setDefaultValue_(this.ContentSettingsTypes.UNSANDBOXED_PLUGINS, |
| 56 '#unsandboxedPlugins'); |
| 50 }, | 57 }, |
| 51 | 58 |
| 52 setDefaultValue_: function(category, id) { | 59 setDefaultValue_: function(category, id) { |
| 53 this.browserProxy.getDefaultValueForContentType( | 60 this.browserProxy.getDefaultValueForContentType( |
| 54 category).then(function(enabled) { | 61 category).then(function(enabled) { |
| 55 var description = this.computeCategoryDesc(category, enabled, false); | 62 var description = this.computeCategoryDesc(category, enabled, false); |
| 56 this.$$(id).innerText = description; | 63 this.$$(id).innerText = description; |
| 57 }.bind(this)); | 64 }.bind(this)); |
| 58 }, | 65 }, |
| 59 | 66 |
| 60 /** | 67 /** |
| 61 * Handles selection of a single category and navigates to the details for | 68 * Handles selection of a single category and navigates to the details for |
| 62 * that category. | 69 * that category. |
| 63 * @param {!Event} event The tap event. | 70 * @param {!Event} event The tap event. |
| 64 */ | 71 */ |
| 65 onTapCategory: function(event) { | 72 onTapCategory: function(event) { |
| 66 var category = parseInt(event.currentTarget.getAttribute('category'), 10); | 73 var category = event.currentTarget.getAttribute('category'); |
| 67 if (category == -1) { | 74 if (category == settings.ALL_SITES) { |
| 68 this.currentRoute = { | 75 this.currentRoute = { |
| 69 page: this.currentRoute.page, | 76 page: this.currentRoute.page, |
| 70 section: 'privacy', | 77 section: 'privacy', |
| 71 subpage: ['site-settings', 'all-sites'], | 78 subpage: ['site-settings', 'all-sites'], |
| 72 }; | 79 }; |
| 73 } else { | 80 } else { |
| 74 this.categorySelected = this.computeCategoryTextId(category); | 81 this.categorySelected = this.computeCategoryTextId(category); |
| 75 this.currentRoute = { | 82 this.currentRoute = { |
| 76 page: this.currentRoute.page, | 83 page: this.currentRoute.page, |
| 77 section: 'privacy', | 84 section: 'privacy', |
| 78 subpage: ['site-settings', 'site-settings-category-' + | 85 subpage: ['site-settings', 'site-settings-category-' + |
| 79 this.categorySelected], | 86 this.categorySelected], |
| 80 }; | 87 }; |
| 81 } | 88 } |
| 82 }, | 89 }, |
| 83 }); | 90 }); |
| OLD | NEW |