Index: chrome/browser/resources/options/browser_options.js |
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js |
index ffd838e4a2c7fa0d24f777617a75f8a37c5b43be..cc46f5d865b4be9ecba299f2ad5a2f5c16652b4d 100644 |
--- a/chrome/browser/resources/options/browser_options.js |
+++ b/chrome/browser/resources/options/browser_options.js |
@@ -86,6 +86,9 @@ cr.define('options', function() { |
Preferences.getInstance().addEventListener('instant.confirm_dialog_shown', |
this.onInstantConfirmDialogShownChanged_.bind(this)); |
+ Preferences.getInstance().addEventListener('instant.enabled', |
+ this.onInstantEnabledChanged_.bind(this)); |
+ |
var homepageField = $('homepageURL'); |
$('homepageUseNTPButton').onchange = |
this.handleHomepageUseNTPButtonChange_.bind(this); |
@@ -169,6 +172,34 @@ cr.define('options', function() { |
}, |
/** |
+ * Called when the value of the instant.enabled preference changes. Request |
+ * the state of the Instant field trial experiment. |
+ * @param {Event} event Change event. |
+ * @private |
+ */ |
+ onInstantEnabledChanged_: function(event) { |
+ chrome.send('getInstantFieldTrialStatus'); |
+ }, |
+ |
+ /** |
+ * Called to set the Instant field trial status. |
+ * @param {boolean} enabled If true, the experiment is enabled. |
+ * @private |
+ */ |
+ setInstantFieldTrialStatus_: function(enabled) { |
+ var experiment_checkbox = $('instantFieldTrialCheckbox'); |
+ var preference_checkbox = $('instantEnabledCheckbox'); |
+ if (enabled) { |
+ experiment_checkbox.checked = true; |
Evan Stade
2011/07/26 00:10:21
this should always start as true. Thus it can be p
sreeram
2011/07/26 02:45:53
Done.
|
+ experiment_checkbox.style.display = "inline"; |
+ preference_checkbox.style.display = "none"; |
Evan Stade
2011/07/26 00:10:21
foo.hidden = true/false
sreeram
2011/07/26 02:45:53
Done.
|
+ } else { |
+ experiment_checkbox.style.display = "none"; |
+ preference_checkbox.style.display = "inline"; |
+ } |
+ }, |
+ |
+ /** |
* Update the Default Browsers section based on the current state. |
* @param {string} statusString Description of the current default state. |
* @param {boolean} isDefault Whether or not the browser is currently |
@@ -489,6 +520,10 @@ cr.define('options', function() { |
BrowserOptions.getInstance().updateAutocompleteSuggestions_(suggestions); |
}; |
+ BrowserOptions.setInstantFieldTrialStatus = function(enabled) { |
+ BrowserOptions.getInstance().setInstantFieldTrialStatus_(enabled); |
+ }; |
+ |
// Export |
return { |
BrowserOptions: BrowserOptions |