| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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: | 99 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
| 100 return 'handlers'; | 100 return 'handlers'; |
| 101 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 101 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
| 102 return 'unsandboxed-plugins'; | 102 return 'unsandboxed-plugins'; |
| 103 case settings.ContentSettingsTypes.USB_DEVICES: |
| 104 return 'usb-devices'; |
| 103 default: | 105 default: |
| 104 return ''; | 106 return ''; |
| 105 } | 107 } |
| 106 }, | 108 }, |
| 107 | 109 |
| 108 /** | 110 /** |
| 109 * A utility function to lookup the route for a category name. | 111 * A utility function to lookup the route for a category name. |
| 110 * @param {string} category The category ID to look up. | 112 * @param {string} category The category ID to look up. |
| 111 * @return {!settings.Route} | 113 * @return {!settings.Route} |
| 112 * @protected | 114 * @protected |
| (...skipping 21 matching lines...) Expand all Loading... |
| 134 case settings.ContentSettingsTypes.NOTIFICATIONS: | 136 case settings.ContentSettingsTypes.NOTIFICATIONS: |
| 135 return settings.Route.SITE_SETTINGS_NOTIFICATIONS; | 137 return settings.Route.SITE_SETTINGS_NOTIFICATIONS; |
| 136 case settings.ContentSettingsTypes.PLUGINS: | 138 case settings.ContentSettingsTypes.PLUGINS: |
| 137 return settings.Route.SITE_SETTINGS_PLUGINS; | 139 return settings.Route.SITE_SETTINGS_PLUGINS; |
| 138 case settings.ContentSettingsTypes.POPUPS: | 140 case settings.ContentSettingsTypes.POPUPS: |
| 139 return settings.Route.SITE_SETTINGS_POPUPS; | 141 return settings.Route.SITE_SETTINGS_POPUPS; |
| 140 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: | 142 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
| 141 return settings.Route.SITE_SETTINGS_HANDLERS; | 143 return settings.Route.SITE_SETTINGS_HANDLERS; |
| 142 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 144 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
| 143 return settings.Route.SITE_SETTINGS_UNSANDBOXED_PLUGINS; | 145 return settings.Route.SITE_SETTINGS_UNSANDBOXED_PLUGINS; |
| 146 case settings.ContentSettingsTypes.USB_DEVICES: |
| 147 return settings.Route.SITE_SETTINGS_USB_DEVICES; |
| 144 } | 148 } |
| 145 assertNotReached(); | 149 assertNotReached(); |
| 146 }, | 150 }, |
| 147 | 151 |
| 148 /** | 152 /** |
| 149 * A utility function to lookup the 'details' route for a category name. | 153 * A utility function to lookup the 'details' route for a category name. |
| 150 * @param {string} category The category ID to look up. | 154 * @param {string} category The category ID to look up. |
| 151 * @return {!settings.Route} | 155 * @return {!settings.Route} |
| 152 * @protected | 156 * @protected |
| 153 */ | 157 */ |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 case settings.ContentSettingsTypes.NOTIFICATIONS: | 220 case settings.ContentSettingsTypes.NOTIFICATIONS: |
| 217 return 'settings:notifications'; | 221 return 'settings:notifications'; |
| 218 case settings.ContentSettingsTypes.PLUGINS: | 222 case settings.ContentSettingsTypes.PLUGINS: |
| 219 return 'cr:extension'; | 223 return 'cr:extension'; |
| 220 case settings.ContentSettingsTypes.POPUPS: | 224 case settings.ContentSettingsTypes.POPUPS: |
| 221 return 'settings:open-in-new'; | 225 return 'settings:open-in-new'; |
| 222 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: | 226 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
| 223 return 'settings:open-with'; | 227 return 'settings:open-with'; |
| 224 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 228 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
| 225 return 'cr:extension'; | 229 return 'cr:extension'; |
| 230 case settings.ContentSettingsTypes.USB_DEVICES: |
| 231 return 'settings:usb'; |
| 226 default: | 232 default: |
| 227 assertNotReached('Invalid category: ' + category); | 233 assertNotReached('Invalid category: ' + category); |
| 228 return ''; | 234 return ''; |
| 229 } | 235 } |
| 230 }, | 236 }, |
| 231 | 237 |
| 232 /** | 238 /** |
| 233 * A utility function to compute the title of the category, both for | 239 * A utility function to compute the title of the category, both for |
| 234 * the overall category as well as the individual permission in the details | 240 * the overall category as well as the individual permission in the details |
| 235 * for a site. | 241 * for a site. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 262 case settings.ContentSettingsTypes.NOTIFICATIONS: | 268 case settings.ContentSettingsTypes.NOTIFICATIONS: |
| 263 return loadTimeData.getString('siteSettingsNotifications'); | 269 return loadTimeData.getString('siteSettingsNotifications'); |
| 264 case settings.ContentSettingsTypes.PLUGINS: | 270 case settings.ContentSettingsTypes.PLUGINS: |
| 265 return loadTimeData.getString('siteSettingsPlugins'); | 271 return loadTimeData.getString('siteSettingsPlugins'); |
| 266 case settings.ContentSettingsTypes.POPUPS: | 272 case settings.ContentSettingsTypes.POPUPS: |
| 267 return loadTimeData.getString('siteSettingsPopups'); | 273 return loadTimeData.getString('siteSettingsPopups'); |
| 268 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: | 274 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
| 269 return loadTimeData.getString('siteSettingsHandlers'); | 275 return loadTimeData.getString('siteSettingsHandlers'); |
| 270 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 276 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
| 271 return loadTimeData.getString('siteSettingsUnsandboxedPlugins'); | 277 return loadTimeData.getString('siteSettingsUnsandboxedPlugins'); |
| 278 case settings.ContentSettingsTypes.USB_DEVICES: |
| 279 return loadTimeData.getString('siteSettingsUsbDevices'); |
| 272 default: | 280 default: |
| 273 assertNotReached('Invalid category: ' + category); | 281 assertNotReached('Invalid category: ' + category); |
| 274 return ''; | 282 return ''; |
| 275 } | 283 } |
| 276 }, | 284 }, |
| 277 | 285 |
| 278 /** | 286 /** |
| 279 * A utility function to compute the description for the category. | 287 * A utility function to compute the description for the category. |
| 280 * @param {string} category The category to show the description for. | 288 * @param {string} category The category to show the description for. |
| 281 * @param {boolean} categoryEnabled The state of the global toggle. | 289 * @param {boolean} categoryEnabled The state of the global toggle. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 * @private | 467 * @private |
| 460 */ | 468 */ |
| 461 computeSiteIcon: function(site) { | 469 computeSiteIcon: function(site) { |
| 462 var url = this.ensureUrlHasScheme(site); | 470 var url = this.ensureUrlHasScheme(site); |
| 463 return 'background-image: ' + cr.icon.getFaviconImageSet(url); | 471 return 'background-image: ' + cr.icon.getFaviconImageSet(url); |
| 464 }, | 472 }, |
| 465 }; | 473 }; |
| 466 | 474 |
| 467 /** @polymerBehavior */ | 475 /** @polymerBehavior */ |
| 468 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; | 476 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; |
| OLD | NEW |