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

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

Issue 2819046: Make the personal stuff page viewable. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Remove the two old line for sync in gypi Created 10 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
« no previous file with comments | « chrome/browser/resources/options/personal_options.js ('k') | chrome/chrome_browser.gypi » ('j') | 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 3cf6f496ab702bde31eb95777eaa9d3963e6209b..4522ab540b00b2ae42519580204e3b425ef78eba 100644
--- a/chrome/browser/resources/options/pref_ui.js
+++ b/chrome/browser/resources/options/pref_ui.js
@@ -41,6 +41,58 @@ PrefCheckbox.prototype = {
cr.defineProperty(PrefCheckbox, 'pref', cr.PropertyKind.ATTR);
///////////////////////////////////////////////////////////////////////////////
+// PrefRadio class:
+
+// Define a constructor that uses an input element as its underlying element.
+var PrefRadio = cr.ui.define('input');
+
+PrefRadio.prototype = {
+ // Set up the prototype chain
+ __proto__: HTMLInputElement.prototype,
+
+ /**
+ * Initialization function for the cr.ui framework.
+ */
+ decorate: function() {
+ this.type = 'radio';
+ var self = this;
+
+ // Listen to pref changes.
+ Preferences.getInstance().addEventListener(this.pref,
+ function(event) {
+ self.checked = String(event.value) == self.value;
+ });
+
+ // Listen to user events.
+ this.addEventListener('change',
+ function(e) {
+ if(self.value == 'true' || self.value == 'false') {
+ Preferences.setBooleanPref(self.pref,
+ self.value == 'true');
+ }else {
+ Preferences.setIntegerPref(self.pref,
+ parseInt(self.value, 10));
+ }
+ });
+ },
+
+ /**
+ * Getter for preference name attribute.
+ */
+ get pref() {
+ return this.getAttribute('pref');
+ },
+
+ /**
+ * Setter for preference name attribute.
+ */
+ set pref(name) {
+ this.setAttribute('pref', name);
+ }
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
// PrefRange class:
// Define a constructor that uses an input element as its underlying element.
« no previous file with comments | « chrome/browser/resources/options/personal_options.js ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698