| 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
|
|
|