diff options
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/options/browser_options.html | 4 | ||||
-rw-r--r-- | chrome/browser/resources/options/browser_options.js | 24 | ||||
-rw-r--r-- | chrome/browser/resources/options/instant_confirm_overlay.js | 4 |
3 files changed, 21 insertions, 11 deletions
diff --git a/chrome/browser/resources/options/browser_options.html b/chrome/browser/resources/options/browser_options.html index e79d702..d8244c1 100644 --- a/chrome/browser/resources/options/browser_options.html +++ b/chrome/browser/resources/options/browser_options.html @@ -89,10 +89,6 @@ <input type="checkbox" id="instantEnableCheckbox" pref="instant.enabled"> <span i18n-content="instantName"></span> - <!-- This hidden checkbox allows us to get/set the state of the - confirm_dialog_shown pref --> - <input type="checkbox" class="hidden" id="instantDialogShown" - pref="instant.confirm_dialog_shown"> </label> </div> <div class="suboption informational-text"> diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js index 6f5a2a7..2819807 100644 --- a/chrome/browser/resources/options/browser_options.js +++ b/chrome/browser/resources/options/browser_options.js @@ -34,6 +34,9 @@ cr.define('options', function() { 'managed': false }, + // The cached value of the instant.confirm_dialog_shown preference. + instantConfirmDialogShown_: false, + /** * Initialize BrowserOptions page. */ @@ -53,17 +56,20 @@ cr.define('options', function() { chrome.send('coreOptionsUserMetricsAction', ['Options_ManageSearchEngines']); }; - $('instantEnableCheckbox').onclick = function(event) { - var alreadyConfirmed = $('instantDialogShown').checked; + $('defaultSearchEngine').onchange = this.setDefaultSearchEngine; - if (this.checked && !alreadyConfirmed) { + 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'); } }; - $('defaultSearchEngine').onchange = this.setDefaultSearchEngine; + + Preferences.getInstance().addEventListener('instant.confirm_dialog_shown', + this.onInstantConfirmDialogShownChanged_.bind(this)); var homepageField = $('homepageURL'); $('homepageUseNTPButton').onchange = @@ -112,6 +118,16 @@ cr.define('options', function() { }, /** + * Called when the value of the instant.confirm_dialog_shown preference + * changes. Cache this value. + * @param {Event} event Change event. + * @private + */ + onInstantConfirmDialogShownChanged_: function(event) { + this.instantConfirmDialogShown_ = event.value['value']; + }, + + /** * Update the Default Browsers section based on the current state. * @private * @param {string} statusString Description of the current default state. diff --git a/chrome/browser/resources/options/instant_confirm_overlay.js b/chrome/browser/resources/options/instant_confirm_overlay.js index 3ba9793..9f983c7 100644 --- a/chrome/browser/resources/options/instant_confirm_overlay.js +++ b/chrome/browser/resources/options/instant_confirm_overlay.js @@ -25,9 +25,7 @@ cr.define('options', function() { }; $('instantConfirmOk').onclick = function() { OptionsPage.closeOverlay(); - var instantDialogShown = $('instantDialogShown'); - Preferences.setBooleanPref(instantDialogShown.pref, true, - instantDialogShown.metric); + Preferences.setBooleanPref('instant.confirm_dialog_shown', true); var instantEnabledCheckbox = $('instantEnableCheckbox'); Preferences.setBooleanPref(instantEnableCheckbox.pref, true, instantEnableCheckbox.metric); |