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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 case settings.ContentSettingsTypes.PLUGINS: | 64 case settings.ContentSettingsTypes.PLUGINS: |
65 return 'plugins'; | 65 return 'plugins'; |
66 case settings.ContentSettingsTypes.POPUPS: | 66 case settings.ContentSettingsTypes.POPUPS: |
67 return 'popups'; | 67 return 'popups'; |
68 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: | 68 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
69 return 'handlers'; | 69 return 'handlers'; |
70 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 70 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
71 return 'unsandboxed-plugins'; | 71 return 'unsandboxed-plugins'; |
72 case settings.ContentSettingsTypes.USB_DEVICES: | 72 case settings.ContentSettingsTypes.USB_DEVICES: |
73 return 'usb-devices'; | 73 return 'usb-devices'; |
| 74 case settings.ContentSettingsTypes.ZOOM_LEVELS: |
| 75 return 'zoom-levels'; |
74 default: | 76 default: |
75 return ''; | 77 return ''; |
76 } | 78 } |
77 }, | 79 }, |
78 | 80 |
79 /** | 81 /** |
80 * A utility function to lookup the route for a category name. | 82 * A utility function to lookup the route for a category name. |
81 * @param {string} category The category ID to look up. | 83 * @param {string} category The category ID to look up. |
82 * @return {!settings.Route} | 84 * @return {!settings.Route} |
83 * @protected | 85 * @protected |
(...skipping 23 matching lines...) Expand all Loading... |
107 case settings.ContentSettingsTypes.PLUGINS: | 109 case settings.ContentSettingsTypes.PLUGINS: |
108 return settings.Route.SITE_SETTINGS_FLASH; | 110 return settings.Route.SITE_SETTINGS_FLASH; |
109 case settings.ContentSettingsTypes.POPUPS: | 111 case settings.ContentSettingsTypes.POPUPS: |
110 return settings.Route.SITE_SETTINGS_POPUPS; | 112 return settings.Route.SITE_SETTINGS_POPUPS; |
111 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: | 113 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
112 return settings.Route.SITE_SETTINGS_HANDLERS; | 114 return settings.Route.SITE_SETTINGS_HANDLERS; |
113 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 115 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
114 return settings.Route.SITE_SETTINGS_UNSANDBOXED_PLUGINS; | 116 return settings.Route.SITE_SETTINGS_UNSANDBOXED_PLUGINS; |
115 case settings.ContentSettingsTypes.USB_DEVICES: | 117 case settings.ContentSettingsTypes.USB_DEVICES: |
116 return settings.Route.SITE_SETTINGS_USB_DEVICES; | 118 return settings.Route.SITE_SETTINGS_USB_DEVICES; |
| 119 case settings.ContentSettingsTypes.ZOOM_LEVELS: |
| 120 return settings.Route.SITE_SETTINGS_ZOOM_LEVELS; |
117 } | 121 } |
118 assertNotReached(); | 122 assertNotReached(); |
119 }, | 123 }, |
120 | 124 |
121 /** | 125 /** |
122 * A utility function to compute the icon to use for the category, both for | 126 * A utility function to compute the icon to use for the category, both for |
123 * the overall category as well as the individual permission in the details | 127 * the overall category as well as the individual permission in the details |
124 * for a site. | 128 * for a site. |
125 * @param {string} category The category to show the icon for. | 129 * @param {string} category The category to show the icon for. |
126 * @return {string} The id of the icon for the given category. | 130 * @return {string} The id of the icon for the given category. |
(...skipping 26 matching lines...) Expand all Loading... |
153 case settings.ContentSettingsTypes.PLUGINS: | 157 case settings.ContentSettingsTypes.PLUGINS: |
154 return 'cr:extension'; | 158 return 'cr:extension'; |
155 case settings.ContentSettingsTypes.POPUPS: | 159 case settings.ContentSettingsTypes.POPUPS: |
156 return 'settings:open-in-new'; | 160 return 'settings:open-in-new'; |
157 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: | 161 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
158 return 'settings:open-with'; | 162 return 'settings:open-with'; |
159 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 163 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
160 return 'cr:extension'; | 164 return 'cr:extension'; |
161 case settings.ContentSettingsTypes.USB_DEVICES: | 165 case settings.ContentSettingsTypes.USB_DEVICES: |
162 return 'settings:usb'; | 166 return 'settings:usb'; |
| 167 case settings.ContentSettingsTypes.ZOOM_LEVELS: |
| 168 return 'settings:zoom-in'; |
163 default: | 169 default: |
164 assertNotReached('Invalid category: ' + category); | 170 assertNotReached('Invalid category: ' + category); |
165 return ''; | 171 return ''; |
166 } | 172 } |
167 }, | 173 }, |
168 | 174 |
169 /** | 175 /** |
170 * A utility function to compute the title of the category, both for | 176 * A utility function to compute the title of the category, both for |
171 * the overall category as well as the individual permission in the details | 177 * the overall category as well as the individual permission in the details |
172 * for a site. | 178 * for a site. |
(...skipping 28 matching lines...) Expand all Loading... |
201 case settings.ContentSettingsTypes.PLUGINS: | 207 case settings.ContentSettingsTypes.PLUGINS: |
202 return loadTimeData.getString('siteSettingsFlash'); | 208 return loadTimeData.getString('siteSettingsFlash'); |
203 case settings.ContentSettingsTypes.POPUPS: | 209 case settings.ContentSettingsTypes.POPUPS: |
204 return loadTimeData.getString('siteSettingsPopups'); | 210 return loadTimeData.getString('siteSettingsPopups'); |
205 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: | 211 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: |
206 return loadTimeData.getString('siteSettingsHandlers'); | 212 return loadTimeData.getString('siteSettingsHandlers'); |
207 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 213 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
208 return loadTimeData.getString('siteSettingsUnsandboxedPlugins'); | 214 return loadTimeData.getString('siteSettingsUnsandboxedPlugins'); |
209 case settings.ContentSettingsTypes.USB_DEVICES: | 215 case settings.ContentSettingsTypes.USB_DEVICES: |
210 return loadTimeData.getString('siteSettingsUsbDevices'); | 216 return loadTimeData.getString('siteSettingsUsbDevices'); |
| 217 case settings.ContentSettingsTypes.ZOOM_LEVELS: |
| 218 return loadTimeData.getString('siteSettingsZoomLevels'); |
211 default: | 219 default: |
212 assertNotReached('Invalid category: ' + category); | 220 assertNotReached('Invalid category: ' + category); |
213 return ''; | 221 return ''; |
214 } | 222 } |
215 }, | 223 }, |
216 | 224 |
217 /** | 225 /** |
218 * A utility function to compute the description for the category. | 226 * A utility function to compute the description for the category. |
219 * @param {string} category The category to show the description for. | 227 * @param {string} category The category to show the description for. |
220 * @param {string} setting The string value of the setting. | 228 * @param {string} setting The string value of the setting. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: | 326 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: |
319 // "Ask when a plugin accesses your computer" vs "Do not allow". | 327 // "Ask when a plugin accesses your computer" vs "Do not allow". |
320 if (!categoryEnabled) { | 328 if (!categoryEnabled) { |
321 return loadTimeData.getString('siteSettingsUnsandboxedPluginsBlock'); | 329 return loadTimeData.getString('siteSettingsUnsandboxedPluginsBlock'); |
322 } | 330 } |
323 return showRecommendation ? | 331 return showRecommendation ? |
324 loadTimeData.getString( | 332 loadTimeData.getString( |
325 'siteSettingsUnsandboxedPluginsAskRecommended') : | 333 'siteSettingsUnsandboxedPluginsAskRecommended') : |
326 loadTimeData.getString('siteSettingsUnsandboxedPluginsAsk'); | 334 loadTimeData.getString('siteSettingsUnsandboxedPluginsAsk'); |
327 default: | 335 default: |
328 assertNotReached(); | 336 assertNotReached('Invalid category: ' + category); |
329 return ''; | 337 return ''; |
330 } | 338 } |
331 }, | 339 }, |
332 | 340 |
333 /** | 341 /** |
334 * Ensures the URL has a scheme (assumes http if omitted). | 342 * Ensures the URL has a scheme (assumes http if omitted). |
335 * @param {string} url The URL with or without a scheme. | 343 * @param {string} url The URL with or without a scheme. |
336 * @return {string} The URL with a scheme, or an empty string. | 344 * @return {string} The URL with a scheme, or an empty string. |
337 */ | 345 */ |
338 ensureUrlHasScheme: function(url) { | 346 ensureUrlHasScheme: function(url) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 computeIsSettingEnabled: function(category, setting) { | 436 computeIsSettingEnabled: function(category, setting) { |
429 // FullScreen is Allow vs. Ask. | 437 // FullScreen is Allow vs. Ask. |
430 return category == settings.ContentSettingsTypes.FULLSCREEN ? | 438 return category == settings.ContentSettingsTypes.FULLSCREEN ? |
431 setting != settings.PermissionValues.ASK : | 439 setting != settings.PermissionValues.ASK : |
432 setting != settings.PermissionValues.BLOCK; | 440 setting != settings.PermissionValues.BLOCK; |
433 }, | 441 }, |
434 }; | 442 }; |
435 | 443 |
436 /** @polymerBehavior */ | 444 /** @polymerBehavior */ |
437 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; | 445 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; |
OLD | NEW |