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

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

Issue 2437183002: [MD settings] content site list toggles (Closed)
Patch Set: review changes Created 4 years, 2 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/settings_boolean_control_behavior.js
diff --git a/chrome/browser/resources/settings/controls/settings_checkbox.js b/chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js
similarity index 73%
copy from chrome/browser/resources/settings/controls/settings_checkbox.js
copy to chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js
index 7dabd988baf2a41c04b32c49eded167d94c02cf7..c33553b68b6d6fabe226f6be2493f17aac81d4e3 100644
--- a/chrome/browser/resources/settings/controls/settings_checkbox.js
+++ b/chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js
@@ -1,29 +1,23 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// 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.
/**
* @fileoverview
- * `settings-checkbox` is a checkbox that controls a supplied preference.
- *
- * Example:
- * <settings-checkbox pref="{{prefs.settings.enableFoo}}"
- * label="Enable foo setting." subLabel="(bar also)">
- * </settings-checkbox>
+ * A behavior to help controls that handle a boolean preference, such as
+ * checkbox and toggle button.
*/
-Polymer({
- is: 'settings-checkbox',
-
- behaviors: [CrPolicyPrefBehavior, PrefControlBehavior],
+/** @polymerBehavior SettingsBooleanControlBehavior */
+var SettingsBooleanControlBehaviorImpl = {
properties: {
- /** Whether the checkbox should represent the inverted value. */
+ /** Whether the control should represent the inverted value. */
inverted: {
type: Boolean,
value: false,
},
- /** Whether the checkbox is checked. */
+ /** Whether the control is checked. */
checked: {
type: Boolean,
value: false,
@@ -40,13 +34,13 @@ Polymer({
reflectToAttribute: true
},
- /** Checkbox label. */
+ /** The main label. */
label: {
type: String,
value: '',
},
- /** Additional sub-label for the checkbox. */
+ /** Additional (optional) sub-label. */
subLabel: {
type: String,
value: '',
@@ -98,7 +92,14 @@ Polymer({
* @return {boolean} Whether the checkbox should be disabled.
* @private
*/
- checkboxDisabled_: function(disabled, pref) {
+ controlDisabled_: function(disabled, pref) {
return disabled || this.isPrefPolicyControlled(pref);
},
-});
+};
+
+/** @polymerBehavior */
+var SettingsBooleanControlBehavior = [
+ CrPolicyPrefBehavior,
+ PrefControlBehavior,
+ SettingsBooleanControlBehaviorImpl,
+];

Powered by Google App Engine
This is Rietveld 408576698