Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: chrome/browser/resources/settings/site_settings/site_settings_behavior.js

Issue 2280233002: [HBD] Update MD Site Settings Plugins section to show 3rd mode checkbox. (Closed)
Patch Set: merge origin/master Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return loadTimeData.getString('siteSettingsUsbDevices'); 241 return loadTimeData.getString('siteSettingsUsbDevices');
242 default: 242 default:
243 assertNotReached('Invalid category: ' + category); 243 assertNotReached('Invalid category: ' + category);
244 return ''; 244 return '';
245 } 245 }
246 }, 246 },
247 247
248 /** 248 /**
249 * A utility function to compute the description for the category. 249 * A utility function to compute the description for the category.
250 * @param {string} category The category to show the description for. 250 * @param {string} category The category to show the description for.
251 * @param {boolean} categoryEnabled The state of the global toggle. 251 * @param {string} setting The string value of the setting.
252 * @param {boolean} showRecommendation Whether to show the '(recommended)' 252 * @param {boolean} showRecommendation Whether to show the '(recommended)'
253 * label prefix. 253 * label prefix.
254 * @return {string} The category description. 254 * @return {string} The category description.
255 * @protected 255 * @protected
256 */ 256 */
257 computeCategoryDesc: function(category, categoryEnabled, showRecommendation) { 257 computeCategoryDesc: function(category, setting, showRecommendation) {
258 var categoryEnabled = this.computeIsSettingEnabled(category, setting);
258 switch (category) { 259 switch (category) {
259 case settings.ContentSettingsTypes.JAVASCRIPT: 260 case settings.ContentSettingsTypes.JAVASCRIPT:
260 // "Allowed (recommended)" vs "Blocked". 261 // "Allowed (recommended)" vs "Blocked".
261 if (!categoryEnabled) { 262 if (!categoryEnabled) {
262 return loadTimeData.getString('siteSettingsBlocked'); 263 return loadTimeData.getString('siteSettingsBlocked');
263 } 264 }
264 return showRecommendation ? 265 return showRecommendation ?
265 loadTimeData.getString('siteSettingsAllowedRecommended') : 266 loadTimeData.getString('siteSettingsAllowedRecommended') :
266 loadTimeData.getString('siteSettingsAllowed'); 267 loadTimeData.getString('siteSettingsAllowed');
267 case settings.ContentSettingsTypes.POPUPS: 268 case settings.ContentSettingsTypes.POPUPS:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 loadTimeData.getString('siteSettingsHandlersAskRecommended') : 309 loadTimeData.getString('siteSettingsHandlersAskRecommended') :
309 loadTimeData.getString('siteSettingsHandlersAsk'); 310 loadTimeData.getString('siteSettingsHandlersAsk');
310 case settings.ContentSettingsTypes.IMAGES: 311 case settings.ContentSettingsTypes.IMAGES:
311 if (!categoryEnabled) { 312 if (!categoryEnabled) {
312 return loadTimeData.getString('siteSettingsDontShowImages'); 313 return loadTimeData.getString('siteSettingsDontShowImages');
313 } 314 }
314 return showRecommendation ? 315 return showRecommendation ?
315 loadTimeData.getString('siteSettingsShowAllRecommended') : 316 loadTimeData.getString('siteSettingsShowAllRecommended') :
316 loadTimeData.getString('siteSettingsShowAll'); 317 loadTimeData.getString('siteSettingsShowAll');
317 case settings.ContentSettingsTypes.PLUGINS: 318 case settings.ContentSettingsTypes.PLUGINS:
318 // "Detect and run important content (recommended)" vs "Let me choose". 319 if (setting == settings.PermissionValues.ALLOW)
319 if (!categoryEnabled) { 320 return loadTimeData.getString('siteSettingsFlashAllow');
320 return loadTimeData.getString('siteSettingsLetMeChoose'); 321 if (setting == settings.PermissionValues.BLOCK)
321 } 322 return loadTimeData.getString('siteSettingsFlashBlock');
322 return showRecommendation ? 323 return loadTimeData.getString('siteSettingsFlashAskBefore');
323 loadTimeData.getString(
324 'siteSettingsDetectAndRunImportantRecommended') :
325 loadTimeData.getString('siteSettingsDetectAndRunImportant');
326 case settings.ContentSettingsTypes.BACKGROUND_SYNC: 324 case settings.ContentSettingsTypes.BACKGROUND_SYNC:
327 // "Allow sites to finish sending and receiving data" vs "Do not allow". 325 // "Allow sites to finish sending and receiving data" vs "Do not allow".
328 if (!categoryEnabled) { 326 if (!categoryEnabled) {
329 return loadTimeData.getString('siteSettingsBackgroundSyncBlocked'); 327 return loadTimeData.getString('siteSettingsBackgroundSyncBlocked');
330 } 328 }
331 return showRecommendation ? 329 return showRecommendation ?
332 loadTimeData.getString( 330 loadTimeData.getString(
333 'siteSettingsAllowRecentlyClosedSitesRecommended') : 331 'siteSettingsAllowRecentlyClosedSitesRecommended') :
334 loadTimeData.getString('siteSettingsAllowRecentlyClosedSites'); 332 loadTimeData.getString('siteSettingsAllowRecentlyClosedSites');
335 case settings.ContentSettingsTypes.KEYGEN: 333 case settings.ContentSettingsTypes.KEYGEN:
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 computeIsSettingEnabled: function(category, setting) { 457 computeIsSettingEnabled: function(category, setting) {
460 // FullScreen is Allow vs. Ask. 458 // FullScreen is Allow vs. Ask.
461 return category == settings.ContentSettingsTypes.FULLSCREEN ? 459 return category == settings.ContentSettingsTypes.FULLSCREEN ?
462 setting != settings.PermissionValues.ASK : 460 setting != settings.PermissionValues.ASK :
463 setting != settings.PermissionValues.BLOCK; 461 setting != settings.PermissionValues.BLOCK;
464 }, 462 },
465 }; 463 };
466 464
467 /** @polymerBehavior */ 465 /** @polymerBehavior */
468 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; 466 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698