diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-21 23:17:17 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-21 23:17:17 +0000 |
commit | 4793c9449382bbc28dc9b865b1e77177c9a2feaf (patch) | |
tree | f159eabc0862f8cfa6a6352c482674336ed3def5 /chrome/browser/resources | |
parent | ba463e96863261ba783e374fa7148fa263c9da4a (diff) | |
download | chromium_src-4793c9449382bbc28dc9b865b1e77177c9a2feaf.zip chromium_src-4793c9449382bbc28dc9b865b1e77177c9a2feaf.tar.gz chromium_src-4793c9449382bbc28dc9b865b1e77177c9a2feaf.tar.bz2 |
Enable and disable Chat Manager component extension based on labs preference setting.
BUG=56429
TEST=unit_tests --gtest_filter=ExtensionsServiceTest.*
Review URL: http://codereview.chromium.org/3120029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/options/chromeos_labs.html | 13 | ||||
-rw-r--r-- | chrome/browser/resources/options/pref_ui.js | 28 |
2 files changed, 39 insertions, 2 deletions
diff --git a/chrome/browser/resources/options/chromeos_labs.html b/chrome/browser/resources/options/chromeos_labs.html index cce03b4..9288a92 100644 --- a/chrome/browser/resources/options/chromeos_labs.html +++ b/chrome/browser/resources/options/chromeos_labs.html @@ -24,4 +24,17 @@ </table> </div> </section> + <section> + <h3 i18n-content="talk_title"></h3> + <div class="option"> + <table class="option-control-table"> + <tr> + <td class="option-name"><label><input id="talk-check" + pref="extensions.settings.ggnioahjipcehijkhpdjekioddnjoben.state" + type="checkbox" value-type="number"><span + i18n-content="talk"></span></label></td> + </tr> + </table> + </div> + </section> </div> diff --git a/chrome/browser/resources/options/pref_ui.js b/chrome/browser/resources/options/pref_ui.js index cdc223c..a0a656a8 100644 --- a/chrome/browser/resources/options/pref_ui.js +++ b/chrome/browser/resources/options/pref_ui.js @@ -25,8 +25,9 @@ cr.define('options', function() { // Listen to pref changes. Preferences.getInstance().addEventListener(this.pref, function(event) { - self.checked = (event.value && event.value['value'] != undefined) ? + var value = (event.value && event.value['value'] != undefined) ? event.value['value'] : event.value; + self.checked = Boolean(value); self.managed = (event.value && event.value['managed'] != undefined) ? event.value['managed'] : false; self.disabled = self.managed; @@ -35,8 +36,31 @@ cr.define('options', function() { // Listen to user events. this.addEventListener('click', function(e) { - Preferences.setBooleanPref(self.pref, self.checked, self.metric); + switch(self.valueType) { + case 'number': + Preferences.setIntegerPref(self.pref, + Number(self.checked), self.metric); + break; + case 'boolean': + Preferences.setBooleanPref(self.pref, self.checked, + self.checked, self.metric); + break; + } + }); + + // Initialize options. + this.ownerDocument.addEventListener('DOMContentLoaded', + function() { + self.initializeValueType(self.getAttribute('value-type')); }); + }, + + /** + * Sets up options in checkbox element. + * @param {String} valueType The preference type for this checkbox. + */ + initializeValueType: function(valueType) { + this.valueType = valueType || 'boolean'; } }; |