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

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: 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: {
michaelpg 2015/11/09 18:26:30 category: Number
Finnur 2015/11/10 16:00:51 Done.
37 type: Number,
38 },
39
40 /**
41 * The origin, which this permission affects.
42 */
43 origin: {
44 type: String,
45 observer: 'initialize_',
46 },
47
48 i18n_: {
49 readOnly: true,
50 type: Object,
51 value: function() {
52 return {
53 allowAction: loadTimeData.getString('siteSettingsActionAllow'),
54 blockAction: loadTimeData.getString('siteSettingsActionBlock'),
55 };
56 },
57 },
58 },
59
60 initialize_: function() {
61 var pref = this.getPref(
62 this.computeCategoryExceptionsPrefName(this.category));
63 var originPref = pref.value[this.origin + ',*'];
64 if (originPref === undefined)
65 originPref = pref.value[this.origin + ',' + this.origin];
66 if (originPref === undefined)
67 return;
68
69 if (originPref.setting == settings.DefaultValues.ALLOW) {
Finnur 2015/11/06 11:45:36 One question: Do you know how to take care of this
michaelpg 2015/11/09 18:26:30 Ultimately you'll need to annotate the type of ori
michaelpg 2015/11/09 18:26:30 hmm, kinda wish we had named this something more s
Finnur 2015/11/10 16:00:51 I agree. Renamed.
Finnur 2015/11/10 16:00:51 For some reason I was stuck in the mindset of havi
70 this.$.permission.selected = 0;
71 this.$.details.hidden = false;
72 } else if (originPref.setting == settings.DefaultValues.BLOCK) {
73 this.$.permission.selected = 1;
74 this.$.details.hidden = false;
75 }
76 },
77
78 resetPermission: function() {
79 var pref = this.getPref(
80 this.computeCategoryExceptionsPrefName(this.category));
81 delete pref.value[this.origin + ',' + this.origin];
82 delete pref.value[this.origin + ',*'];
83 this.setPrefValue(
84 this.computeCategoryExceptionsPrefName(this.category), pref.value);
85 this.$.details.hidden = true;
86 },
87 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698