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

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

Issue 1838213002: Simplify Site Settings tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 8 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 6 * @fileoverview
7 * 'site-details-permission' handles showing the state of one permission, such 7 * 'site-details-permission' handles showing the state of one permission, such
8 * as Geolocation, for a given origin. 8 * as Geolocation, for a given origin.
9 */ 9 */
10 Polymer({ 10 Polymer({
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 * @private 46 * @private
47 */ 47 */
48 siteChanged_: function(site) { 48 siteChanged_: function(site) {
49 this.$.details.hidden = true; 49 this.$.details.hidden = true;
50 50
51 var prefsProxy = settings.SiteSettingsPrefsBrowserProxyImpl.getInstance(); 51 var prefsProxy = settings.SiteSettingsPrefsBrowserProxyImpl.getInstance();
52 prefsProxy.getExceptionList(this.category).then(function(exceptionList) { 52 prefsProxy.getExceptionList(this.category).then(function(exceptionList) {
53 for (var i = 0; i < exceptionList.length; ++i) { 53 for (var i = 0; i < exceptionList.length; ++i) {
54 if (exceptionList[i].origin == site.origin) { 54 if (exceptionList[i].origin == site.origin) {
55 // TODO(finnur): Convert to use attrForSelected. 55 // TODO(finnur): Convert to use attrForSelected.
56 this.$.permission.selected = 56 this.$.permission.selected = exceptionList[i].setting ==
57 exceptionList[i].setting == 'allow' ? 0 : 1; 57 settings.PermissionStringValues.ALLOW ? 0 : 1;
58 this.$.details.hidden = false; 58 this.$.details.hidden = false;
59 } 59 }
60 } 60 }
61 }.bind(this)); 61 }.bind(this));
62 }, 62 },
63 63
64 /** 64 /**
65 * Called when a site within a category has been changed. 65 * Called when a site within a category has been changed.
66 * @param {number} category The category that changed. 66 * @param {number} category The category that changed.
67 * @param {string} site The site that changed. 67 * @param {string} site The site that changed.
(...skipping 27 matching lines...) Expand all
95 // TODO(finnur): Compare with event.detail.item.dataset.permission directly 95 // TODO(finnur): Compare with event.detail.item.dataset.permission directly
96 // once attrForSelected is in use. 96 // once attrForSelected is in use.
97 var action = event.detail.item.innerText; 97 var action = event.detail.item.innerText;
98 var value = (action == this.i18n_.allowAction) ? 98 var value = (action == this.i18n_.allowAction) ?
99 settings.PermissionValues.ALLOW : 99 settings.PermissionValues.ALLOW :
100 settings.PermissionValues.BLOCK; 100 settings.PermissionValues.BLOCK;
101 this.setCategoryPermissionForOrigin( 101 this.setCategoryPermissionForOrigin(
102 this.site.origin, '', value, this.category); 102 this.site.origin, '', value, this.category);
103 }, 103 },
104 }); 104 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698