| 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 Page = cr.ui.pageManager.Page; |
| 8 var PageManager = cr.ui.pageManager.PageManager; |
| 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 9 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 var RepeatingButton = cr.ui.RepeatingButton; | 10 var RepeatingButton = cr.ui.RepeatingButton; |
| 9 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; | 11 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; |
| 10 | 12 |
| 11 // | 13 // |
| 12 // BrowserOptions class | 14 // BrowserOptions class |
| 13 // Encapsulated handling of browser options page. | 15 // Encapsulated handling of browser options page. |
| 14 // | 16 // |
| 15 function BrowserOptions() { | 17 function BrowserOptions() { |
| 16 OptionsPage.call(this, 'settings', loadTimeData.getString('settingsTitle'), | 18 Page.call(this, 'settings', loadTimeData.getString('settingsTitle'), |
| 17 'settings'); | 19 'settings'); |
| 18 } | 20 } |
| 19 | 21 |
| 20 cr.addSingletonGetter(BrowserOptions); | 22 cr.addSingletonGetter(BrowserOptions); |
| 21 | 23 |
| 22 /** | 24 /** |
| 23 * @param {HTMLElement} section The section to show or hide. | 25 * @param {HTMLElement} section The section to show or hide. |
| 24 * @return {boolean} Whether the section should be shown. | 26 * @return {boolean} Whether the section should be shown. |
| 25 * @private | 27 * @private |
| 26 */ | 28 */ |
| 27 BrowserOptions.shouldShowSection_ = function(section) { | 29 BrowserOptions.shouldShowSection_ = function(section) { |
| 28 // If the section is hidden or hiding, it should be shown. | 30 // If the section is hidden or hiding, it should be shown. |
| 29 return section.style.height == '' || section.style.height == '0px'; | 31 return section.style.height == '' || section.style.height == '0px'; |
| 30 }; | 32 }; |
| 31 | 33 |
| 32 BrowserOptions.prototype = { | 34 BrowserOptions.prototype = { |
| 33 __proto__: options.OptionsPage.prototype, | 35 __proto__: Page.prototype, |
| 34 | 36 |
| 35 /** | 37 /** |
| 36 * Keeps track of whether the user is signed in or not. | 38 * Keeps track of whether the user is signed in or not. |
| 37 * @type {boolean} | 39 * @type {boolean} |
| 38 * @private | 40 * @private |
| 39 */ | 41 */ |
| 40 signedIn_: false, | 42 signedIn_: false, |
| 41 | 43 |
| 42 /** | 44 /** |
| 43 * Indicates whether signing out is allowed or whether a complete profile | 45 * Indicates whether signing out is allowed or whether a complete profile |
| (...skipping 23 matching lines...) Expand all Loading... |
| 67 /** | 69 /** |
| 68 * When a section is waiting to change its height, this will be a number. | 70 * When a section is waiting to change its height, this will be a number. |
| 69 * Otherwise it'll be null. | 71 * Otherwise it'll be null. |
| 70 * @type {?number} | 72 * @type {?number} |
| 71 * @private | 73 * @private |
| 72 */ | 74 */ |
| 73 sectionHeightChangeTimeout_: null, | 75 sectionHeightChangeTimeout_: null, |
| 74 | 76 |
| 75 /** @override */ | 77 /** @override */ |
| 76 initializePage: function() { | 78 initializePage: function() { |
| 77 OptionsPage.prototype.initializePage.call(this); | 79 Page.prototype.initializePage.call(this); |
| 78 var self = this; | 80 var self = this; |
| 79 | 81 |
| 80 // Ensure that navigation events are unblocked on uber page. A reload of | 82 // Ensure that navigation events are unblocked on uber page. A reload of |
| 81 // the settings page while an overlay is open would otherwise leave uber | 83 // the settings page while an overlay is open would otherwise leave uber |
| 82 // page in a blocked state, where tab switching is not possible. | 84 // page in a blocked state, where tab switching is not possible. |
| 83 uber.invokeMethodOnParent('stopInterceptingEvents'); | 85 uber.invokeMethodOnParent('stopInterceptingEvents'); |
| 84 | 86 |
| 85 window.addEventListener('message', this.handleWindowMessage_.bind(this)); | 87 window.addEventListener('message', this.handleWindowMessage_.bind(this)); |
| 86 | 88 |
| 87 if (loadTimeData.getBoolean('allowAdvancedSettings')) { | 89 if (loadTimeData.getBoolean('allowAdvancedSettings')) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // On Startup section. | 161 // On Startup section. |
| 160 Preferences.getInstance().addEventListener('session.restore_on_startup', | 162 Preferences.getInstance().addEventListener('session.restore_on_startup', |
| 161 this.onRestoreOnStartupChanged_.bind(this)); | 163 this.onRestoreOnStartupChanged_.bind(this)); |
| 162 Preferences.getInstance().addEventListener( | 164 Preferences.getInstance().addEventListener( |
| 163 'session.startup_urls', | 165 'session.startup_urls', |
| 164 function(event) { | 166 function(event) { |
| 165 $('startup-set-pages').disabled = event.value.disabled; | 167 $('startup-set-pages').disabled = event.value.disabled; |
| 166 }); | 168 }); |
| 167 | 169 |
| 168 $('startup-set-pages').onclick = function() { | 170 $('startup-set-pages').onclick = function() { |
| 169 OptionsPage.navigateToPage('startup'); | 171 PageManager.navigateToPage('startup'); |
| 170 }; | 172 }; |
| 171 | 173 |
| 172 // Appearance section. | 174 // Appearance section. |
| 173 Preferences.getInstance().addEventListener('browser.show_home_button', | 175 Preferences.getInstance().addEventListener('browser.show_home_button', |
| 174 this.onShowHomeButtonChanged_.bind(this)); | 176 this.onShowHomeButtonChanged_.bind(this)); |
| 175 | 177 |
| 176 Preferences.getInstance().addEventListener('homepage', | 178 Preferences.getInstance().addEventListener('homepage', |
| 177 this.onHomePageChanged_.bind(this)); | 179 this.onHomePageChanged_.bind(this)); |
| 178 Preferences.getInstance().addEventListener('homepage_is_newtabpage', | 180 Preferences.getInstance().addEventListener('homepage_is_newtabpage', |
| 179 this.onHomePageIsNtpChanged_.bind(this)); | 181 this.onHomePageIsNtpChanged_.bind(this)); |
| 180 | 182 |
| 181 $('change-home-page').onclick = function(event) { | 183 $('change-home-page').onclick = function(event) { |
| 182 OptionsPage.navigateToPage('homePageOverlay'); | 184 PageManager.navigateToPage('homePageOverlay'); |
| 183 chrome.send('coreOptionsUserMetricsAction', | 185 chrome.send('coreOptionsUserMetricsAction', |
| 184 ['Options_Homepage_ShowSettings']); | 186 ['Options_Homepage_ShowSettings']); |
| 185 }; | 187 }; |
| 186 | 188 |
| 187 var hotwordIndicator = $('hotword-search-setting-indicator'); | 189 var hotwordIndicator = $('hotword-search-setting-indicator'); |
| 188 HotwordSearchSettingIndicator.decorate(hotwordIndicator); | 190 HotwordSearchSettingIndicator.decorate(hotwordIndicator); |
| 189 hotwordIndicator.disabledOnErrorSection = $('hotword-search-enable'); | 191 hotwordIndicator.disabledOnErrorSection = $('hotword-search-enable'); |
| 190 chrome.send('requestHotwordAvailable'); | 192 chrome.send('requestHotwordAvailable'); |
| 191 | 193 |
| 192 if ($('set-wallpaper')) { | 194 if ($('set-wallpaper')) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 212 $('themes-native-button').hidden = true; | 214 $('themes-native-button').hidden = true; |
| 213 } | 215 } |
| 214 // Supervised users have just one default theme, even on Linux. So use | 216 // Supervised users have just one default theme, even on Linux. So use |
| 215 // the same button for Linux as for the other platforms. | 217 // the same button for Linux as for the other platforms. |
| 216 $('themes-reset').textContent = loadTimeData.getString('themesReset'); | 218 $('themes-reset').textContent = loadTimeData.getString('themesReset'); |
| 217 } | 219 } |
| 218 | 220 |
| 219 // Device section (ChromeOS only). | 221 // Device section (ChromeOS only). |
| 220 if (cr.isChromeOS) { | 222 if (cr.isChromeOS) { |
| 221 $('keyboard-settings-button').onclick = function(evt) { | 223 $('keyboard-settings-button').onclick = function(evt) { |
| 222 OptionsPage.navigateToPage('keyboard-overlay'); | 224 PageManager.navigateToPage('keyboard-overlay'); |
| 223 chrome.send('coreOptionsUserMetricsAction', | 225 chrome.send('coreOptionsUserMetricsAction', |
| 224 ['Options_ShowKeyboardSettings']); | 226 ['Options_ShowKeyboardSettings']); |
| 225 }; | 227 }; |
| 226 $('pointer-settings-button').onclick = function(evt) { | 228 $('pointer-settings-button').onclick = function(evt) { |
| 227 OptionsPage.navigateToPage('pointer-overlay'); | 229 PageManager.navigateToPage('pointer-overlay'); |
| 228 chrome.send('coreOptionsUserMetricsAction', | 230 chrome.send('coreOptionsUserMetricsAction', |
| 229 ['Options_ShowTouchpadSettings']); | 231 ['Options_ShowTouchpadSettings']); |
| 230 }; | 232 }; |
| 231 } | 233 } |
| 232 | 234 |
| 233 // Search section. | 235 // Search section. |
| 234 $('manage-default-search-engines').onclick = function(event) { | 236 $('manage-default-search-engines').onclick = function(event) { |
| 235 OptionsPage.navigateToPage('searchEngines'); | 237 PageManager.navigateToPage('searchEngines'); |
| 236 chrome.send('coreOptionsUserMetricsAction', | 238 chrome.send('coreOptionsUserMetricsAction', |
| 237 ['Options_ManageSearchEngines']); | 239 ['Options_ManageSearchEngines']); |
| 238 }; | 240 }; |
| 239 $('default-search-engine').addEventListener('change', | 241 $('default-search-engine').addEventListener('change', |
| 240 this.setDefaultSearchEngine_); | 242 this.setDefaultSearchEngine_); |
| 241 | 243 |
| 242 // Users section. | 244 // Users section. |
| 243 if (loadTimeData.valueExists('profilesInfo')) { | 245 if (loadTimeData.valueExists('profilesInfo')) { |
| 244 $('profiles-section').hidden = false; | 246 $('profiles-section').hidden = false; |
| 245 this.maybeShowUserSection_(); | 247 this.maybeShowUserSection_(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 // Username (canonical email) of the currently logged in user or | 284 // Username (canonical email) of the currently logged in user or |
| 283 // |kGuestUser| if a guest session is active. | 285 // |kGuestUser| if a guest session is active. |
| 284 this.username_ = loadTimeData.getString('username'); | 286 this.username_ = loadTimeData.getString('username'); |
| 285 | 287 |
| 286 this.updateAccountPicture_(); | 288 this.updateAccountPicture_(); |
| 287 | 289 |
| 288 $('account-picture').onclick = this.showImagerPickerOverlay_; | 290 $('account-picture').onclick = this.showImagerPickerOverlay_; |
| 289 $('change-picture-caption').onclick = this.showImagerPickerOverlay_; | 291 $('change-picture-caption').onclick = this.showImagerPickerOverlay_; |
| 290 | 292 |
| 291 $('manage-accounts-button').onclick = function(event) { | 293 $('manage-accounts-button').onclick = function(event) { |
| 292 OptionsPage.navigateToPage('accounts'); | 294 PageManager.navigateToPage('accounts'); |
| 293 chrome.send('coreOptionsUserMetricsAction', | 295 chrome.send('coreOptionsUserMetricsAction', |
| 294 ['Options_ManageAccounts']); | 296 ['Options_ManageAccounts']); |
| 295 }; | 297 }; |
| 296 | 298 |
| 297 document.querySelector( | 299 document.querySelector( |
| 298 '#enable-screen-lock + span > .controlled-setting-indicator'). | 300 '#enable-screen-lock + span > .controlled-setting-indicator'). |
| 299 setAttribute('textshared', | 301 setAttribute('textshared', |
| 300 loadTimeData.getString('screenLockShared')); | 302 loadTimeData.getString('screenLockShared')); |
| 301 } else { | 303 } else { |
| 302 $('import-data').onclick = function(event) { | 304 $('import-data').onclick = function(event) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 322 } | 324 } |
| 323 $('set-as-default-browser').onclick = function(event) { | 325 $('set-as-default-browser').onclick = function(event) { |
| 324 chrome.send('becomeDefaultBrowser'); | 326 chrome.send('becomeDefaultBrowser'); |
| 325 }; | 327 }; |
| 326 | 328 |
| 327 $('auto-launch').onclick = this.handleAutoLaunchChanged_; | 329 $('auto-launch').onclick = this.handleAutoLaunchChanged_; |
| 328 } | 330 } |
| 329 | 331 |
| 330 // Privacy section. | 332 // Privacy section. |
| 331 $('privacyContentSettingsButton').onclick = function(event) { | 333 $('privacyContentSettingsButton').onclick = function(event) { |
| 332 OptionsPage.navigateToPage('content'); | 334 PageManager.navigateToPage('content'); |
| 333 OptionsPage.showTab($('cookies-nav-tab')); | 335 OptionsPage.showTab($('cookies-nav-tab')); |
| 334 chrome.send('coreOptionsUserMetricsAction', | 336 chrome.send('coreOptionsUserMetricsAction', |
| 335 ['Options_ContentSettings']); | 337 ['Options_ContentSettings']); |
| 336 }; | 338 }; |
| 337 $('privacyClearDataButton').onclick = function(event) { | 339 $('privacyClearDataButton').onclick = function(event) { |
| 338 OptionsPage.navigateToPage('clearBrowserData'); | 340 PageManager.navigateToPage('clearBrowserData'); |
| 339 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); | 341 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); |
| 340 }; | 342 }; |
| 341 $('privacyClearDataButton').hidden = OptionsPage.isSettingsApp(); | 343 $('privacyClearDataButton').hidden = OptionsPage.isSettingsApp(); |
| 342 // 'metricsReportingEnabled' element is only present on Chrome branded | 344 // 'metricsReportingEnabled' element is only present on Chrome branded |
| 343 // builds, and the 'metricsReportingCheckboxAction' message is only | 345 // builds, and the 'metricsReportingCheckboxAction' message is only |
| 344 // handled on ChromeOS. | 346 // handled on ChromeOS. |
| 345 if ($('metricsReportingEnabled') && cr.isChromeOS) { | 347 if ($('metricsReportingEnabled') && cr.isChromeOS) { |
| 346 $('metricsReportingEnabled').onclick = function(event) { | 348 $('metricsReportingEnabled').onclick = function(event) { |
| 347 chrome.send('metricsReportingCheckboxAction', | 349 chrome.send('metricsReportingCheckboxAction', |
| 348 [String(event.currentTarget.checked)]); | 350 [String(event.currentTarget.checked)]); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 359 | 361 |
| 360 $('enable-bluetooth').onchange = function(event) { | 362 $('enable-bluetooth').onchange = function(event) { |
| 361 var state = $('enable-bluetooth').checked; | 363 var state = $('enable-bluetooth').checked; |
| 362 chrome.send('bluetoothEnableChange', [Boolean(state)]); | 364 chrome.send('bluetoothEnableChange', [Boolean(state)]); |
| 363 }; | 365 }; |
| 364 | 366 |
| 365 $('bluetooth-reconnect-device').onclick = function(event) { | 367 $('bluetooth-reconnect-device').onclick = function(event) { |
| 366 var device = $('bluetooth-paired-devices-list').selectedItem; | 368 var device = $('bluetooth-paired-devices-list').selectedItem; |
| 367 var address = device.address; | 369 var address = device.address; |
| 368 chrome.send('updateBluetoothDevice', [address, 'connect']); | 370 chrome.send('updateBluetoothDevice', [address, 'connect']); |
| 369 OptionsPage.closeOverlay(); | 371 PageManager.closeOverlay(); |
| 370 }; | 372 }; |
| 371 | 373 |
| 372 $('bluetooth-paired-devices-list').addEventListener('change', | 374 $('bluetooth-paired-devices-list').addEventListener('change', |
| 373 function() { | 375 function() { |
| 374 var item = $('bluetooth-paired-devices-list').selectedItem; | 376 var item = $('bluetooth-paired-devices-list').selectedItem; |
| 375 var disabled = !item || item.connected || !item.connectable; | 377 var disabled = !item || item.connected || !item.connectable; |
| 376 $('bluetooth-reconnect-device').disabled = disabled; | 378 $('bluetooth-reconnect-device').disabled = disabled; |
| 377 }); | 379 }); |
| 378 } | 380 } |
| 379 | 381 |
| 380 // Passwords and Forms section. | 382 // Passwords and Forms section. |
| 381 $('autofill-settings').onclick = function(event) { | 383 $('autofill-settings').onclick = function(event) { |
| 382 OptionsPage.navigateToPage('autofill'); | 384 PageManager.navigateToPage('autofill'); |
| 383 chrome.send('coreOptionsUserMetricsAction', | 385 chrome.send('coreOptionsUserMetricsAction', |
| 384 ['Options_ShowAutofillSettings']); | 386 ['Options_ShowAutofillSettings']); |
| 385 }; | 387 }; |
| 386 $('manage-passwords').onclick = function(event) { | 388 $('manage-passwords').onclick = function(event) { |
| 387 OptionsPage.navigateToPage('passwords'); | 389 PageManager.navigateToPage('passwords'); |
| 388 OptionsPage.showTab($('passwords-nav-tab')); | 390 OptionsPage.showTab($('passwords-nav-tab')); |
| 389 chrome.send('coreOptionsUserMetricsAction', | 391 chrome.send('coreOptionsUserMetricsAction', |
| 390 ['Options_ShowPasswordManager']); | 392 ['Options_ShowPasswordManager']); |
| 391 }; | 393 }; |
| 392 if (cr.isChromeOS && UIAccountTweaks.loggedInAsGuest()) { | 394 if (cr.isChromeOS && UIAccountTweaks.loggedInAsGuest()) { |
| 393 // Disable and turn off Autofill in guest mode. | 395 // Disable and turn off Autofill in guest mode. |
| 394 var autofillEnabled = $('autofill-enabled'); | 396 var autofillEnabled = $('autofill-enabled'); |
| 395 autofillEnabled.disabled = true; | 397 autofillEnabled.disabled = true; |
| 396 autofillEnabled.checked = false; | 398 autofillEnabled.checked = false; |
| 397 cr.dispatchSimpleEvent(autofillEnabled, 'change'); | 399 cr.dispatchSimpleEvent(autofillEnabled, 'change'); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 423 loadTimeData.getBoolean('consumerManagementEnabled')) { | 425 loadTimeData.getBoolean('consumerManagementEnabled')) { |
| 424 $('device-control-section').hidden = false; | 426 $('device-control-section').hidden = false; |
| 425 | 427 |
| 426 var isEnrolled = loadTimeData.getBoolean('consumerManagementEnrolled'); | 428 var isEnrolled = loadTimeData.getBoolean('consumerManagementEnrolled'); |
| 427 $('consumer-management-enroll').hidden = isEnrolled; | 429 $('consumer-management-enroll').hidden = isEnrolled; |
| 428 $('consumer-management-unenroll').hidden = !isEnrolled; | 430 $('consumer-management-unenroll').hidden = !isEnrolled; |
| 429 | 431 |
| 430 $('consumer-management-section').onclick = function(event) { | 432 $('consumer-management-section').onclick = function(event) { |
| 431 // If either button is clicked. | 433 // If either button is clicked. |
| 432 if (event.target.tagName == 'BUTTON') | 434 if (event.target.tagName == 'BUTTON') |
| 433 OptionsPage.navigateToPage('consumer-management-overlay'); | 435 PageManager.navigateToPage('consumer-management-overlay'); |
| 434 }; | 436 }; |
| 435 } | 437 } |
| 436 | 438 |
| 437 // Easy Unlock section. | 439 // Easy Unlock section. |
| 438 if (loadTimeData.getBoolean('easyUnlockEnabled')) { | 440 if (loadTimeData.getBoolean('easyUnlockEnabled')) { |
| 439 $('easy-unlock-section').hidden = false; | 441 $('easy-unlock-section').hidden = false; |
| 440 $('easy-unlock-setup-button').onclick = function(event) { | 442 $('easy-unlock-setup-button').onclick = function(event) { |
| 441 chrome.send('launchEasyUnlockSetup'); | 443 chrome.send('launchEasyUnlockSetup'); |
| 442 }; | 444 }; |
| 443 } | 445 } |
| 444 | 446 |
| 445 // Website Settings section. | 447 // Website Settings section. |
| 446 if (loadTimeData.getBoolean('websiteSettingsManagerEnabled')) { | 448 if (loadTimeData.getBoolean('websiteSettingsManagerEnabled')) { |
| 447 $('website-settings-section').hidden = false; | 449 $('website-settings-section').hidden = false; |
| 448 $('website-management-button').onclick = function(event) { | 450 $('website-management-button').onclick = function(event) { |
| 449 OptionsPage.navigateToPage('websiteSettings'); | 451 PageManager.navigateToPage('websiteSettings'); |
| 450 }; | 452 }; |
| 451 } | 453 } |
| 452 | 454 |
| 453 // Web Content section. | 455 // Web Content section. |
| 454 $('fontSettingsCustomizeFontsButton').onclick = function(event) { | 456 $('fontSettingsCustomizeFontsButton').onclick = function(event) { |
| 455 OptionsPage.navigateToPage('fonts'); | 457 PageManager.navigateToPage('fonts'); |
| 456 chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); | 458 chrome.send('coreOptionsUserMetricsAction', ['Options_FontSettings']); |
| 457 }; | 459 }; |
| 458 $('defaultFontSize').onchange = function(event) { | 460 $('defaultFontSize').onchange = function(event) { |
| 459 var value = event.target.options[event.target.selectedIndex].value; | 461 var value = event.target.options[event.target.selectedIndex].value; |
| 460 Preferences.setIntegerPref( | 462 Preferences.setIntegerPref( |
| 461 'webkit.webprefs.default_fixed_font_size', | 463 'webkit.webprefs.default_fixed_font_size', |
| 462 value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, true); | 464 value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, true); |
| 463 chrome.send('defaultFontSizeAction', [String(value)]); | 465 chrome.send('defaultFontSizeAction', [String(value)]); |
| 464 }; | 466 }; |
| 465 $('defaultZoomFactor').onchange = function(event) { | 467 $('defaultZoomFactor').onchange = function(event) { |
| 466 chrome.send('defaultZoomFactorAction', | 468 chrome.send('defaultZoomFactorAction', |
| 467 [String(event.target.options[event.target.selectedIndex].value)]); | 469 [String(event.target.options[event.target.selectedIndex].value)]); |
| 468 }; | 470 }; |
| 469 | 471 |
| 470 // Languages section. | 472 // Languages section. |
| 471 var showLanguageOptions = function(event) { | 473 var showLanguageOptions = function(event) { |
| 472 OptionsPage.navigateToPage('languages'); | 474 PageManager.navigateToPage('languages'); |
| 473 chrome.send('coreOptionsUserMetricsAction', | 475 chrome.send('coreOptionsUserMetricsAction', |
| 474 ['Options_LanuageAndSpellCheckSettings']); | 476 ['Options_LanuageAndSpellCheckSettings']); |
| 475 }; | 477 }; |
| 476 $('language-button').onclick = showLanguageOptions; | 478 $('language-button').onclick = showLanguageOptions; |
| 477 $('manage-languages').onclick = showLanguageOptions; | 479 $('manage-languages').onclick = showLanguageOptions; |
| 478 | 480 |
| 479 // Downloads section. | 481 // Downloads section. |
| 480 Preferences.getInstance().addEventListener('download.default_directory', | 482 Preferences.getInstance().addEventListener('download.default_directory', |
| 481 this.onDefaultDownloadDirectoryChanged_.bind(this)); | 483 this.onDefaultDownloadDirectoryChanged_.bind(this)); |
| 482 $('downloadLocationChangeButton').onclick = function(event) { | 484 $('downloadLocationChangeButton').onclick = function(event) { |
| 483 chrome.send('selectDownloadLocation'); | 485 chrome.send('selectDownloadLocation'); |
| 484 }; | 486 }; |
| 485 if (cr.isChromeOS) { | 487 if (cr.isChromeOS) { |
| 486 $('disable-drive-row').hidden = | 488 $('disable-drive-row').hidden = |
| 487 UIAccountTweaks.loggedInAsLocallyManagedUser(); | 489 UIAccountTweaks.loggedInAsLocallyManagedUser(); |
| 488 } | 490 } |
| 489 $('autoOpenFileTypesResetToDefault').onclick = function(event) { | 491 $('autoOpenFileTypesResetToDefault').onclick = function(event) { |
| 490 chrome.send('autoOpenFileTypesAction'); | 492 chrome.send('autoOpenFileTypesAction'); |
| 491 }; | 493 }; |
| 492 | 494 |
| 493 // HTTPS/SSL section. | 495 // HTTPS/SSL section. |
| 494 if (cr.isWindows || cr.isMac) { | 496 if (cr.isWindows || cr.isMac) { |
| 495 $('certificatesManageButton').onclick = function(event) { | 497 $('certificatesManageButton').onclick = function(event) { |
| 496 chrome.send('showManageSSLCertificates'); | 498 chrome.send('showManageSSLCertificates'); |
| 497 }; | 499 }; |
| 498 } else { | 500 } else { |
| 499 $('certificatesManageButton').onclick = function(event) { | 501 $('certificatesManageButton').onclick = function(event) { |
| 500 OptionsPage.navigateToPage('certificates'); | 502 PageManager.navigateToPage('certificates'); |
| 501 chrome.send('coreOptionsUserMetricsAction', | 503 chrome.send('coreOptionsUserMetricsAction', |
| 502 ['Options_ManageSSLCertificates']); | 504 ['Options_ManageSSLCertificates']); |
| 503 }; | 505 }; |
| 504 } | 506 } |
| 505 | 507 |
| 506 if (loadTimeData.getBoolean('cloudPrintShowMDnsOptions')) { | 508 if (loadTimeData.getBoolean('cloudPrintShowMDnsOptions')) { |
| 507 $('cloudprint-options-mdns').hidden = false; | 509 $('cloudprint-options-mdns').hidden = false; |
| 508 $('cloudPrintDevicesPageButton').onclick = function() { | 510 $('cloudPrintDevicesPageButton').onclick = function() { |
| 509 chrome.send('showCloudPrintDevicesPage'); | 511 chrome.send('showCloudPrintDevicesPage'); |
| 510 }; | 512 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 !$('accessibility-autoclick-check').checked; | 548 !$('accessibility-autoclick-check').checked; |
| 547 }; | 549 }; |
| 548 Preferences.getInstance().addEventListener( | 550 Preferences.getInstance().addEventListener( |
| 549 $('accessibility-autoclick-check').getAttribute('pref'), | 551 $('accessibility-autoclick-check').getAttribute('pref'), |
| 550 updateDelayDropdown); | 552 updateDelayDropdown); |
| 551 } | 553 } |
| 552 | 554 |
| 553 // Display management section (CrOS only). | 555 // Display management section (CrOS only). |
| 554 if (cr.isChromeOS) { | 556 if (cr.isChromeOS) { |
| 555 $('display-options').onclick = function(event) { | 557 $('display-options').onclick = function(event) { |
| 556 OptionsPage.navigateToPage('display'); | 558 PageManager.navigateToPage('display'); |
| 557 chrome.send('coreOptionsUserMetricsAction', | 559 chrome.send('coreOptionsUserMetricsAction', |
| 558 ['Options_Display']); | 560 ['Options_Display']); |
| 559 }; | 561 }; |
| 560 } | 562 } |
| 561 | 563 |
| 562 // Factory reset section (CrOS only). | 564 // Factory reset section (CrOS only). |
| 563 if (cr.isChromeOS) { | 565 if (cr.isChromeOS) { |
| 564 $('factory-reset-restart').onclick = function(event) { | 566 $('factory-reset-restart').onclick = function(event) { |
| 565 OptionsPage.navigateToPage('factoryResetData'); | 567 PageManager.navigateToPage('factoryResetData'); |
| 566 chrome.send('onPowerwashDialogShow'); | 568 chrome.send('onPowerwashDialogShow'); |
| 567 }; | 569 }; |
| 568 } | 570 } |
| 569 | 571 |
| 570 // System section. | 572 // System section. |
| 571 if (!cr.isChromeOS) { | 573 if (!cr.isChromeOS) { |
| 572 var updateGpuRestartButton = function() { | 574 var updateGpuRestartButton = function() { |
| 573 $('gpu-mode-reset-restart').hidden = | 575 $('gpu-mode-reset-restart').hidden = |
| 574 loadTimeData.getBoolean('gpuEnabledAtStart') == | 576 loadTimeData.getBoolean('gpuEnabledAtStart') == |
| 575 $('gpu-mode-checkbox').checked; | 577 $('gpu-mode-checkbox').checked; |
| 576 }; | 578 }; |
| 577 Preferences.getInstance().addEventListener( | 579 Preferences.getInstance().addEventListener( |
| 578 $('gpu-mode-checkbox').getAttribute('pref'), | 580 $('gpu-mode-checkbox').getAttribute('pref'), |
| 579 updateGpuRestartButton); | 581 updateGpuRestartButton); |
| 580 $('gpu-mode-reset-restart-button').onclick = function(event) { | 582 $('gpu-mode-reset-restart-button').onclick = function(event) { |
| 581 chrome.send('restartBrowser'); | 583 chrome.send('restartBrowser'); |
| 582 }; | 584 }; |
| 583 updateGpuRestartButton(); | 585 updateGpuRestartButton(); |
| 584 } | 586 } |
| 585 | 587 |
| 586 // Reset profile settings section. | 588 // Reset profile settings section. |
| 587 $('reset-profile-settings').onclick = function(event) { | 589 $('reset-profile-settings').onclick = function(event) { |
| 588 OptionsPage.navigateToPage('resetProfileSettings'); | 590 PageManager.navigateToPage('resetProfileSettings'); |
| 589 }; | 591 }; |
| 590 $('reset-profile-settings-section').hidden = | 592 $('reset-profile-settings-section').hidden = |
| 591 !loadTimeData.getBoolean('enableResetProfileSettings'); | 593 !loadTimeData.getBoolean('enableResetProfileSettings'); |
| 592 | 594 |
| 593 // Extension controlled UI. | 595 // Extension controlled UI. |
| 594 this.addExtensionControlledBox_('search-section-content', | 596 this.addExtensionControlledBox_('search-section-content', |
| 595 'search-engine-controlled', | 597 'search-engine-controlled', |
| 596 true); | 598 true); |
| 597 this.addExtensionControlledBox_('extension-controlled-container', | 599 this.addExtensionControlledBox_('extension-controlled-container', |
| 598 'homepage-controlled', | 600 'homepage-controlled', |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 event.value = {}; | 1412 event.value = {}; |
| 1411 $('wallpaper-indicator').handlePrefChange(event); | 1413 $('wallpaper-indicator').handlePrefChange(event); |
| 1412 }, | 1414 }, |
| 1413 | 1415 |
| 1414 /** | 1416 /** |
| 1415 * Handle the 'add device' button click. | 1417 * Handle the 'add device' button click. |
| 1416 * @private | 1418 * @private |
| 1417 */ | 1419 */ |
| 1418 handleAddBluetoothDevice_: function() { | 1420 handleAddBluetoothDevice_: function() { |
| 1419 chrome.send('findBluetoothDevices'); | 1421 chrome.send('findBluetoothDevices'); |
| 1420 OptionsPage.showPageByName('bluetooth', false); | 1422 PageManager.showPageByName('bluetooth', false); |
| 1421 }, | 1423 }, |
| 1422 | 1424 |
| 1423 /** | 1425 /** |
| 1424 * Enables or disables the Manage SSL Certificates button. | 1426 * Enables or disables the Manage SSL Certificates button. |
| 1425 * @private | 1427 * @private |
| 1426 */ | 1428 */ |
| 1427 enableCertificateButton_: function(enabled) { | 1429 enableCertificateButton_: function(enabled) { |
| 1428 $('certificatesManageButton').disabled = !enabled; | 1430 $('certificatesManageButton').disabled = !enabled; |
| 1429 }, | 1431 }, |
| 1430 | 1432 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1777 if (index != undefined) | 1779 if (index != undefined) |
| 1778 $('bluetooth-paired-devices-list').deleteItemAtIndex(index); | 1780 $('bluetooth-paired-devices-list').deleteItemAtIndex(index); |
| 1779 } | 1781 } |
| 1780 }, | 1782 }, |
| 1781 | 1783 |
| 1782 /** | 1784 /** |
| 1783 * Shows the overlay dialog for changing the user avatar image. | 1785 * Shows the overlay dialog for changing the user avatar image. |
| 1784 * @private | 1786 * @private |
| 1785 */ | 1787 */ |
| 1786 showImagerPickerOverlay_: function() { | 1788 showImagerPickerOverlay_: function() { |
| 1787 OptionsPage.navigateToPage('changePicture'); | 1789 PageManager.navigateToPage('changePicture'); |
| 1788 }, | 1790 }, |
| 1789 | 1791 |
| 1790 /** | 1792 /** |
| 1791 * Shows (or not) the "User" section of the settings page based on whether | 1793 * Shows (or not) the "User" section of the settings page based on whether |
| 1792 * any of the sub-sections are present (or not). | 1794 * any of the sub-sections are present (or not). |
| 1793 * @private | 1795 * @private |
| 1794 */ | 1796 */ |
| 1795 maybeShowUserSection_: function() { | 1797 maybeShowUserSection_: function() { |
| 1796 $('sync-users-section').hidden = | 1798 $('sync-users-section').hidden = |
| 1797 $('profiles-section').hidden && | 1799 $('profiles-section').hidden && |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 BrowserOptions.getLoggedInUsername = function() { | 1883 BrowserOptions.getLoggedInUsername = function() { |
| 1882 return BrowserOptions.getInstance().username_; | 1884 return BrowserOptions.getInstance().username_; |
| 1883 }; | 1885 }; |
| 1884 } | 1886 } |
| 1885 | 1887 |
| 1886 // Export | 1888 // Export |
| 1887 return { | 1889 return { |
| 1888 BrowserOptions: BrowserOptions | 1890 BrowserOptions: BrowserOptions |
| 1889 }; | 1891 }; |
| 1890 }); | 1892 }); |
| OLD | NEW |