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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/site_settings/site_details_permission.js
diff --git a/chrome/browser/resources/settings/site_settings/site_details_permission.js b/chrome/browser/resources/settings/site_settings/site_details_permission.js
new file mode 100644
index 0000000000000000000000000000000000000000..d41dd90fa23375e2b2f581f0ce9b38379775d9f3
--- /dev/null
+++ b/chrome/browser/resources/settings/site_settings/site_details_permission.js
@@ -0,0 +1,86 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview
+ * 'site-details-permission' handles showing the state of one permission, such
+ * as Geolocation, for a given origin.
+ *
+ * Example:
+ *
+ * <site-details-permission prefs="{{prefs}}">
+ * </site-details-permission>
+ * ... other pages ...
+ *
+ * @group Chrome Settings Elements
+ * @element site-details-permission
+ */
+Polymer({
+ is: 'site-details-permission',
+
+ behaviors: [PrefsBehavior, SiteSettingsBehavior],
+
+ properties: {
+ /**
+ * Preferences state.
+ */
+ prefs: {
+ type: Object,
+ notify: true,
+ },
+
+ /**
+ * The ID of the category this widget is displaying data for.
+ */
+ category: Number,
+
+ /**
+ * The origin, which this permission affects.
+ */
+ origin: {
+ type: String,
+ observer: 'initialize_',
+ },
+
+ i18n_: {
+ readOnly: true,
+ type: Object,
+ value: function() {
+ return {
+ allowAction: loadTimeData.getString('siteSettingsActionAllow'),
+ blockAction: loadTimeData.getString('siteSettingsActionBlock'),
+ };
+ },
+ },
+ },
+
+ initialize_: function() {
+ var pref = this.getPref(
+ this.computeCategoryExceptionsPrefName(this.category));
+ var originPref = pref.value[this.origin + ',*'];
+ if (originPref === undefined)
+ originPref = pref.value[this.origin + ',' + this.origin];
+ if (originPref === undefined)
+ return;
+
+ if (/** @type {{setting: number}} */(originPref.setting) ==
+ settings.PermissionValues.ALLOW) {
+ this.$.permission.selected = 0;
+ this.$.details.hidden = false;
+ } else if (originPref.setting == settings.PermissionValues.BLOCK) {
+ this.$.permission.selected = 1;
+ this.$.details.hidden = false;
+ }
+ },
+
+ resetPermission: function() {
+ var pref = this.getPref(
+ this.computeCategoryExceptionsPrefName(this.category));
+ delete pref.value[this.origin + ',' + this.origin];
+ delete pref.value[this.origin + ',*'];
+ this.setPrefValue(
+ this.computeCategoryExceptionsPrefName(this.category), pref.value);
+ this.$.details.hidden = true;
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698