| 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 15 matching lines...) Expand all Loading... |
| 26 created: function() { | 26 created: function() { |
| 27 this.browserProxy = | 27 this.browserProxy = |
| 28 settings.SiteSettingsPrefsBrowserProxyImpl.getInstance(); | 28 settings.SiteSettingsPrefsBrowserProxyImpl.getInstance(); |
| 29 }, | 29 }, |
| 30 | 30 |
| 31 ready: function() { | 31 ready: function() { |
| 32 this.PermissionValues = settings.PermissionValues; | 32 this.PermissionValues = settings.PermissionValues; |
| 33 }, | 33 }, |
| 34 | 34 |
| 35 /** | 35 /** |
| 36 * Re-sets the category permission for a given origin. | |
| 37 * @param {string} primaryPattern The primary pattern to reset the permission | |
| 38 * for. | |
| 39 * @param {string} secondaryPattern The secondary pattern to reset the | |
| 40 * permission for. | |
| 41 * @param {string} category The category permission to change. | |
| 42 * @protected | |
| 43 */ | |
| 44 resetCategoryPermissionForOrigin: function( | |
| 45 primaryPattern, secondaryPattern, category) { | |
| 46 this.browserProxy.resetCategoryPermissionForOrigin( | |
| 47 primaryPattern, secondaryPattern, category); | |
| 48 }, | |
| 49 | |
| 50 /** | |
| 51 * Sets the category permission for a given origin. | |
| 52 * @param {string} primaryPattern The primary pattern to change the permission | |
| 53 * for. | |
| 54 * @param {string} secondaryPattern The secondary pattern to change the | |
| 55 * permission for. | |
| 56 * @param {string} category The category permission to change. | |
| 57 * @param {string} value What value to set the permission to. | |
| 58 * @protected | |
| 59 */ | |
| 60 setCategoryPermissionForOrigin: function( | |
| 61 primaryPattern, secondaryPattern, category, value) { | |
| 62 this.browserProxy.setCategoryPermissionForOrigin( | |
| 63 primaryPattern, secondaryPattern, category, value); | |
| 64 }, | |
| 65 | |
| 66 /** | |
| 67 * A utility function to lookup a category name from its enum. Note: The | 36 * A utility function to lookup a category name from its enum. Note: The |
| 68 * category name is visible to the user as part of the URL. | 37 * category name is visible to the user as part of the URL. |
| 69 * @param {string} category The category ID to look up. | 38 * @param {string} category The category ID to look up. |
| 70 * @return {string} The category found or blank string if not found. | 39 * @return {string} The category found or blank string if not found. |
| 71 * @protected | 40 * @protected |
| 72 */ | 41 */ |
| 73 computeCategoryTextId: function(category) { | 42 computeCategoryTextId: function(category) { |
| 74 switch (category) { | 43 switch (category) { |
| 75 case settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS: | 44 case settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS: |
| 76 return 'automatic-downloads'; | 45 return 'automatic-downloads'; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 computeIsSettingEnabled: function(category, setting) { | 426 computeIsSettingEnabled: function(category, setting) { |
| 458 // FullScreen is Allow vs. Ask. | 427 // FullScreen is Allow vs. Ask. |
| 459 return category == settings.ContentSettingsTypes.FULLSCREEN ? | 428 return category == settings.ContentSettingsTypes.FULLSCREEN ? |
| 460 setting != settings.PermissionValues.ASK : | 429 setting != settings.PermissionValues.ASK : |
| 461 setting != settings.PermissionValues.BLOCK; | 430 setting != settings.PermissionValues.BLOCK; |
| 462 }, | 431 }, |
| 463 }; | 432 }; |
| 464 | 433 |
| 465 /** @polymerBehavior */ | 434 /** @polymerBehavior */ |
| 466 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; | 435 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; |
| OLD | NEW |