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

Unified Diff: chrome/browser/resources/options/pref_ui.js

Issue 1061263004: Fixes wrong inheritance of PrefSelect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/pref_ui.js
diff --git a/chrome/browser/resources/options/pref_ui.js b/chrome/browser/resources/options/pref_ui.js
index a4a1127c75defebe4b85a0c60d37b4d15cf065aa..b97abaef34b43098ec2e3217687cc861ee6813aa 100644
--- a/chrome/browser/resources/options/pref_ui.js
+++ b/chrome/browser/resources/options/pref_ui.js
@@ -390,7 +390,21 @@ cr.define('options', function() {
PrefSelect.prototype = {
// Set up the prototype chain
- __proto__: PrefInputElement.prototype,
+ __proto__: HTMLSelectElement.prototype,
Dan Beam 2015/04/20 15:06:26 keep in mind that settings is being rewritten acti
arv (Not doing code reviews) 2015/04/24 14:22:45 With ES6 you can do traits. function PrefTrait(su
Yuki 2015/04/27 09:22:38 Looks cool to me. I defer this re-design task to
+
+ /**
+ * Initialization function for the cr.ui framework.
+ */
+ decorate: PrefInputElement.prototype.decorate,
+
+ /**
+ * Handle changes to the input element's state made by the user. If a custom
+ * change handler does not suppress it, a default handler is invoked that
+ * updates the associated pref.
+ * @param {Event} event Change event.
+ * @protected
+ */
+ handleChange: PrefInputElement.prototype.handleChange,
/**
* Update the associated pref when when the user selects an item.
@@ -449,8 +463,62 @@ cr.define('options', function() {
if (this.onchange)
this.onchange(event);
},
+
+ /**
+ * See |updateDisabledState| above.
+ */
+ setDisabled: PrefInputElement.prototype.setDisabled,
+
+ /**
+ * Custom change handler that is invoked first when the user makes changes
arv (Not doing code reviews) 2015/04/24 14:22:45 Are these comments just copied from PrefInputEleme
Dan Beam 2015/04/24 21:48:29 or [just] @override
Yuki 2015/04/27 09:22:38 Done.
+ * to the input element's state. If it returns false, a default handler is
+ * invoked next that updates the associated pref. If it returns true, the
+ * default handler is suppressed (i.e., this works like stopPropagation or
+ * cancelBubble).
+ * @param {Event} event Input element change event.
+ */
+ customChangeHandler: PrefInputElement.prototype.customChangeHandler,
+
+ /**
+ * Custom change handler that is invoked first when the preference
+ * associated with the input element changes. If it returns false, a default
+ * handler is invoked next that updates the input element. If it returns
+ * true, the default handler is suppressed.
+ * @param {Event} event Input element change event.
+ */
+ customPrefChangeHandler: PrefInputElement.prototype.customPrefChangeHandler,
};
+ /**
+ * The name of the associated preference.
+ */
+ cr.defineProperty(PrefSelect, 'pref', cr.PropertyKind.ATTR);
+
+ /**
+ * The data type of the associated preference, only relevant for derived
+ * classes that support different data types.
+ */
+ cr.defineProperty(PrefSelect, 'dataType', cr.PropertyKind.ATTR);
+
+ /**
+ * Whether this input element is part of a dialog. If so, changes take effect
+ * in the settings UI immediately but are only actually committed when the
+ * user confirms the dialog. If the user cancels the dialog instead, the
+ * changes are rolled back in the settings UI and never committed.
+ */
+ cr.defineProperty(PrefSelect, 'dialogPref', cr.PropertyKind.BOOL_ATTR);
+
+ /**
+ * Whether the associated preference is controlled by a source other than the
+ * user's setting (can be 'policy', 'extension', 'recommended' or unset).
+ */
+ cr.defineProperty(PrefSelect, 'controlledBy', cr.PropertyKind.ATTR);
+
+ /**
+ * The user metric string.
+ */
+ cr.defineProperty(PrefSelect, 'metric', cr.PropertyKind.ATTR);
+
/////////////////////////////////////////////////////////////////////////////
// PrefTextField class:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698