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

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: Added opt-out histogram 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 9a043143cc7d1fcc8cd3d17c6ddec8272421ef3a..050cef51043c00b957cf9ed42093cbf785b507e0 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -71,18 +71,24 @@ cr.define('options', function() {
$('defaultSearchEngine').onchange = this.setDefaultSearchEngine_;
var self = this;
- $('instantEnableCheckbox').onclick = function(event) {
- if (this.checked && !self.instantConfirmDialogShown_) {
- // Leave disabled for now. The PrefCheckbox handler already set it to
- // true so undo that.
- Preferences.setBooleanPref(this.pref, false, this.metric);
- OptionsPage.navigateToPage('instantConfirm');
+ $('instantEnabledCheckbox').onclick = function(event) {
+ if (this.checked) {
+ if (self.instantConfirmDialogShown_) {
+ chrome.send('enableInstant');
+ } else {
+ OptionsPage.navigateToPage('instantConfirm');
+ }
+ } else {
+ 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);
@@ -166,6 +172,29 @@ cr.define('options', function() {
},
/**
+ * Called when the value of the instant.enabled preference changes. Update
+ * the state of the checkbox.
+ * @param {Event} event Change event.
+ * @private
+ */
+ onInstantEnabledChanged_: function(event) {
+ var checkbox = $('instantEnabledCheckbox');
+ checkbox.checked = event.value['value'];
+ checkbox.disabled = event.value['managed'];
+
+ chrome.send('isInstantFieldTrialExperimentGroup');
+ },
+
+ /**
+ * Called to inform that the user has been selected into the Instant field
+ * trial experiment group (see instant_field_trial.h).
+ * @private
+ */
+ setInstantFieldTrialExperimentGroup_: function() {
+ $('instantEnabledCheckbox').checked = true;
+ },
+
+ /**
* 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
@@ -486,6 +515,10 @@ cr.define('options', function() {
BrowserOptions.getInstance().updateAutocompleteSuggestions_(suggestions);
};
+ BrowserOptions.setInstantFieldTrialExperimentGroup = function() {
+ BrowserOptions.getInstance().setInstantFieldTrialExperimentGroup_();
+ };
+
// Export
return {
BrowserOptions: BrowserOptions

Powered by Google App Engine
This is Rietveld 408576698