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

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

Issue 7337007: Introduce a field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix onchange handling Created 9 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
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..d4e8042d2347ac4670df328eae22c5cb061005c2 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -83,9 +83,17 @@ cr.define('options', function() {
return true;
};
+ $('instantFieldTrialCheckbox').onchange = function(event) {
Sheridan Rawlins 2011/07/26 07:07:15 Follow style of others in this file: use addEventL
sreeram 2011/07/26 07:36:10 Done.
+ this.checked = true;
+ chrome.send('disableInstant');
+ }
+
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 +177,26 @@ 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) {
+ $('instantEnabledCheckbox').hidden = enabled;
+ $('instantFieldTrialCheckbox').hidden = !enabled;
+ },
+
+ /**
* 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 +517,10 @@ cr.define('options', function() {
BrowserOptions.getInstance().updateAutocompleteSuggestions_(suggestions);
};
+ BrowserOptions.setInstantFieldTrialStatus = function(enabled) {
+ BrowserOptions.getInstance().setInstantFieldTrialStatus_(enabled);
+ };
+
// Export
return {
BrowserOptions: BrowserOptions

Powered by Google App Engine
This is Rietveld 408576698