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

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

Issue 1428313002: Add a page for showing the details for a given origin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 5 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
7 * 'site-details-permission' handles showing the state of one permission, such
8 * as Geolocation, for a given origin.
9 *
10 * Example:
11 *
12 * <site-details-permission prefs="{{prefs}}">
13 * </site-details-permission>
14 * ... other pages ...
15 *
16 * @group Chrome Settings Elements
17 * @element site-details-permission
18 */
19 Polymer({
20 is: 'site-details-permission',
21
22 behaviors: [PrefsBehavior, SiteSettingsBehavior],
23
24 properties: {
25 /**
26 * Preferences state.
27 */
28 prefs: {
29 type: Object,
30 notify: true,
31 },
32
33 /**
34 * The ID of the category this widget is displaying data for.
35 */
36 category: Number,
37
38 /**
39 * The origin, which this permission affects.
40 */
41 origin: {
42 type: String,
43 observer: 'initialize_',
44 },
45
46 i18n_: {
47 readOnly: true,
48 type: Object,
49 value: function() {
50 return {
51 allowAction: loadTimeData.getString('siteSettingsActionAllow'),
52 blockAction: loadTimeData.getString('siteSettingsActionBlock'),
53 };
54 },
55 },
56 },
57
58 initialize_: function() {
59 var pref = this.getPref(
60 this.computeCategoryExceptionsPrefName(this.category));
61 var originPref = pref.value[this.origin + ',*'];
62 if (originPref === undefined)
63 originPref = pref.value[this.origin + ',' + this.origin];
64 if (originPref === undefined)
65 return;
66
67 if (/** @type {{setting: number}} */(originPref.setting) ==
68 settings.PermissionValues.ALLOW) {
69 this.$.permission.selected = 0;
70 this.$.details.hidden = false;
71 } else if (originPref.setting == settings.PermissionValues.BLOCK) {
72 this.$.permission.selected = 1;
73 this.$.details.hidden = false;
74 }
75 },
76
77 resetPermission: function() {
78 var pref = this.getPref(
79 this.computeCategoryExceptionsPrefName(this.category));
80 delete pref.value[this.origin + ',' + this.origin];
81 delete pref.value[this.origin + ',*'];
82 this.setPrefValue(
83 this.computeCategoryExceptionsPrefName(this.category), pref.value);
84 this.$.details.hidden = true;
85 },
86 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698