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

Unified Diff: chrome/browser/resources/settings/controls/controlled_button.js

Issue 2178273002: MD Settings: add a <controlled-button> that uses prefs to disable itself (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: try again Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/controls/controlled_button.js
diff --git a/chrome/browser/resources/settings/controls/controlled_button.js b/chrome/browser/resources/settings/controls/controlled_button.js
new file mode 100644
index 0000000000000000000000000000000000000000..30484c8eb5afdd8f41d6e376fc42f8275e07f792
--- /dev/null
+++ b/chrome/browser/resources/settings/controls/controlled_button.js
@@ -0,0 +1,25 @@
+// Copyright 2016 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.
+
+Polymer({
+ is: 'controlled-button',
+
+ behaviors: [CrPolicyPrefBehavior, PrefControlBehavior],
+
+ properties: {
+ disabled_: {
+ type: Boolean,
+ computed: 'computeDisabled_(pref.*)',
+ },
+ },
+
+ /**
+ * @param {!chrome.settingsPrivate.PrefObject} pref
+ * @return {boolean} Whether the button should be disabled.
+ * @private
+ */
+ computeDisabled_: function(pref) {
+ return this.isPrefPolicyControlled(pref);
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698