| 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 Behavior common to Site Settings classes. | 6 * @fileoverview Behavior common to Site Settings classes. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 /** @polymerBehavior */ | 9 /** @polymerBehavior */ |
| 10 var SiteSettingsBehaviorImpl = { | 10 var SiteSettingsBehaviorImpl = { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 case settings.ContentSettingsTypes.KEYGEN: | 89 case settings.ContentSettingsTypes.KEYGEN: |
| 90 return 'keygen'; | 90 return 'keygen'; |
| 91 case settings.ContentSettingsTypes.MIC: | 91 case settings.ContentSettingsTypes.MIC: |
| 92 return 'microphone'; | 92 return 'microphone'; |
| 93 case settings.ContentSettingsTypes.NOTIFICATIONS: | 93 case settings.ContentSettingsTypes.NOTIFICATIONS: |
| 94 return 'notifications'; | 94 return 'notifications'; |
| 95 case settings.ContentSettingsTypes.PLUGINS: | 95 case settings.ContentSettingsTypes.PLUGINS: |
| 96 return 'plugins'; | 96 return 'plugins'; |
| 97 case settings.ContentSettingsTypes.POPUPS: | 97 case settings.ContentSettingsTypes.POPUPS: |
| 98 return 'popups'; | 98 return 'popups'; |
| 99 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
| 100 return 'handlers'; |
| 99 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 101 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
| 100 return 'unsandboxed-plugins'; | 102 return 'unsandboxed-plugins'; |
| 101 default: | 103 default: |
| 102 return ''; | 104 return ''; |
| 103 } | 105 } |
| 104 }, | 106 }, |
| 105 | 107 |
| 106 /** | 108 /** |
| 107 * A utility function to compute the icon to use for the category, both for | 109 * A utility function to compute the icon to use for the category, both for |
| 108 * the overall category as well as the individual permission in the details | 110 * the overall category as well as the individual permission in the details |
| (...skipping 23 matching lines...) Expand all Loading... |
| 132 case settings.ContentSettingsTypes.KEYGEN: | 134 case settings.ContentSettingsTypes.KEYGEN: |
| 133 return 'settings:code'; | 135 return 'settings:code'; |
| 134 case settings.ContentSettingsTypes.MIC: | 136 case settings.ContentSettingsTypes.MIC: |
| 135 return 'settings:mic'; | 137 return 'settings:mic'; |
| 136 case settings.ContentSettingsTypes.NOTIFICATIONS: | 138 case settings.ContentSettingsTypes.NOTIFICATIONS: |
| 137 return 'settings:notifications'; | 139 return 'settings:notifications'; |
| 138 case settings.ContentSettingsTypes.PLUGINS: | 140 case settings.ContentSettingsTypes.PLUGINS: |
| 139 return 'cr:extension'; | 141 return 'cr:extension'; |
| 140 case settings.ContentSettingsTypes.POPUPS: | 142 case settings.ContentSettingsTypes.POPUPS: |
| 141 return 'settings:open-in-new'; | 143 return 'settings:open-in-new'; |
| 144 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
| 145 return 'settings:open-with'; |
| 142 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 146 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
| 143 return 'cr:extension'; | 147 return 'cr:extension'; |
| 144 default: | 148 default: |
| 145 assertNotReached('Invalid category: ' + category); | 149 assertNotReached('Invalid category: ' + category); |
| 146 return ''; | 150 return ''; |
| 147 } | 151 } |
| 148 }, | 152 }, |
| 149 | 153 |
| 150 /** | 154 /** |
| 151 * A utility function to compute the title of the category, both for | 155 * A utility function to compute the title of the category, both for |
| (...skipping 24 matching lines...) Expand all Loading... |
| 176 case settings.ContentSettingsTypes.KEYGEN: | 180 case settings.ContentSettingsTypes.KEYGEN: |
| 177 return loadTimeData.getString('siteSettingsKeygen'); | 181 return loadTimeData.getString('siteSettingsKeygen'); |
| 178 case settings.ContentSettingsTypes.MIC: | 182 case settings.ContentSettingsTypes.MIC: |
| 179 return loadTimeData.getString('siteSettingsMic'); | 183 return loadTimeData.getString('siteSettingsMic'); |
| 180 case settings.ContentSettingsTypes.NOTIFICATIONS: | 184 case settings.ContentSettingsTypes.NOTIFICATIONS: |
| 181 return loadTimeData.getString('siteSettingsNotifications'); | 185 return loadTimeData.getString('siteSettingsNotifications'); |
| 182 case settings.ContentSettingsTypes.PLUGINS: | 186 case settings.ContentSettingsTypes.PLUGINS: |
| 183 return loadTimeData.getString('siteSettingsPlugins'); | 187 return loadTimeData.getString('siteSettingsPlugins'); |
| 184 case settings.ContentSettingsTypes.POPUPS: | 188 case settings.ContentSettingsTypes.POPUPS: |
| 185 return loadTimeData.getString('siteSettingsPopups'); | 189 return loadTimeData.getString('siteSettingsPopups'); |
| 190 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
| 191 return loadTimeData.getString('siteSettingsHandlers'); |
| 186 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 192 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
| 187 return loadTimeData.getString('siteSettingsUnsandboxedPlugins'); | 193 return loadTimeData.getString('siteSettingsUnsandboxedPlugins'); |
| 188 default: | 194 default: |
| 189 assertNotReached('Invalid category: ' + category); | 195 assertNotReached('Invalid category: ' + category); |
| 190 return ''; | 196 return ''; |
| 191 } | 197 } |
| 192 }, | 198 }, |
| 193 | 199 |
| 194 /** | 200 /** |
| 195 * A utility function to compute the description for the category. | 201 * A utility function to compute the description for the category. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 'siteSettingsAskBeforeAccessingRecommended') : | 244 'siteSettingsAskBeforeAccessingRecommended') : |
| 239 loadTimeData.getString('siteSettingsAskBeforeAccessing'); | 245 loadTimeData.getString('siteSettingsAskBeforeAccessing'); |
| 240 case settings.ContentSettingsTypes.COOKIES: | 246 case settings.ContentSettingsTypes.COOKIES: |
| 241 // "Allow sites to save and read cookie data" vs "Blocked". | 247 // "Allow sites to save and read cookie data" vs "Blocked". |
| 242 if (!categoryEnabled) { | 248 if (!categoryEnabled) { |
| 243 return loadTimeData.getString('siteSettingsBlocked'); | 249 return loadTimeData.getString('siteSettingsBlocked'); |
| 244 } | 250 } |
| 245 return showRecommendation ? | 251 return showRecommendation ? |
| 246 loadTimeData.getString('siteSettingsCookiesAllowedRecommended') : | 252 loadTimeData.getString('siteSettingsCookiesAllowedRecommended') : |
| 247 loadTimeData.getString('siteSettingsCookiesAllowed'); | 253 loadTimeData.getString('siteSettingsCookiesAllowed'); |
| 254 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
| 255 // "Allow sites to ask to become default handlers" vs "Blocked". |
| 256 if (!categoryEnabled) { |
| 257 return loadTimeData.getString('siteSettingsHandlersBlocked'); |
| 258 } |
| 259 return showRecommendation ? |
| 260 loadTimeData.getString('siteSettingsHandlersAskRecommended') : |
| 261 loadTimeData.getString('siteSettingsHandlersAsk'); |
| 248 case settings.ContentSettingsTypes.IMAGES: | 262 case settings.ContentSettingsTypes.IMAGES: |
| 249 if (!categoryEnabled) { | 263 if (!categoryEnabled) { |
| 250 return loadTimeData.getString('siteSettingsDontShowImages'); | 264 return loadTimeData.getString('siteSettingsDontShowImages'); |
| 251 } | 265 } |
| 252 return showRecommendation ? | 266 return showRecommendation ? |
| 253 loadTimeData.getString('siteSettingsShowAllRecommended') : | 267 loadTimeData.getString('siteSettingsShowAllRecommended') : |
| 254 loadTimeData.getString('siteSettingsShowAll'); | 268 loadTimeData.getString('siteSettingsShowAll'); |
| 255 case settings.ContentSettingsTypes.PLUGINS: | 269 case settings.ContentSettingsTypes.PLUGINS: |
| 256 // "Detect and run important content (recommended)" vs "Let me choose". | 270 // "Detect and run important content (recommended)" vs "Let me choose". |
| 257 if (!categoryEnabled) { | 271 if (!categoryEnabled) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 * @private | 381 * @private |
| 368 */ | 382 */ |
| 369 computeSiteIcon: function(site) { | 383 computeSiteIcon: function(site) { |
| 370 var url = this.ensureUrlHasScheme(site); | 384 var url = this.ensureUrlHasScheme(site); |
| 371 return 'background-image: ' + cr.icon.getFaviconImageSet(url); | 385 return 'background-image: ' + cr.icon.getFaviconImageSet(url); |
| 372 }, | 386 }, |
| 373 }; | 387 }; |
| 374 | 388 |
| 375 /** @polymerBehavior */ | 389 /** @polymerBehavior */ |
| 376 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; | 390 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; |
| OLD | NEW |