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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /////////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////////
6 // PrefCheckbox class: 6 // PrefCheckbox class:
7 7
8 // Define a constructor that uses an input element as its underlying element. 8 // Define a constructor that uses an input element as its underlying element.
9 var PrefCheckbox = cr.ui.define('input'); 9 var PrefCheckbox = cr.ui.define('input');
10 10
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 }; 35 };
36 36
37 /** 37 /**
38 * The preference name. 38 * The preference name.
39 * @type {string} 39 * @type {string}
40 */ 40 */
41 cr.defineProperty(PrefCheckbox, 'pref', cr.PropertyKind.ATTR); 41 cr.defineProperty(PrefCheckbox, 'pref', cr.PropertyKind.ATTR);
42 42
43 /////////////////////////////////////////////////////////////////////////////// 43 ///////////////////////////////////////////////////////////////////////////////
44 // PrefRadio class:
45
46 // Define a constructor that uses an input element as its underlying element.
47 var PrefRadio = cr.ui.define('input');
48
49 PrefRadio.prototype = {
50 // Set up the prototype chain
51 __proto__: HTMLInputElement.prototype,
52
53 /**
54 * Initialization function for the cr.ui framework.
55 */
56 decorate: function() {
57 this.type = 'radio';
58 var self = this;
59
60 // Listen to pref changes.
61 Preferences.getInstance().addEventListener(this.pref,
62 function(event) {
63 self.checked = String(event.value) == self.value;
64 });
65
66 // Listen to user events.
67 this.addEventListener('change',
68 function(e) {
69 if(self.value == 'true' || self.value == 'false') {
70 Preferences.setBooleanPref(self.pref,
71 self.value == 'true');
72 }else {
73 Preferences.setIntegerPref(self.pref,
74 parseInt(self.value, 10));
75 }
76 });
77 },
78
79 /**
80 * Getter for preference name attribute.
81 */
82 get pref() {
83 return this.getAttribute('pref');
84 },
85
86 /**
87 * Setter for preference name attribute.
88 */
89 set pref(name) {
90 this.setAttribute('pref', name);
91 }
92 };
93
94
95 ///////////////////////////////////////////////////////////////////////////////
44 // PrefRange class: 96 // PrefRange class:
45 97
46 // Define a constructor that uses an input element as its underlying element. 98 // Define a constructor that uses an input element as its underlying element.
47 var PrefRange = cr.ui.define('input'); 99 var PrefRange = cr.ui.define('input');
48 100
49 PrefRange.prototype = { 101 PrefRange.prototype = {
50 // Set up the prototype chain 102 // Set up the prototype chain
51 __proto__: HTMLInputElement.prototype, 103 __proto__: HTMLInputElement.prototype,
52 104
53 /** 105 /**
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 this.appendChild(new Option(values[1], values[0])); 177 this.appendChild(new Option(values[1], values[0]));
126 }, this); 178 }, this);
127 } 179 }
128 }; 180 };
129 181
130 /** 182 /**
131 * The preference name. 183 * The preference name.
132 * @type {string} 184 * @type {string}
133 */ 185 */
134 cr.defineProperty(PrefSelect, 'pref', cr.PropertyKind.ATTR); 186 cr.defineProperty(PrefSelect, 'pref', cr.PropertyKind.ATTR);
OLDNEW
« 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