 Chromium Code Reviews
 Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 cr.define('options', function() { | 5 cr.define('options', function() { | 
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; | 
| 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 
| 8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; | 
| 9 | 9 | 
| 10 // | 10 // | 
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 $('manage-default-search-engines').onclick = function(event) { | 161 $('manage-default-search-engines').onclick = function(event) { | 
| 162 OptionsPage.navigateToPage('searchEngines'); | 162 OptionsPage.navigateToPage('searchEngines'); | 
| 163 chrome.send('coreOptionsUserMetricsAction', | 163 chrome.send('coreOptionsUserMetricsAction', | 
| 164 ['Options_ManageSearchEngines']); | 164 ['Options_ManageSearchEngines']); | 
| 165 }; | 165 }; | 
| 166 $('default-search-engine').addEventListener('change', | 166 $('default-search-engine').addEventListener('change', | 
| 167 this.setDefaultSearchEngine_); | 167 this.setDefaultSearchEngine_); | 
| 168 $('instant-enabled-control').customChangeHandler = function(event) { | 168 $('instant-enabled-control').customChangeHandler = function(event) { | 
| 169 if (this.checked && !self.instantConfirmDialogShown_) { | 169 if (this.checked && !self.instantConfirmDialogShown_) { | 
| 170 OptionsPage.showPageByName('instantConfirm', false); | 170 OptionsPage.showPageByName('instantConfirm', false); | 
| 171 InstantConfirmOverlay.getInstance().confirming_follow_recommendation = | |
| 172 false; | |
| 171 return true; // Stop default preference processing. | 173 return true; // Stop default preference processing. | 
| 172 } | 174 } | 
| 173 return false; // Allow default preference processing. | 175 return false; // Allow default preference processing. | 
| 174 }; | 176 }; | 
| 177 var instant_enabled_indicator = $('instant-enabled-indicator'); | |
| 178 Preferences.getInstance().addEventListener( | |
| 179 instant_enabled_indicator.pref, function(event) { | |
| 180 instant_enabled_indicator.recommendedValue = | |
| 181 event.value.recommendedValue; | |
| 182 }); | |
| 
Joao da Silva
2012/10/22 20:47:38
Shouldn't this be handled by the generic code that
 
bartfab (slow)
2012/10/23 10:28:31
Thanks for the comments. They motivated me to bite
 | |
| 183 instant_enabled_indicator.resetHandler = function() { | |
| 184 if (this.recommendedValue && !self.instantConfirmDialogShown_) { | |
| 185 OptionsPage.showPageByName('instantConfirm', false); | |
| 186 InstantConfirmOverlay.getInstance().confirming_follow_recommendation = | |
| 187 true; | |
| 188 } else { | |
| 189 Preferences.clearPref(this.pref, true); | |
| 190 } | |
| 191 }; | |
| 175 Preferences.getInstance().addEventListener('instant.confirm_dialog_shown', | 192 Preferences.getInstance().addEventListener('instant.confirm_dialog_shown', | 
| 176 this.onInstantConfirmDialogShownChanged_.bind(this)); | 193 this.onInstantConfirmDialogShownChanged_.bind(this)); | 
| 177 | 194 | 
| 178 // Users section. | 195 // Users section. | 
| 179 if (loadTimeData.valueExists('profilesInfo')) { | 196 if (loadTimeData.valueExists('profilesInfo')) { | 
| 180 $('profiles-section').hidden = false; | 197 $('profiles-section').hidden = false; | 
| 181 | 198 | 
| 182 var profilesList = $('profiles-list'); | 199 var profilesList = $('profiles-list'); | 
| 183 options.browser_options.ProfileList.decorate(profilesList); | 200 options.browser_options.ProfileList.decorate(profilesList); | 
| 184 profilesList.autoExpands = true; | 201 profilesList.autoExpands = true; | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 $('privacyClearDataButton').onclick = function(event) { | 267 $('privacyClearDataButton').onclick = function(event) { | 
| 251 OptionsPage.navigateToPage('clearBrowserData'); | 268 OptionsPage.navigateToPage('clearBrowserData'); | 
| 252 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); | 269 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); | 
| 253 }; | 270 }; | 
| 254 // 'spelling-enabled-control' element is only present on Chrome branded | 271 // 'spelling-enabled-control' element is only present on Chrome branded | 
| 255 // builds. | 272 // builds. | 
| 256 if ($('spelling-enabled-control')) { | 273 if ($('spelling-enabled-control')) { | 
| 257 $('spelling-enabled-control').customChangeHandler = function(event) { | 274 $('spelling-enabled-control').customChangeHandler = function(event) { | 
| 258 if (this.checked && !self.spellcheckConfirmDialogShown_) { | 275 if (this.checked && !self.spellcheckConfirmDialogShown_) { | 
| 259 OptionsPage.showPageByName('spellingConfirm', false); | 276 OptionsPage.showPageByName('spellingConfirm', false); | 
| 277 SpellingConfirmOverlay.getInstance() | |
| 278 .confirming_follow_recommendation = false; | |
| 260 return true; | 279 return true; | 
| 261 } | 280 } | 
| 262 return false; | 281 return false; | 
| 263 }; | 282 }; | 
| 283 var spelling_enabled_indicator = $('spelling-enabled-indicator'); | |
| 284 Preferences.getInstance().addEventListener( | |
| 285 spelling_enabled_indicator.pref, function(event) { | |
| 286 spelling_enabled_indicator.recommendedValue = | |
| 287 event.value.recommendedValue; | |
| 
Joao da Silva
2012/10/22 20:47:38
Same here.
This code can be shared for prefs that
 | |
| 288 }); | |
| 289 spelling_enabled_indicator.resetHandler = function() { | |
| 290 if (this.recommendedValue && !self.spellcheckConfirmDialogShown_) { | |
| 291 OptionsPage.showPageByName('spellingConfirm', false); | |
| 292 SpellingConfirmOverlay.getInstance() | |
| 293 .confirming_follow_recommendation = true; | |
| 294 } else { | |
| 295 Preferences.clearPref(this.pref, true); | |
| 296 } | |
| 297 }; | |
| 264 Preferences.getInstance().addEventListener( | 298 Preferences.getInstance().addEventListener( | 
| 265 'spellcheck.confirm_dialog_shown', | 299 'spellcheck.confirm_dialog_shown', | 
| 266 this.onSpellcheckConfirmDialogShownChanged_.bind(this)); | 300 this.onSpellcheckConfirmDialogShownChanged_.bind(this)); | 
| 267 } | 301 } | 
| 268 // 'metricsReportingEnabled' element is only present on Chrome branded | 302 // 'metricsReportingEnabled' element is only present on Chrome branded | 
| 269 // builds. | 303 // builds. | 
| 270 if ($('metricsReportingEnabled')) { | 304 if ($('metricsReportingEnabled')) { | 
| 271 $('metricsReportingEnabled').onclick = function(event) { | 305 $('metricsReportingEnabled').onclick = function(event) { | 
| 272 chrome.send('metricsReportingCheckboxAction', | 306 chrome.send('metricsReportingCheckboxAction', | 
| 273 [String(event.target.checked)]); | 307 [String(event.target.checked)]); | 
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1344 BrowserOptions.getLoggedInUsername = function() { | 1378 BrowserOptions.getLoggedInUsername = function() { | 
| 1345 return BrowserOptions.getInstance().username_; | 1379 return BrowserOptions.getInstance().username_; | 
| 1346 }; | 1380 }; | 
| 1347 } | 1381 } | 
| 1348 | 1382 | 
| 1349 // Export | 1383 // Export | 
| 1350 return { | 1384 return { | 
| 1351 BrowserOptions: BrowserOptions | 1385 BrowserOptions: BrowserOptions | 
| 1352 }; | 1386 }; | 
| 1353 }); | 1387 }); | 
| OLD | NEW |