OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 | 6 |
7 ///////////////////////////////////////////////////////////////////////////// | 7 ///////////////////////////////////////////////////////////////////////////// |
8 // Preferences class: | 8 // Preferences class: |
9 | 9 |
10 /** | 10 /** |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (opt_metric != undefined) argumentList.push(opt_metric); | 145 if (opt_metric != undefined) argumentList.push(opt_metric); |
146 chrome.send('clearPref', argumentList); | 146 chrome.send('clearPref', argumentList); |
147 }; | 147 }; |
148 | 148 |
149 Preferences.prototype = { | 149 Preferences.prototype = { |
150 __proto__: cr.EventTarget.prototype, | 150 __proto__: cr.EventTarget.prototype, |
151 | 151 |
152 /** | 152 /** |
153 * Adds an event listener to the target. | 153 * Adds an event listener to the target. |
154 * @param {string} type The name of the event. | 154 * @param {string} type The name of the event. |
155 * @param {!Function|{handleEvent:Function}} handler The handler for the | 155 * @param {EventListenerType} handler The handler for the event. This is |
156 * event. This is called when the event is dispatched. | 156 * called when the event is dispatched. |
157 */ | 157 */ |
158 addEventListener: function(type, handler) { | 158 addEventListener: function(type, handler) { |
159 cr.EventTarget.prototype.addEventListener.call(this, type, handler); | 159 cr.EventTarget.prototype.addEventListener.call(this, type, handler); |
160 if (!(type in this.registeredPreferences_)) | 160 if (!(type in this.registeredPreferences_)) |
161 this.registeredPreferences_[type] = {}; | 161 this.registeredPreferences_[type] = {}; |
162 }, | 162 }, |
163 | 163 |
164 /** | 164 /** |
165 * Initializes preference reading and change notifications. | 165 * Initializes preference reading and change notifications. |
166 */ | 166 */ |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 if (event.value) | 329 if (event.value) |
330 prefs.dispatchEvent(event); | 330 prefs.dispatchEvent(event); |
331 }; | 331 }; |
332 | 332 |
333 // Export | 333 // Export |
334 return { | 334 return { |
335 Preferences: Preferences | 335 Preferences: Preferences |
336 }; | 336 }; |
337 | 337 |
338 }); | 338 }); |
OLD | NEW |