| 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.exportPath('options'); | 5 cr.exportPath('options'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{actionLinkText: (string|undefined), | 8 * @typedef {{actionLinkText: (string|undefined), |
| 9 * accountInfo: (string|undefined), | 9 * accountInfo: (string|undefined), |
| 10 * childUser: (boolean|undefined), | 10 * childUser: (boolean|undefined), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 SEND_ALL_LOCATION_INFO: 4, | 53 SEND_ALL_LOCATION_INFO: 4, |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 cr.define('options', function() { | 56 cr.define('options', function() { |
| 57 var OptionsPage = options.OptionsPage; | 57 var OptionsPage = options.OptionsPage; |
| 58 var Page = cr.ui.pageManager.Page; | 58 var Page = cr.ui.pageManager.Page; |
| 59 var PageManager = cr.ui.pageManager.PageManager; | 59 var PageManager = cr.ui.pageManager.PageManager; |
| 60 var ArrayDataModel = cr.ui.ArrayDataModel; | 60 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 61 var RepeatingButton = cr.ui.RepeatingButton; | 61 var RepeatingButton = cr.ui.RepeatingButton; |
| 62 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; | 62 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; |
| 63 var NetworkPredictionOptions = { | 63 var NetworkPredictionOptions = |
| 64 ALWAYS: 0, | 64 {ALWAYS: 0, WIFI_ONLY: 1, NEVER: 2, DEFAULT: 1}; |
| 65 WIFI_ONLY: 1, | |
| 66 NEVER: 2, | |
| 67 DEFAULT: 1 | |
| 68 }; | |
| 69 | 65 |
| 70 /** | 66 /** |
| 71 * Encapsulated handling of browser options page. | 67 * Encapsulated handling of browser options page. |
| 72 * @constructor | 68 * @constructor |
| 73 * @extends {cr.ui.pageManager.Page} | 69 * @extends {cr.ui.pageManager.Page} |
| 74 */ | 70 */ |
| 75 function BrowserOptions() { | 71 function BrowserOptions() { |
| 76 Page.call(this, 'settings', loadTimeData.getString('settingsTitle'), | 72 Page.call( |
| 77 'settings'); | 73 this, 'settings', loadTimeData.getString('settingsTitle'), 'settings'); |
| 78 } | 74 } |
| 79 | 75 |
| 80 cr.addSingletonGetter(BrowserOptions); | 76 cr.addSingletonGetter(BrowserOptions); |
| 81 | 77 |
| 82 /** | 78 /** |
| 83 * @param {HTMLElement} section The section to show or hide. | 79 * @param {HTMLElement} section The section to show or hide. |
| 84 * @return {boolean} Whether the section should be shown. | 80 * @return {boolean} Whether the section should be shown. |
| 85 * @private | 81 * @private |
| 86 */ | 82 */ |
| 87 BrowserOptions.shouldShowSection_ = function(section) { | 83 BrowserOptions.shouldShowSection_ = function(section) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // page in a blocked state, where tab switching is not possible. | 162 // page in a blocked state, where tab switching is not possible. |
| 167 uber.invokeMethodOnParent('stopInterceptingEvents'); | 163 uber.invokeMethodOnParent('stopInterceptingEvents'); |
| 168 | 164 |
| 169 window.addEventListener('message', this.handleWindowMessage_.bind(this)); | 165 window.addEventListener('message', this.handleWindowMessage_.bind(this)); |
| 170 | 166 |
| 171 if (loadTimeData.getBoolean('allowAdvancedSettings')) { | 167 if (loadTimeData.getBoolean('allowAdvancedSettings')) { |
| 172 $('advanced-settings-expander').onclick = function(e) { | 168 $('advanced-settings-expander').onclick = function(e) { |
| 173 var showAdvanced = | 169 var showAdvanced = |
| 174 BrowserOptions.shouldShowSection_($('advanced-settings')); | 170 BrowserOptions.shouldShowSection_($('advanced-settings')); |
| 175 if (showAdvanced) { | 171 if (showAdvanced) { |
| 176 chrome.send('coreOptionsUserMetricsAction', | 172 chrome.send( |
| 177 ['Options_ShowAdvancedSettings']); | 173 'coreOptionsUserMetricsAction', |
| 174 ['Options_ShowAdvancedSettings']); |
| 178 } | 175 } |
| 179 self.toggleSectionWithAnimation_( | 176 self.toggleSectionWithAnimation_( |
| 180 $('advanced-settings'), | 177 $('advanced-settings'), $('advanced-settings-container')); |
| 181 $('advanced-settings-container')); | |
| 182 | 178 |
| 183 // If the click was triggered using the keyboard and it showed the | 179 // If the click was triggered using the keyboard and it showed the |
| 184 // section (rather than hiding it), focus the first element in the | 180 // section (rather than hiding it), focus the first element in the |
| 185 // container. | 181 // container. |
| 186 if (e.detail == 0 && showAdvanced) { | 182 if (e.detail == 0 && showAdvanced) { |
| 187 var focusElement = $('advanced-settings-container').querySelector( | 183 var focusElement = |
| 188 'button, input, list, select, a[href]'); | 184 $('advanced-settings-container') |
| 185 .querySelector('button, input, list, select, a[href]'); |
| 189 if (focusElement) | 186 if (focusElement) |
| 190 focusElement.focus(); | 187 focusElement.focus(); |
| 191 } | 188 } |
| 192 }; | 189 }; |
| 193 } else { | 190 } else { |
| 194 $('advanced-settings-footer').hidden = true; | 191 $('advanced-settings-footer').hidden = true; |
| 195 $('advanced-settings').hidden = true; | 192 $('advanced-settings').hidden = true; |
| 196 } | 193 } |
| 197 | 194 |
| 198 $('advanced-settings').addEventListener('transitionend', | 195 $('advanced-settings') |
| 199 this.updateAdvancedSettingsExpander_.bind(this)); | 196 .addEventListener( |
| 197 'transitionend', this.updateAdvancedSettingsExpander_.bind(this)); |
| 200 | 198 |
| 201 if (loadTimeData.valueExists('aboutOverlayTabTitle')) { | 199 if (loadTimeData.valueExists('aboutOverlayTabTitle')) { |
| 202 $('about-button').hidden = false; | 200 $('about-button').hidden = false; |
| 203 $('about-button').addEventListener('click', function() { | 201 $('about-button').addEventListener('click', function() { |
| 204 PageManager.showPageByName('help'); | 202 PageManager.showPageByName('help'); |
| 205 chrome.send('coreOptionsUserMetricsAction', | 203 chrome.send('coreOptionsUserMetricsAction', ['Options_About']); |
| 206 ['Options_About']); | |
| 207 }); | 204 }); |
| 208 } | 205 } |
| 209 | 206 |
| 210 if (cr.isChromeOS) { | 207 if (cr.isChromeOS) { |
| 211 UIAccountTweaks.applyGuestSessionVisibility(document); | 208 UIAccountTweaks.applyGuestSessionVisibility(document); |
| 212 UIAccountTweaks.applyPublicSessionVisibility(document); | 209 UIAccountTweaks.applyPublicSessionVisibility(document); |
| 213 if (loadTimeData.getBoolean('secondaryUser')) | 210 if (loadTimeData.getBoolean('secondaryUser')) |
| 214 $('secondary-user-banner').hidden = false; | 211 $('secondary-user-banner').hidden = false; |
| 215 } | 212 } |
| 216 | 213 |
| 217 // Sync (Sign in) section. | 214 // Sync (Sign in) section. |
| 218 this.updateSyncState_(/** @type {options.SyncStatus} */( | 215 this.updateSyncState_(/** @type {options.SyncStatus} */ ( |
| 219 loadTimeData.getValue('syncData'))); | 216 loadTimeData.getValue('syncData'))); |
| 220 if (!$('sync-overview').hidden) { | 217 if (!$('sync-overview').hidden) { |
| 221 chrome.send('metricsHandler:recordAction', | 218 chrome.send( |
| 222 ['Signin_Impression_FromSettings']); | 219 'metricsHandler:recordAction', ['Signin_Impression_FromSettings']); |
| 223 } | 220 } |
| 224 | 221 |
| 225 $('start-stop-sync').onclick = function(event) { | 222 $('start-stop-sync').onclick = function(event) { |
| 226 if (self.signedIn_) { | 223 if (self.signedIn_) { |
| 227 if (self.signoutAllowed_) | 224 if (self.signoutAllowed_) |
| 228 SyncSetupOverlay.showStopSyncingUI(); | 225 SyncSetupOverlay.showStopSyncingUI(); |
| 229 else | 226 else |
| 230 chrome.send('showDisconnectManagedProfileDialog'); | 227 chrome.send('showDisconnectManagedProfileDialog'); |
| 231 } else if (cr.isChromeOS) { | 228 } else if (cr.isChromeOS) { |
| 232 SyncSetupOverlay.showSetupUI(); | 229 SyncSetupOverlay.showSetupUI(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 245 // in a multi-profile session. | 242 // in a multi-profile session. |
| 246 if (loadTimeData.getBoolean('secondaryUser')) { | 243 if (loadTimeData.getBoolean('secondaryUser')) { |
| 247 var networkIndicator = document.querySelector( | 244 var networkIndicator = document.querySelector( |
| 248 '#network-section-header > .controlled-setting-indicator'); | 245 '#network-section-header > .controlled-setting-indicator'); |
| 249 networkIndicator.setAttribute('controlled-by', 'shared'); | 246 networkIndicator.setAttribute('controlled-by', 'shared'); |
| 250 networkIndicator.location = cr.ui.ArrowLocation.TOP_START; | 247 networkIndicator.location = cr.ui.ArrowLocation.TOP_START; |
| 251 } | 248 } |
| 252 } | 249 } |
| 253 | 250 |
| 254 // On Startup section. | 251 // On Startup section. |
| 255 Preferences.getInstance().addEventListener('session.restore_on_startup', | 252 Preferences.getInstance().addEventListener( |
| 253 'session.restore_on_startup', |
| 256 this.onRestoreOnStartupChanged_.bind(this)); | 254 this.onRestoreOnStartupChanged_.bind(this)); |
| 257 Preferences.getInstance().addEventListener( | 255 Preferences.getInstance().addEventListener( |
| 258 'session.startup_urls', | 256 'session.startup_urls', function(event) { |
| 259 function(event) { | |
| 260 $('startup-set-pages').disabled = event.value.disabled; | 257 $('startup-set-pages').disabled = event.value.disabled; |
| 261 }); | 258 }); |
| 262 | 259 |
| 263 $('startup-set-pages').onclick = function() { | 260 $('startup-set-pages').onclick = function() { |
| 264 PageManager.showPageByName('startup'); | 261 PageManager.showPageByName('startup'); |
| 265 }; | 262 }; |
| 266 | 263 |
| 267 // Appearance section. | 264 // Appearance section. |
| 268 Preferences.getInstance().addEventListener('browser.show_home_button', | 265 Preferences.getInstance().addEventListener( |
| 269 this.onShowHomeButtonChanged_.bind(this)); | 266 'browser.show_home_button', this.onShowHomeButtonChanged_.bind(this)); |
| 270 | 267 |
| 271 Preferences.getInstance().addEventListener('homepage', | 268 Preferences.getInstance().addEventListener( |
| 272 this.onHomePageChanged_.bind(this)); | 269 'homepage', this.onHomePageChanged_.bind(this)); |
| 273 Preferences.getInstance().addEventListener('homepage_is_newtabpage', | 270 Preferences.getInstance().addEventListener( |
| 274 this.onHomePageIsNtpChanged_.bind(this)); | 271 'homepage_is_newtabpage', this.onHomePageIsNtpChanged_.bind(this)); |
| 275 | 272 |
| 276 $('change-home-page').onclick = function(event) { | 273 $('change-home-page').onclick = function(event) { |
| 277 PageManager.showPageByName('homePageOverlay'); | 274 PageManager.showPageByName('homePageOverlay'); |
| 278 chrome.send('coreOptionsUserMetricsAction', | 275 chrome.send( |
| 279 ['Options_Homepage_ShowSettings']); | 276 'coreOptionsUserMetricsAction', ['Options_Homepage_ShowSettings']); |
| 280 }; | 277 }; |
| 281 | 278 |
| 282 HotwordSearchSettingIndicator.decorate( | 279 HotwordSearchSettingIndicator.decorate( |
| 283 $('hotword-search-setting-indicator')); | 280 $('hotword-search-setting-indicator')); |
| 284 HotwordSearchSettingIndicator.decorate( | 281 HotwordSearchSettingIndicator.decorate( |
| 285 $('hotword-no-dsp-search-setting-indicator')); | 282 $('hotword-no-dsp-search-setting-indicator')); |
| 286 var hotwordIndicator = $('hotword-always-on-search-setting-indicator'); | 283 var hotwordIndicator = $('hotword-always-on-search-setting-indicator'); |
| 287 HotwordSearchSettingIndicator.decorate(hotwordIndicator); | 284 HotwordSearchSettingIndicator.decorate(hotwordIndicator); |
| 288 hotwordIndicator.disabledOnErrorSection = | 285 hotwordIndicator.disabledOnErrorSection = |
| 289 $('hotword-always-on-search-checkbox'); | 286 $('hotword-always-on-search-checkbox'); |
| 290 chrome.send('requestHotwordAvailable'); | 287 chrome.send('requestHotwordAvailable'); |
| 291 | 288 |
| 292 chrome.send('requestGoogleNowAvailable'); | 289 chrome.send('requestGoogleNowAvailable'); |
| 293 | 290 |
| 294 if ($('set-wallpaper')) { | 291 if ($('set-wallpaper')) { |
| 295 $('set-wallpaper').onclick = function(event) { | 292 $('set-wallpaper').onclick = function(event) { |
| 296 chrome.send('openWallpaperManager'); | 293 chrome.send('openWallpaperManager'); |
| 297 chrome.send('coreOptionsUserMetricsAction', | 294 chrome.send( |
| 298 ['Options_OpenWallpaperManager']); | 295 'coreOptionsUserMetricsAction', ['Options_OpenWallpaperManager']); |
| 299 }; | 296 }; |
| 300 } | 297 } |
| 301 | 298 |
| 302 // Control the hotword-always-on pref with the Hotword Audio | 299 // Control the hotword-always-on pref with the Hotword Audio |
| 303 // Verification app. | 300 // Verification app. |
| 304 $('hotword-always-on-search-checkbox').customChangeHandler = | 301 $('hotword-always-on-search-checkbox').customChangeHandler = function( |
| 305 function(event) { | 302 event) { |
| 306 if (!$('hotword-always-on-search-checkbox').checked) | 303 if (!$('hotword-always-on-search-checkbox').checked) |
| 307 return false; | 304 return false; |
| 308 | 305 |
| 309 $('hotword-always-on-search-checkbox').checked = false; | 306 $('hotword-always-on-search-checkbox').checked = false; |
| 310 chrome.send('launchHotwordAudioVerificationApp', [false]); | 307 chrome.send('launchHotwordAudioVerificationApp', [false]); |
| 311 return true; | 308 return true; |
| 312 }; | 309 }; |
| 313 | 310 |
| 314 // Open the Hotword Audio Verification app to retrain a voice model. | 311 // Open the Hotword Audio Verification app to retrain a voice model. |
| 315 $('hotword-retrain-link').onclick = function(event) { | 312 $('hotword-retrain-link').onclick = function(event) { |
| 316 chrome.send('launchHotwordAudioVerificationApp', [true]); | 313 chrome.send('launchHotwordAudioVerificationApp', [true]); |
| 317 }; | 314 }; |
| 318 Preferences.getInstance().addEventListener( | 315 Preferences.getInstance().addEventListener( |
| 319 'hotword.always_on_search_enabled', | 316 'hotword.always_on_search_enabled', |
| 320 this.onHotwordAlwaysOnChanged_.bind(this)); | 317 this.onHotwordAlwaysOnChanged_.bind(this)); |
| 321 | 318 |
| 322 $('themes-gallery').onclick = function(event) { | 319 $('themes-gallery').onclick = function(event) { |
| 323 window.open(loadTimeData.getString('themesGalleryURL')); | 320 window.open(loadTimeData.getString('themesGalleryURL')); |
| 324 chrome.send('coreOptionsUserMetricsAction', | 321 chrome.send('coreOptionsUserMetricsAction', ['Options_ThemesGallery']); |
| 325 ['Options_ThemesGallery']); | |
| 326 }; | 322 }; |
| 327 $('themes-reset').onclick = function(event) { | 323 $('themes-reset').onclick = function(event) { |
| 328 chrome.send('themesReset'); | 324 chrome.send('themesReset'); |
| 329 }; | 325 }; |
| 330 | 326 |
| 331 if (loadTimeData.getBoolean('profileIsSupervised')) { | 327 if (loadTimeData.getBoolean('profileIsSupervised')) { |
| 332 if ($('themes-native-button')) { | 328 if ($('themes-native-button')) { |
| 333 $('themes-native-button').disabled = true; | 329 $('themes-native-button').disabled = true; |
| 334 $('themes-native-button').hidden = true; | 330 $('themes-native-button').hidden = true; |
| 335 } | 331 } |
| 336 // Supervised users have just one default theme, even on Linux. So use | 332 // Supervised users have just one default theme, even on Linux. So use |
| 337 // the same button for Linux as for the other platforms. | 333 // the same button for Linux as for the other platforms. |
| 338 $('themes-reset').textContent = loadTimeData.getString('themesReset'); | 334 $('themes-reset').textContent = loadTimeData.getString('themesReset'); |
| 339 } | 335 } |
| 340 | 336 |
| 341 // Device section (ChromeOS only). | 337 // Device section (ChromeOS only). |
| 342 if (cr.isChromeOS) { | 338 if (cr.isChromeOS) { |
| 343 // Probe for stylus hardware state. C++ will invoke | 339 // Probe for stylus hardware state. C++ will invoke |
| 344 // BrowserOptions.setStylusInputStatus_ when the data is available. | 340 // BrowserOptions.setStylusInputStatus_ when the data is available. |
| 345 chrome.send('requestStylusHardwareState'); | 341 chrome.send('requestStylusHardwareState'); |
| 346 | 342 |
| 347 if (loadTimeData.getBoolean('showPowerStatus')) { | 343 if (loadTimeData.getBoolean('showPowerStatus')) { |
| 348 $('power-settings-link').onclick = function(evt) { | 344 $('power-settings-link').onclick = function(evt) { |
| 349 PageManager.showPageByName('power-overlay'); | 345 PageManager.showPageByName('power-overlay'); |
| 350 chrome.send('coreOptionsUserMetricsAction', | 346 chrome.send( |
| 351 ['Options_ShowPowerSettings']); | 347 'coreOptionsUserMetricsAction', ['Options_ShowPowerSettings']); |
| 352 }; | 348 }; |
| 353 $('power-row').hidden = false; | 349 $('power-row').hidden = false; |
| 354 } | 350 } |
| 355 $('keyboard-settings-button').onclick = function(evt) { | 351 $('keyboard-settings-button').onclick = function(evt) { |
| 356 PageManager.showPageByName('keyboard-overlay'); | 352 PageManager.showPageByName('keyboard-overlay'); |
| 357 chrome.send('coreOptionsUserMetricsAction', | 353 chrome.send( |
| 358 ['Options_ShowKeyboardSettings']); | 354 'coreOptionsUserMetricsAction', ['Options_ShowKeyboardSettings']); |
| 359 }; | 355 }; |
| 360 $('pointer-settings-button').onclick = function(evt) { | 356 $('pointer-settings-button').onclick = function(evt) { |
| 361 PageManager.showPageByName('pointer-overlay'); | 357 PageManager.showPageByName('pointer-overlay'); |
| 362 chrome.send('coreOptionsUserMetricsAction', | 358 chrome.send( |
| 363 ['Options_ShowTouchpadSettings']); | 359 'coreOptionsUserMetricsAction', ['Options_ShowTouchpadSettings']); |
| 364 }; | 360 }; |
| 365 $('storage-manager-button').onclick = function(evt) { | 361 $('storage-manager-button').onclick = function(evt) { |
| 366 PageManager.showPageByName('storage'); | 362 PageManager.showPageByName('storage'); |
| 367 chrome.send('coreOptionsUserMetricsAction', | 363 chrome.send( |
| 368 ['Options_ShowStorageManager']); | 364 'coreOptionsUserMetricsAction', ['Options_ShowStorageManager']); |
| 369 }; | 365 }; |
| 370 } | 366 } |
| 371 | 367 |
| 372 // Search section. | 368 // Search section. |
| 373 $('manage-default-search-engines').onclick = function(event) { | 369 $('manage-default-search-engines').onclick = function(event) { |
| 374 PageManager.showPageByName('searchEngines'); | 370 PageManager.showPageByName('searchEngines'); |
| 375 chrome.send('coreOptionsUserMetricsAction', | 371 chrome.send( |
| 376 ['Options_ManageSearchEngines']); | 372 'coreOptionsUserMetricsAction', ['Options_ManageSearchEngines']); |
| 377 }; | 373 }; |
| 378 $('default-search-engine').addEventListener('change', | 374 $('default-search-engine') |
| 379 this.setDefaultSearchEngine_); | 375 .addEventListener('change', this.setDefaultSearchEngine_); |
| 380 | 376 |
| 381 // Users section. | 377 // Users section. |
| 382 if (loadTimeData.valueExists('profilesInfo')) { | 378 if (loadTimeData.valueExists('profilesInfo')) { |
| 383 $('profiles-section').hidden = false; | 379 $('profiles-section').hidden = false; |
| 384 this.maybeShowUserSection_(); | 380 this.maybeShowUserSection_(); |
| 385 | 381 |
| 386 var profilesList = $('profiles-list'); | 382 var profilesList = $('profiles-list'); |
| 387 options.browser_options.ProfileList.decorate(profilesList); | 383 options.browser_options.ProfileList.decorate(profilesList); |
| 388 profilesList.autoExpands = true; | 384 profilesList.autoExpands = true; |
| 389 | 385 |
| 390 // The profiles info data in |loadTimeData| might be stale. | 386 // The profiles info data in |loadTimeData| might be stale. |
| 391 this.setProfilesInfo_(/** @type {!Array<!options.Profile>} */( | 387 this.setProfilesInfo_(/** @type {!Array<!options.Profile>} */ ( |
| 392 loadTimeData.getValue('profilesInfo'))); | 388 loadTimeData.getValue('profilesInfo'))); |
| 393 chrome.send('requestProfilesInfo'); | 389 chrome.send('requestProfilesInfo'); |
| 394 | 390 |
| 395 profilesList.addEventListener('change', | 391 profilesList.addEventListener( |
| 396 this.setProfileViewButtonsStatus_); | 392 'change', this.setProfileViewButtonsStatus_); |
| 397 $('profiles-create').onclick = function(event) { | 393 $('profiles-create').onclick = function(event) { |
| 398 chrome.send('metricsHandler:recordAction', | 394 chrome.send( |
| 399 ['Options_ShowCreateProfileDlg']); | 395 'metricsHandler:recordAction', ['Options_ShowCreateProfileDlg']); |
| 400 ManageProfileOverlay.showCreateDialog(); | 396 ManageProfileOverlay.showCreateDialog(); |
| 401 }; | 397 }; |
| 402 $('profiles-manage').onclick = function(event) { | 398 $('profiles-manage').onclick = function(event) { |
| 403 chrome.send('metricsHandler:recordAction', | 399 chrome.send( |
| 404 ['Options_ShowEditProfileDlg']); | 400 'metricsHandler:recordAction', ['Options_ShowEditProfileDlg']); |
| 405 ManageProfileOverlay.showManageDialog(); | 401 ManageProfileOverlay.showManageDialog(); |
| 406 }; | 402 }; |
| 407 $('profiles-delete').onclick = function(event) { | 403 $('profiles-delete').onclick = function(event) { |
| 408 var selectedProfile = self.getSelectedProfileItem_(); | 404 var selectedProfile = self.getSelectedProfileItem_(); |
| 409 if (selectedProfile) { | 405 if (selectedProfile) { |
| 410 chrome.send('metricsHandler:recordAction', | 406 chrome.send( |
| 411 ['Options_ShowDeleteProfileDlg']); | 407 'metricsHandler:recordAction', |
| 408 ['Options_ShowDeleteProfileDlg']); |
| 412 ManageProfileOverlay.showDeleteDialog(selectedProfile); | 409 ManageProfileOverlay.showDeleteDialog(selectedProfile); |
| 413 } | 410 } |
| 414 }; | 411 }; |
| 415 if (loadTimeData.getBoolean('profileIsSupervised')) { | 412 if (loadTimeData.getBoolean('profileIsSupervised')) { |
| 416 $('profiles-create').disabled = true; | 413 $('profiles-create').disabled = true; |
| 417 } | 414 } |
| 418 if (!loadTimeData.getBoolean('allowProfileDeletion')) { | 415 if (!loadTimeData.getBoolean('allowProfileDeletion')) { |
| 419 $('profiles-delete').disabled = true; | 416 $('profiles-delete').disabled = true; |
| 420 $('profiles-list').canDeleteItems = false; | 417 $('profiles-list').canDeleteItems = false; |
| 421 } | 418 } |
| 422 } | 419 } |
| 423 | 420 |
| 424 if (cr.isChromeOS) { | 421 if (cr.isChromeOS) { |
| 425 // Username (canonical email) of the currently logged in user or | 422 // Username (canonical email) of the currently logged in user or |
| 426 // |kGuestUser| if a guest session is active. | 423 // |kGuestUser| if a guest session is active. |
| 427 this.username_ = loadTimeData.getString('username'); | 424 this.username_ = loadTimeData.getString('username'); |
| 428 | 425 |
| 429 this.updateAccountPicture_(); | 426 this.updateAccountPicture_(); |
| 430 | 427 |
| 431 $('account-picture').onclick = this.showImagerPickerOverlay_; | 428 $('account-picture').onclick = this.showImagerPickerOverlay_; |
| 432 $('change-picture-caption').onclick = this.showImagerPickerOverlay_; | 429 $('change-picture-caption').onclick = this.showImagerPickerOverlay_; |
| 433 | 430 |
| 434 $('manage-accounts-button').onclick = function(event) { | 431 $('manage-accounts-button').onclick = function(event) { |
| 435 PageManager.showPageByName('accounts'); | 432 PageManager.showPageByName('accounts'); |
| 436 chrome.send('coreOptionsUserMetricsAction', | 433 chrome.send( |
| 437 ['Options_ManageAccounts']); | 434 'coreOptionsUserMetricsAction', ['Options_ManageAccounts']); |
| 438 }; | 435 }; |
| 439 | 436 |
| 440 if (loadTimeData.getBoolean('showQuickUnlockSettings')) { | 437 if (loadTimeData.getBoolean('showQuickUnlockSettings')) { |
| 441 $('manage-screenlock').onclick = function(event) { | 438 $('manage-screenlock').onclick = function(event) { |
| 442 PageManager.showPageByName('quickUnlockConfigureOverlay'); | 439 PageManager.showPageByName('quickUnlockConfigureOverlay'); |
| 443 settings.recordLockScreenProgress( | 440 settings.recordLockScreenProgress( |
| 444 LockScreenProgress.START_SCREEN_LOCK); | 441 LockScreenProgress.START_SCREEN_LOCK); |
| 445 }; | 442 }; |
| 446 $('manage-screenlock').hidden = false; | 443 $('manage-screenlock').hidden = false; |
| 447 } | 444 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 } | 479 } |
| 483 $('set-as-default-browser').onclick = function(event) { | 480 $('set-as-default-browser').onclick = function(event) { |
| 484 chrome.send('becomeDefaultBrowser'); | 481 chrome.send('becomeDefaultBrowser'); |
| 485 }; | 482 }; |
| 486 } | 483 } |
| 487 | 484 |
| 488 // Privacy section. | 485 // Privacy section. |
| 489 $('privacyContentSettingsButton').onclick = function(event) { | 486 $('privacyContentSettingsButton').onclick = function(event) { |
| 490 PageManager.showPageByName('content'); | 487 PageManager.showPageByName('content'); |
| 491 OptionsPage.showTab($('cookies-nav-tab')); | 488 OptionsPage.showTab($('cookies-nav-tab')); |
| 492 chrome.send('coreOptionsUserMetricsAction', | 489 chrome.send( |
| 493 ['Options_ContentSettings']); | 490 'coreOptionsUserMetricsAction', ['Options_ContentSettings']); |
| 494 }; | 491 }; |
| 495 $('privacyClearDataButton').onclick = function(event) { | 492 $('privacyClearDataButton').onclick = function(event) { |
| 496 PageManager.showPageByName('clearBrowserData'); | 493 PageManager.showPageByName('clearBrowserData'); |
| 497 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); | 494 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); |
| 498 }; | 495 }; |
| 499 | 496 |
| 500 if ($('metrics-reporting-enabled')) { | 497 if ($('metrics-reporting-enabled')) { |
| 501 $('metrics-reporting-enabled').checked = | 498 $('metrics-reporting-enabled').checked = |
| 502 loadTimeData.getBoolean('metricsReportingEnabledAtStart'); | 499 loadTimeData.getBoolean('metricsReportingEnabledAtStart'); |
| 503 | 500 |
| 504 // A browser restart is never needed to toggle metrics reporting, | 501 // A browser restart is never needed to toggle metrics reporting, |
| 505 // and is only needed to toggle crash reporting when using Breakpad. | 502 // and is only needed to toggle crash reporting when using Breakpad. |
| 506 // Crashpad, used on Mac, does not require a browser restart. | 503 // Crashpad, used on Mac, does not require a browser restart. |
| 507 var togglingMetricsRequiresRestart = !cr.isMac && !cr.isChromeOS; | 504 var togglingMetricsRequiresRestart = !cr.isMac && !cr.isChromeOS; |
| 508 $('metrics-reporting-enabled').onclick = function(event) { | 505 $('metrics-reporting-enabled').onclick = function(event) { |
| 509 chrome.send('metricsReportingCheckboxChanged', | 506 chrome.send( |
| 507 'metricsReportingCheckboxChanged', |
| 510 [Boolean(event.currentTarget.checked)]); | 508 [Boolean(event.currentTarget.checked)]); |
| 511 if (cr.isChromeOS) { | 509 if (cr.isChromeOS) { |
| 512 // 'metricsReportingEnabled' element is only present on Chrome | 510 // 'metricsReportingEnabled' element is only present on Chrome |
| 513 // branded builds, and the 'metricsReportingCheckboxAction' message | 511 // branded builds, and the 'metricsReportingCheckboxAction' message |
| 514 // is only handled on ChromeOS. | 512 // is only handled on ChromeOS. |
| 515 chrome.send('metricsReportingCheckboxAction', | 513 chrome.send( |
| 514 'metricsReportingCheckboxAction', |
| 516 [String(event.currentTarget.checked)]); | 515 [String(event.currentTarget.checked)]); |
| 517 } | 516 } |
| 518 | 517 |
| 519 if (togglingMetricsRequiresRestart) { | 518 if (togglingMetricsRequiresRestart) { |
| 520 $('metrics-reporting-reset-restart').hidden = | 519 $('metrics-reporting-reset-restart').hidden = |
| 521 loadTimeData.getBoolean('metricsReportingEnabledAtStart') == | 520 loadTimeData.getBoolean('metricsReportingEnabledAtStart') == |
| 522 $('metrics-reporting-enabled').checked; | 521 $('metrics-reporting-enabled').checked; |
| 523 } | 522 } |
| 524 | 523 |
| 525 }; | 524 }; |
| 526 | 525 |
| 527 // Initialize restart button if needed. | 526 // Initialize restart button if needed. |
| 528 if (togglingMetricsRequiresRestart) { | 527 if (togglingMetricsRequiresRestart) { |
| 529 // The localized string has the | symbol on each side of the text that | 528 // The localized string has the | symbol on each side of the text that |
| 530 // needs to be made into a button to restart Chrome. We parse the text | 529 // needs to be made into a button to restart Chrome. We parse the text |
| 531 // and build the button from that. | 530 // and build the button from that. |
| 532 var restartTextFragments = | 531 var restartTextFragments = |
| 533 loadTimeData.getString('metricsReportingResetRestart').split('|'); | 532 loadTimeData.getString('metricsReportingResetRestart').split('|'); |
| 534 // Assume structure is something like "starting text |link text| | 533 // Assume structure is something like "starting text |link text| |
| 535 // ending text" where both starting text and ending text may or may | 534 // ending text" where both starting text and ending text may or may |
| 536 // not be present, but the split should always be in three pieces. | 535 // not be present, but the split should always be in three pieces. |
| 537 var restartElements = | 536 var restartElements = |
| 538 $('metrics-reporting-reset-restart').querySelectorAll('*'); | 537 $('metrics-reporting-reset-restart').querySelectorAll('*'); |
| 539 for (var i = 0; i < restartTextFragments.length; i++) { | 538 for (var i = 0; i < restartTextFragments.length; i++) { |
| 540 restartElements[i].textContent = restartTextFragments[i]; | 539 restartElements[i].textContent = restartTextFragments[i]; |
| 541 } | 540 } |
| 542 restartElements[1].onclick = function(event) { | 541 restartElements[1].onclick = function(event) { |
| 543 chrome.send('restartBrowser'); | 542 chrome.send('restartBrowser'); |
| 544 }; | 543 }; |
| 545 } | 544 } |
| 546 } | 545 } |
| 547 $('networkPredictionOptions').onchange = function(event) { | 546 $('networkPredictionOptions').onchange = function(event) { |
| 548 var value = (event.target.checked ? | 547 var value = |
| 549 NetworkPredictionOptions.WIFI_ONLY : | 548 (event.target.checked ? NetworkPredictionOptions.WIFI_ONLY : |
| 550 NetworkPredictionOptions.NEVER); | 549 NetworkPredictionOptions.NEVER); |
| 551 var metric = event.target.metric; | 550 var metric = event.target.metric; |
| 552 Preferences.setIntegerPref( | 551 Preferences.setIntegerPref( |
| 553 'net.network_prediction_options', | 552 'net.network_prediction_options', value, true, metric); |
| 554 value, | |
| 555 true, | |
| 556 metric); | |
| 557 }; | 553 }; |
| 558 if (loadTimeData.valueExists('showWakeOnWifi') && | 554 if (loadTimeData.valueExists('showWakeOnWifi') && |
| 559 loadTimeData.getBoolean('showWakeOnWifi')) { | 555 loadTimeData.getBoolean('showWakeOnWifi')) { |
| 560 $('wake-on-wifi').hidden = false; | 556 $('wake-on-wifi').hidden = false; |
| 561 } | 557 } |
| 562 | 558 |
| 563 // Bluetooth (CrOS only). | 559 // Bluetooth (CrOS only). |
| 564 if (cr.isChromeOS) { | 560 if (cr.isChromeOS) { |
| 565 // Request the intial bluetooth adapter state. | 561 // Request the intial bluetooth adapter state. |
| 566 var adapterStateChanged = | 562 var adapterStateChanged = |
| (...skipping 16 matching lines...) Expand all Loading... |
| 583 options.system.bluetooth.BluetoothDeviceList.decorate( | 579 options.system.bluetooth.BluetoothDeviceList.decorate( |
| 584 $('bluetooth-paired-devices-list')); | 580 $('bluetooth-paired-devices-list')); |
| 585 | 581 |
| 586 $('bluetooth-add-device').onclick = | 582 $('bluetooth-add-device').onclick = |
| 587 this.handleAddBluetoothDevice_.bind(this); | 583 this.handleAddBluetoothDevice_.bind(this); |
| 588 | 584 |
| 589 $('enable-bluetooth').onchange = function(event) { | 585 $('enable-bluetooth').onchange = function(event) { |
| 590 var state = $('enable-bluetooth').checked; | 586 var state = $('enable-bluetooth').checked; |
| 591 chrome.bluetoothPrivate.setAdapterState({powered: state}, function() { | 587 chrome.bluetoothPrivate.setAdapterState({powered: state}, function() { |
| 592 if (chrome.runtime.lastError) { | 588 if (chrome.runtime.lastError) { |
| 593 console.error('Error enabling bluetooth:', | 589 console.error( |
| 594 chrome.runtime.lastError.message); | 590 'Error enabling bluetooth:', |
| 591 chrome.runtime.lastError.message); |
| 595 } | 592 } |
| 596 }); | 593 }); |
| 597 }; | 594 }; |
| 598 | 595 |
| 599 $('bluetooth-reconnect-device').onclick = function(event) { | 596 $('bluetooth-reconnect-device').onclick = function(event) { |
| 600 chrome.send('coreOptionsUserMetricsAction', | 597 chrome.send( |
| 601 ['Options_BluetoothConnectPairedDevice']); | 598 'coreOptionsUserMetricsAction', |
| 599 ['Options_BluetoothConnectPairedDevice']); |
| 602 var device = $('bluetooth-paired-devices-list').selectedItem; | 600 var device = $('bluetooth-paired-devices-list').selectedItem; |
| 603 BluetoothPairing.connect(device); | 601 BluetoothPairing.connect(device); |
| 604 }; | 602 }; |
| 605 | 603 |
| 606 $('bluetooth-paired-devices-list').addEventListener('change', | 604 $('bluetooth-paired-devices-list') |
| 607 function() { | 605 .addEventListener('change', function() { |
| 608 var item = $('bluetooth-paired-devices-list').selectedItem; | 606 var item = $('bluetooth-paired-devices-list').selectedItem; |
| 609 var disabled = !item || item.connected || !item.connectable; | 607 var disabled = !item || item.connected || !item.connectable; |
| 610 $('bluetooth-reconnect-device').disabled = disabled; | 608 $('bluetooth-reconnect-device').disabled = disabled; |
| 611 }); | 609 }); |
| 612 } | 610 } |
| 613 | 611 |
| 614 // Passwords and Forms section. | 612 // Passwords and Forms section. |
| 615 $('autofill-settings').onclick = function(event) { | 613 $('autofill-settings').onclick = function(event) { |
| 616 PageManager.showPageByName('autofill'); | 614 PageManager.showPageByName('autofill'); |
| 617 chrome.send('coreOptionsUserMetricsAction', | 615 chrome.send( |
| 618 ['Options_ShowAutofillSettings']); | 616 'coreOptionsUserMetricsAction', ['Options_ShowAutofillSettings']); |
| 619 }; | 617 }; |
| 620 $('manage-passwords').onclick = function(event) { | 618 $('manage-passwords').onclick = function(event) { |
| 621 PageManager.showPageByName('passwords'); | 619 PageManager.showPageByName('passwords'); |
| 622 OptionsPage.showTab($('passwords-nav-tab')); | 620 OptionsPage.showTab($('passwords-nav-tab')); |
| 623 chrome.send('coreOptionsUserMetricsAction', | 621 chrome.send( |
| 624 ['Options_ShowPasswordManager']); | 622 'coreOptionsUserMetricsAction', ['Options_ShowPasswordManager']); |
| 625 }; | 623 }; |
| 626 if (cr.isChromeOS && UIAccountTweaks.loggedInAsGuest()) { | 624 if (cr.isChromeOS && UIAccountTweaks.loggedInAsGuest()) { |
| 627 // Disable and turn off Autofill in guest mode. | 625 // Disable and turn off Autofill in guest mode. |
| 628 var autofillEnabled = $('autofill-enabled'); | 626 var autofillEnabled = $('autofill-enabled'); |
| 629 autofillEnabled.disabled = true; | 627 autofillEnabled.disabled = true; |
| 630 autofillEnabled.checked = false; | 628 autofillEnabled.checked = false; |
| 631 cr.dispatchSimpleEvent(autofillEnabled, 'change'); | 629 cr.dispatchSimpleEvent(autofillEnabled, 'change'); |
| 632 $('autofill-settings').disabled = true; | 630 $('autofill-settings').disabled = true; |
| 633 | 631 |
| 634 // Disable and turn off Password Manager in guest mode. | 632 // Disable and turn off Password Manager in guest mode. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 660 $('easy-unlock-turn-off-button').onclick = function(event) { | 658 $('easy-unlock-turn-off-button').onclick = function(event) { |
| 661 PageManager.showPageByName('easyUnlockTurnOffOverlay'); | 659 PageManager.showPageByName('easyUnlockTurnOffOverlay'); |
| 662 }; | 660 }; |
| 663 } | 661 } |
| 664 $('easy-unlock-enable-proximity-detection').hidden = | 662 $('easy-unlock-enable-proximity-detection').hidden = |
| 665 !loadTimeData.getBoolean('easyUnlockProximityDetectionAllowed'); | 663 !loadTimeData.getBoolean('easyUnlockProximityDetectionAllowed'); |
| 666 | 664 |
| 667 // Web Content section. | 665 // Web Content section. |
| 668 $('fontSettingsCustomizeFontsButton').onclick = function(event) { | 666 $('fontSettingsCustomizeFontsButton').onclick = function(event) { |
| 669 PageManager.showPageByName('fonts'); | 667 PageManager.showPageByName('fonts'); |
| 670 chrome.send('coreOptionsUserMetricsAction', | 668 chrome.send( |
| 671 ['Options_ShowFontSettings']); | 669 'coreOptionsUserMetricsAction', ['Options_ShowFontSettings']); |
| 672 }; | 670 }; |
| 673 $('defaultFontSize').onchange = function(event) { | 671 $('defaultFontSize').onchange = function(event) { |
| 674 var value = event.target.options[event.target.selectedIndex].value; | 672 var value = event.target.options[event.target.selectedIndex].value; |
| 675 Preferences.setIntegerPref( | 673 Preferences.setIntegerPref( |
| 676 'webkit.webprefs.default_fixed_font_size', | 674 'webkit.webprefs.default_fixed_font_size', |
| 677 value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, true); | 675 value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, true); |
| 678 chrome.send('defaultFontSizeAction', [String(value)]); | 676 chrome.send('defaultFontSizeAction', [String(value)]); |
| 679 }; | 677 }; |
| 680 $('defaultZoomFactor').onchange = function(event) { | 678 $('defaultZoomFactor').onchange = function(event) { |
| 681 chrome.send('defaultZoomFactorAction', | 679 chrome.send( |
| 680 'defaultZoomFactorAction', |
| 682 [String(event.target.options[event.target.selectedIndex].value)]); | 681 [String(event.target.options[event.target.selectedIndex].value)]); |
| 683 }; | 682 }; |
| 684 $('safeBrowsingExtendedReportingCheckbox').onchange = function(event) { | 683 $('safeBrowsingExtendedReportingCheckbox').onchange = function(event) { |
| 685 chrome.send('safeBrowsingExtendedReportingAction', | 684 chrome.send( |
| 686 [event.target.checked]); | 685 'safeBrowsingExtendedReportingAction', [event.target.checked]); |
| 687 }; | 686 }; |
| 688 | 687 |
| 689 // Languages section. | 688 // Languages section. |
| 690 var showLanguageOptions = function(event) { | 689 var showLanguageOptions = function(event) { |
| 691 PageManager.showPageByName('languages'); | 690 PageManager.showPageByName('languages'); |
| 692 chrome.send('coreOptionsUserMetricsAction', | 691 chrome.send( |
| 692 'coreOptionsUserMetricsAction', |
| 693 ['Options_LanuageAndSpellCheckSettings']); | 693 ['Options_LanuageAndSpellCheckSettings']); |
| 694 }; | 694 }; |
| 695 $('language-button').onclick = showLanguageOptions; | 695 $('language-button').onclick = showLanguageOptions; |
| 696 $('manage-languages').onclick = showLanguageOptions; | 696 $('manage-languages').onclick = showLanguageOptions; |
| 697 | 697 |
| 698 // Downloads section. | 698 // Downloads section. |
| 699 Preferences.getInstance().addEventListener('download.default_directory', | 699 Preferences.getInstance().addEventListener( |
| 700 'download.default_directory', |
| 700 this.onDefaultDownloadDirectoryChanged_.bind(this)); | 701 this.onDefaultDownloadDirectoryChanged_.bind(this)); |
| 701 $('downloadLocationChangeButton').onclick = function(event) { | 702 $('downloadLocationChangeButton').onclick = function(event) { |
| 702 chrome.send('selectDownloadLocation'); | 703 chrome.send('selectDownloadLocation'); |
| 703 }; | 704 }; |
| 704 if (cr.isChromeOS) { | 705 if (cr.isChromeOS) { |
| 705 $('disable-drive-row').hidden = | 706 $('disable-drive-row').hidden = |
| 706 UIAccountTweaks.loggedInAsSupervisedUser(); | 707 UIAccountTweaks.loggedInAsSupervisedUser(); |
| 707 } | 708 } |
| 708 $('autoOpenFileTypesResetToDefault').onclick = function(event) { | 709 $('autoOpenFileTypesResetToDefault').onclick = function(event) { |
| 709 chrome.send('autoOpenFileTypesAction'); | 710 chrome.send('autoOpenFileTypesAction'); |
| 710 }; | 711 }; |
| 711 | 712 |
| 712 // HTTPS/SSL section. | 713 // HTTPS/SSL section. |
| 713 if (cr.isWindows || cr.isMac) { | 714 if (cr.isWindows || cr.isMac) { |
| 714 $('certificatesManageButton').onclick = function(event) { | 715 $('certificatesManageButton').onclick = function(event) { |
| 715 chrome.send('showManageSSLCertificates'); | 716 chrome.send('showManageSSLCertificates'); |
| 716 }; | 717 }; |
| 717 } else { | 718 } else { |
| 718 $('certificatesManageButton').onclick = function(event) { | 719 $('certificatesManageButton').onclick = function(event) { |
| 719 PageManager.showPageByName('certificates'); | 720 PageManager.showPageByName('certificates'); |
| 720 chrome.send('coreOptionsUserMetricsAction', | 721 chrome.send( |
| 721 ['Options_ManageSSLCertificates']); | 722 'coreOptionsUserMetricsAction', |
| 723 ['Options_ManageSSLCertificates']); |
| 722 }; | 724 }; |
| 723 } | 725 } |
| 724 | 726 |
| 725 // CUPS Print section (CrOS only). | 727 // CUPS Print section (CrOS only). |
| 726 if (cr.isChromeOS) { | 728 if (cr.isChromeOS) { |
| 727 if (!loadTimeData.getBoolean('cupsPrintDisabled')) { | 729 if (!loadTimeData.getBoolean('cupsPrintDisabled')) { |
| 728 $('cups-printers-section').hidden = false; | 730 $('cups-printers-section').hidden = false; |
| 729 $('cupsPrintersManageButton').onclick = function() { | 731 $('cupsPrintersManageButton').onclick = function() { |
| 730 chrome.send('showCupsPrintDevicesPage'); | 732 chrome.send('showCupsPrintDevicesPage'); |
| 731 }; | 733 }; |
| 732 } | 734 } |
| 733 } | 735 } |
| 734 | 736 |
| 735 if (loadTimeData.getBoolean('cloudPrintShowMDnsOptions')) { | 737 if (loadTimeData.getBoolean('cloudPrintShowMDnsOptions')) { |
| 736 $('cloudprint-options-mdns').hidden = false; | 738 $('cloudprint-options-mdns').hidden = false; |
| 737 $('cloudPrintDevicesPageButton').onclick = function() { | 739 $('cloudPrintDevicesPageButton').onclick = function() { |
| 738 chrome.send('showCloudPrintDevicesPage'); | 740 chrome.send('showCloudPrintDevicesPage'); |
| 739 }; | 741 }; |
| 740 } | 742 } |
| 741 | 743 |
| 742 // Accessibility section (CrOS only). | 744 // Accessibility section (CrOS only). |
| 743 if (cr.isChromeOS) { | 745 if (cr.isChromeOS) { |
| 744 var updateAccessibilitySettingsSection = function() { | 746 var updateAccessibilitySettingsSection = function() { |
| 745 $('accessibility-settings').hidden = | 747 $('accessibility-settings').hidden = |
| 746 !($('accessibility-spoken-feedback-check').checked); | 748 !($('accessibility-spoken-feedback-check').checked); |
| 747 }; | 749 }; |
| 748 Preferences.getInstance().addEventListener( | 750 Preferences.getInstance().addEventListener( |
| 749 'settings.accessibility', | 751 'settings.accessibility', updateAccessibilitySettingsSection); |
| 750 updateAccessibilitySettingsSection); | |
| 751 $('accessibility-learn-more').onclick = function(unused_event) { | 752 $('accessibility-learn-more').onclick = function(unused_event) { |
| 752 chrome.send('coreOptionsUserMetricsAction', | 753 chrome.send( |
| 753 ['Options_AccessibilityLearnMore']); | 754 'coreOptionsUserMetricsAction', |
| 755 ['Options_AccessibilityLearnMore']); |
| 754 }; | 756 }; |
| 755 $('accessibility-settings-button').onclick = function(unused_event) { | 757 $('accessibility-settings-button').onclick = function(unused_event) { |
| 756 window.open(loadTimeData.getString('accessibilitySettingsURL')); | 758 window.open(loadTimeData.getString('accessibilitySettingsURL')); |
| 757 }; | 759 }; |
| 758 $('talkback-settings-button').onclick = function(unused_event) { | 760 $('talkback-settings-button').onclick = function(unused_event) { |
| 759 chrome.send('showAccessibilityTalkBackSettings'); | 761 chrome.send('showAccessibilityTalkBackSettings'); |
| 760 }; | 762 }; |
| 761 $('accessibility-spoken-feedback-check').onchange = | 763 $('accessibility-spoken-feedback-check').onchange = |
| 762 updateAccessibilitySettingsSection; | 764 updateAccessibilitySettingsSection; |
| 763 updateAccessibilitySettingsSection(); | 765 updateAccessibilitySettingsSection(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 778 $('accessibility-autoclick-check').getAttribute('pref'), | 780 $('accessibility-autoclick-check').getAttribute('pref'), |
| 779 updateDelayDropdown); | 781 updateDelayDropdown); |
| 780 $('experimental-accessibility-features').hidden = | 782 $('experimental-accessibility-features').hidden = |
| 781 !loadTimeData.getBoolean('enableExperimentalAccessibilityFeatures'); | 783 !loadTimeData.getBoolean('enableExperimentalAccessibilityFeatures'); |
| 782 } | 784 } |
| 783 | 785 |
| 784 // Display management section (CrOS only). | 786 // Display management section (CrOS only). |
| 785 if (cr.isChromeOS) { | 787 if (cr.isChromeOS) { |
| 786 $('display-options').onclick = function(event) { | 788 $('display-options').onclick = function(event) { |
| 787 PageManager.showPageByName('display'); | 789 PageManager.showPageByName('display'); |
| 788 chrome.send('coreOptionsUserMetricsAction', | 790 chrome.send('coreOptionsUserMetricsAction', ['Options_Display']); |
| 789 ['Options_Display']); | |
| 790 }; | 791 }; |
| 791 } | 792 } |
| 792 | 793 |
| 793 // Factory reset section (CrOS only). | 794 // Factory reset section (CrOS only). |
| 794 if (cr.isChromeOS) { | 795 if (cr.isChromeOS) { |
| 795 $('factory-reset-restart').onclick = function(event) { | 796 $('factory-reset-restart').onclick = function(event) { |
| 796 PageManager.showPageByName('factoryResetData'); | 797 PageManager.showPageByName('factoryResetData'); |
| 797 chrome.send('onPowerwashDialogShow'); | 798 chrome.send('onPowerwashDialogShow'); |
| 798 }; | 799 }; |
| 799 } | 800 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 812 chrome.send('restartBrowser'); | 813 chrome.send('restartBrowser'); |
| 813 }; | 814 }; |
| 814 updateGpuRestartButton(); | 815 updateGpuRestartButton(); |
| 815 } | 816 } |
| 816 | 817 |
| 817 // Reset profile settings section. | 818 // Reset profile settings section. |
| 818 $('reset-profile-settings').onclick = function(event) { | 819 $('reset-profile-settings').onclick = function(event) { |
| 819 // We use the hash to indicate the source of the reset request. The hash | 820 // We use the hash to indicate the source of the reset request. The hash |
| 820 // is removed by the reset profile settings overlay once it has been | 821 // is removed by the reset profile settings overlay once it has been |
| 821 // consumed. | 822 // consumed. |
| 822 PageManager.showPageByName('resetProfileSettings', true, | 823 PageManager.showPageByName( |
| 823 {hash: '#userclick'}); | 824 'resetProfileSettings', true, {hash: '#userclick'}); |
| 824 }; | 825 }; |
| 825 | 826 |
| 826 // Extension controlled UI. | 827 // Extension controlled UI. |
| 827 this.addExtensionControlledBox_('search-section-content', | 828 this.addExtensionControlledBox_( |
| 828 'search-engine-controlled', | 829 'search-section-content', 'search-engine-controlled', true); |
| 829 true); | 830 this.addExtensionControlledBox_( |
| 830 this.addExtensionControlledBox_('extension-controlled-container', | 831 'extension-controlled-container', 'homepage-controlled', true); |
| 831 'homepage-controlled', | 832 this.addExtensionControlledBox_( |
| 832 true); | 833 'startup-section-content', 'startpage-controlled', false); |
| 833 this.addExtensionControlledBox_('startup-section-content', | 834 this.addExtensionControlledBox_( |
| 834 'startpage-controlled', | 835 'newtab-section-content', 'newtab-controlled', false); |
| 835 false); | 836 this.addExtensionControlledBox_( |
| 836 this.addExtensionControlledBox_('newtab-section-content', | 837 'proxy-section-content', 'proxy-controlled', true); |
| 837 'newtab-controlled', | |
| 838 false); | |
| 839 this.addExtensionControlledBox_('proxy-section-content', | |
| 840 'proxy-controlled', | |
| 841 true); | |
| 842 | 838 |
| 843 document.body.addEventListener('click', function(e) { | 839 document.body.addEventListener('click', function(e) { |
| 844 var target = assertInstanceof(e.target, Node); | 840 var target = assertInstanceof(e.target, Node); |
| 845 var button = findAncestor(target, function(el) { | 841 var button = findAncestor(target, function(el) { |
| 846 return el.tagName == 'BUTTON' && | 842 return el.tagName == 'BUTTON' && |
| 847 el.dataset.extensionId !== undefined && | 843 el.dataset.extensionId !== undefined && |
| 848 el.dataset.extensionId.length; | 844 el.dataset.extensionId.length; |
| 849 }); | 845 }); |
| 850 if (button) | 846 if (button) |
| 851 chrome.send('disableExtension', [button.dataset.extensionId]); | 847 chrome.send('disableExtension', [button.dataset.extensionId]); |
| 852 }); | 848 }); |
| 853 | 849 |
| 854 // Setup ARC section. | 850 // Setup ARC section. |
| 855 if (cr.isChromeOS) { | 851 if (cr.isChromeOS) { |
| 856 $('android-apps-settings-label').innerHTML = | 852 $('android-apps-settings-label').innerHTML = |
| 857 loadTimeData.getString('androidAppsSettingsLabel'); | 853 loadTimeData.getString('androidAppsSettingsLabel'); |
| 858 Preferences.getInstance().addEventListener('arc.enabled', function(e) { | 854 Preferences.getInstance().addEventListener('arc.enabled', function(e) { |
| 859 // Only change settings visibility on committed settings changes. | 855 // Only change settings visibility on committed settings changes. |
| 860 if (e.value.uncommitted) | 856 if (e.value.uncommitted) |
| 861 return; | 857 return; |
| 862 | 858 |
| 863 var isArcEnabled = !e.value.value; | 859 var isArcEnabled = !e.value.value; |
| 864 $('android-apps-settings').hidden = isArcEnabled; | 860 $('android-apps-settings').hidden = isArcEnabled; |
| 865 $('talkback-settings-button').hidden = isArcEnabled; | 861 $('talkback-settings-button').hidden = isArcEnabled; |
| 866 $('stylus-find-more-link').hidden = isArcEnabled; | 862 $('stylus-find-more-link').hidden = isArcEnabled; |
| 867 }); | 863 }); |
| 868 | 864 |
| 869 $('android-apps-settings-link').addEventListener('click', function(e) { | 865 $('android-apps-settings-link').addEventListener('click', function(e) { |
| 870 // MouseEvent.detail indicates the current click count (or tap | 866 // MouseEvent.detail indicates the current click count (or tap |
| 871 // count, in the case of touch events) in the 'click' event. | 867 // count, in the case of touch events) in the 'click' event. |
| 872 var activatedFromKeyboard = e.detail == 0; | 868 var activatedFromKeyboard = e.detail == 0; |
| 873 chrome.send('showAndroidAppsSettings', [activatedFromKeyboard]); | 869 chrome.send('showAndroidAppsSettings', [activatedFromKeyboard]); |
| 874 }); | 870 }); |
| 875 } | 871 } |
| 876 }, | 872 }, |
| 877 | 873 |
| 878 /** @override */ | 874 /** @override */ |
| 879 didShowPage: function() { | 875 didShowPage: function() { |
| 880 $('search-field').focus(); | 876 $('search-field').focus(); |
| 881 }, | 877 }, |
| 882 | 878 |
| 883 /** | 879 /** |
| 884 * Called after all C++ UI handlers have called InitializePage to notify | 880 * Called after all C++ UI handlers have called InitializePage to notify |
| 885 * that initialization is complete. | 881 * that initialization is complete. |
| 886 * @private | 882 * @private |
| 887 */ | 883 */ |
| 888 notifyInitializationComplete_: function() { | 884 notifyInitializationComplete_: function() { |
| 889 this.initializationComplete_ = true; | 885 this.initializationComplete_ = true; |
| 890 cr.dispatchSimpleEvent(document, 'initializationComplete'); | 886 cr.dispatchSimpleEvent(document, 'initializationComplete'); |
| 891 }, | 887 }, |
| 892 | 888 |
| 893 /** | 889 /** |
| 894 * Event listener for the 'session.restore_on_startup' pref. | 890 * Event listener for the 'session.restore_on_startup' pref. |
| 895 * @param {Event} event The preference change event. | 891 * @param {Event} event The preference change event. |
| 896 * @private | 892 * @private |
| 897 */ | 893 */ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 914 StartupOverlay.getInstance().updateControlStates(); | 910 StartupOverlay.getInstance().updateControlStates(); |
| 915 } | 911 } |
| 916 }, | 912 }, |
| 917 | 913 |
| 918 /** | 914 /** |
| 919 * Handler for messages sent from the main uber page. | 915 * Handler for messages sent from the main uber page. |
| 920 * @param {Event} e The 'message' event from the uber page. | 916 * @param {Event} e The 'message' event from the uber page. |
| 921 * @private | 917 * @private |
| 922 */ | 918 */ |
| 923 handleWindowMessage_: function(e) { | 919 handleWindowMessage_: function(e) { |
| 924 if ((/** @type {{method: string}} */(e.data)).method == 'frameSelected') | 920 if ((/** @type {{method: string}} */ (e.data)).method == 'frameSelected') |
| 925 $('search-field').focus(); | 921 $('search-field').focus(); |
| 926 }, | 922 }, |
| 927 | 923 |
| 928 /** | 924 /** |
| 929 * Animatedly changes height |from| a px number |to| a px number. | 925 * Animatedly changes height |from| a px number |to| a px number. |
| 930 * @param {HTMLElement} section The section to animate. | 926 * @param {HTMLElement} section The section to animate. |
| 931 * @param {HTMLElement} container The container of |section|. | 927 * @param {HTMLElement} container The container of |section|. |
| 932 * @param {boolean} showing Whether to go from 0 -> container height or | 928 * @param {boolean} showing Whether to go from 0 -> container height or |
| 933 * container height -> 0. | 929 * container height -> 0. |
| 934 * @private | 930 * @private |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 * advanced settings if required. The transition is not animated. This | 1012 * advanced settings if required. The transition is not animated. This |
| 1017 * method is used to ensure that a section associated with an overlay | 1013 * method is used to ensure that a section associated with an overlay |
| 1018 * is visible when the overlay is closed. | 1014 * is visible when the overlay is closed. |
| 1019 * @param {!Element} section The section to make visible. | 1015 * @param {!Element} section The section to make visible. |
| 1020 * @private | 1016 * @private |
| 1021 */ | 1017 */ |
| 1022 scrollToSection_: function(section) { | 1018 scrollToSection_: function(section) { |
| 1023 var advancedSettings = $('advanced-settings'); | 1019 var advancedSettings = $('advanced-settings'); |
| 1024 var container = $('advanced-settings-container'); | 1020 var container = $('advanced-settings-container'); |
| 1025 var expander = $('advanced-settings-expander'); | 1021 var expander = $('advanced-settings-expander'); |
| 1026 if (!expander.hidden && | 1022 if (!expander.hidden && advancedSettings.hidden && |
| 1027 advancedSettings.hidden && | |
| 1028 section.parentNode == container) { | 1023 section.parentNode == container) { |
| 1029 this.showSection_($('advanced-settings'), | 1024 this.showSection_( |
| 1030 $('advanced-settings-container'), | 1025 $('advanced-settings'), $('advanced-settings-container'), |
| 1031 /* animate */ false); | 1026 /* animate */ false); |
| 1032 this.updateAdvancedSettingsExpander_(); | 1027 this.updateAdvancedSettingsExpander_(); |
| 1033 } | 1028 } |
| 1034 | 1029 |
| 1035 if (!this.initializationComplete_) { | 1030 if (!this.initializationComplete_) { |
| 1036 var self = this; | 1031 var self = this; |
| 1037 var callback = function() { | 1032 var callback = function() { |
| 1038 document.removeEventListener('initializationComplete', callback); | 1033 document.removeEventListener('initializationComplete', callback); |
| 1039 self.scrollToSection_(section); | 1034 self.scrollToSection_(section); |
| 1040 }; | 1035 }; |
| 1041 document.addEventListener('initializationComplete', callback); | 1036 document.addEventListener('initializationComplete', callback); |
| 1042 return; | 1037 return; |
| 1043 } | 1038 } |
| 1044 | 1039 |
| 1045 var pageContainer = $('page-container'); | 1040 var pageContainer = $('page-container'); |
| 1046 // pageContainer.offsetTop is relative to the screen. | 1041 // pageContainer.offsetTop is relative to the screen. |
| 1047 var pageTop = pageContainer.offsetTop; | 1042 var pageTop = pageContainer.offsetTop; |
| 1048 var sectionBottom = section.offsetTop + section.offsetHeight; | 1043 var sectionBottom = section.offsetTop + section.offsetHeight; |
| 1049 // section.offsetTop is relative to the 'page-container'. | 1044 // section.offsetTop is relative to the 'page-container'. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1064 * Adds a |transitionend| listener to the given section so that | 1059 * Adds a |transitionend| listener to the given section so that |
| 1065 * it can be animated. The listener will only be added to a given section | 1060 * it can be animated. The listener will only be added to a given section |
| 1066 * once, so this can be called as multiple times. | 1061 * once, so this can be called as multiple times. |
| 1067 * @param {HTMLElement} section The section to be animated. | 1062 * @param {HTMLElement} section The section to be animated. |
| 1068 * @private | 1063 * @private |
| 1069 */ | 1064 */ |
| 1070 addTransitionEndListener_: function(section) { | 1065 addTransitionEndListener_: function(section) { |
| 1071 if (section.hasTransitionEndListener_) | 1066 if (section.hasTransitionEndListener_) |
| 1072 return; | 1067 return; |
| 1073 | 1068 |
| 1074 section.addEventListener('transitionend', | 1069 section.addEventListener( |
| 1075 this.onTransitionEnd_.bind(this)); | 1070 'transitionend', this.onTransitionEnd_.bind(this)); |
| 1076 section.hasTransitionEndListener_ = true; | 1071 section.hasTransitionEndListener_ = true; |
| 1077 }, | 1072 }, |
| 1078 | 1073 |
| 1079 /** | 1074 /** |
| 1080 * Called after an animation transition has ended. | 1075 * Called after an animation transition has ended. |
| 1081 * @param {Event} event The transitionend event. NOTE: May be | 1076 * @param {Event} event The transitionend event. NOTE: May be |
| 1082 * synthetic. | 1077 * synthetic. |
| 1083 * @private | 1078 * @private |
| 1084 */ | 1079 */ |
| 1085 onTransitionEnd_: function(event) { | 1080 onTransitionEnd_: function(event) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 // already hidden. | 1153 // already hidden. |
| 1159 if (this.signedIn_ && !syncData.signedIn && !syncData.setupInProgress) | 1154 if (this.signedIn_ && !syncData.signedIn && !syncData.setupInProgress) |
| 1160 SyncSetupOverlay.closeOverlay(); | 1155 SyncSetupOverlay.closeOverlay(); |
| 1161 | 1156 |
| 1162 this.signedIn_ = !!syncData.signedIn; | 1157 this.signedIn_ = !!syncData.signedIn; |
| 1163 | 1158 |
| 1164 // Display the "advanced settings" button if we're signed in and sync is | 1159 // Display the "advanced settings" button if we're signed in and sync is |
| 1165 // not managed/disabled. If the user is signed in, but sync is disabled, | 1160 // not managed/disabled. If the user is signed in, but sync is disabled, |
| 1166 // this button is used to re-enable sync. | 1161 // this button is used to re-enable sync. |
| 1167 var customizeSyncButton = $('customize-sync'); | 1162 var customizeSyncButton = $('customize-sync'); |
| 1168 customizeSyncButton.hidden = !this.signedIn_ || | 1163 customizeSyncButton.hidden = |
| 1169 syncData.managed || | 1164 !this.signedIn_ || syncData.managed || !syncData.syncSystemEnabled; |
| 1170 !syncData.syncSystemEnabled; | |
| 1171 | 1165 |
| 1172 // Only modify the customize button's text if the new text is different. | 1166 // Only modify the customize button's text if the new text is different. |
| 1173 // Otherwise, it can affect search-highlighting in the settings page. | 1167 // Otherwise, it can affect search-highlighting in the settings page. |
| 1174 // See http://crbug.com/268265. | 1168 // See http://crbug.com/268265. |
| 1175 var customizeSyncButtonNewText = syncData.setupCompleted ? | 1169 var customizeSyncButtonNewText = syncData.setupCompleted ? |
| 1176 loadTimeData.getString('customizeSync') : | 1170 loadTimeData.getString('customizeSync') : |
| 1177 loadTimeData.getString('syncButtonTextStart'); | 1171 loadTimeData.getString('syncButtonTextStart'); |
| 1178 if (customizeSyncButton.textContent != customizeSyncButtonNewText) | 1172 if (customizeSyncButton.textContent != customizeSyncButtonNewText) |
| 1179 customizeSyncButton.textContent = customizeSyncButtonNewText; | 1173 customizeSyncButton.textContent = customizeSyncButtonNewText; |
| 1180 | 1174 |
| 1181 // Disable the "sign in" button if we're currently signing in, or if we're | 1175 // Disable the "sign in" button if we're currently signing in, or if we're |
| 1182 // already signed in and signout is not allowed. | 1176 // already signed in and signout is not allowed. |
| 1183 var signInButton = $('start-stop-sync'); | 1177 var signInButton = $('start-stop-sync'); |
| 1184 signInButton.disabled = syncData.setupInProgress; | 1178 signInButton.disabled = syncData.setupInProgress; |
| 1185 this.signoutAllowed_ = !!syncData.signoutAllowed; | 1179 this.signoutAllowed_ = !!syncData.signoutAllowed; |
| 1186 if (!syncData.signoutAllowed) | 1180 if (!syncData.signoutAllowed) |
| 1187 $('start-stop-sync-indicator').setAttribute('controlled-by', 'policy'); | 1181 $('start-stop-sync-indicator').setAttribute('controlled-by', 'policy'); |
| 1188 else | 1182 else |
| 1189 $('start-stop-sync-indicator').removeAttribute('controlled-by'); | 1183 $('start-stop-sync-indicator').removeAttribute('controlled-by'); |
| 1190 | 1184 |
| 1191 // Hide the "sign in" button on Chrome OS, and show it on desktop Chrome | 1185 // Hide the "sign in" button on Chrome OS, and show it on desktop Chrome |
| 1192 // (except for supervised users, which can't change their signed-in | 1186 // (except for supervised users, which can't change their signed-in |
| 1193 // status). | 1187 // status). |
| 1194 signInButton.hidden = cr.isChromeOS || syncData.supervisedUser; | 1188 signInButton.hidden = cr.isChromeOS || syncData.supervisedUser; |
| 1195 | 1189 |
| 1196 signInButton.textContent = | 1190 signInButton.textContent = this.signedIn_ ? |
| 1197 this.signedIn_ ? | 1191 loadTimeData.getString('syncButtonTextStop') : |
| 1198 loadTimeData.getString('syncButtonTextStop') : | 1192 syncData.setupInProgress ? |
| 1199 syncData.setupInProgress ? | 1193 loadTimeData.getString('syncButtonTextInProgress') : |
| 1200 loadTimeData.getString('syncButtonTextInProgress') : | 1194 loadTimeData.getString('syncButtonTextSignIn'); |
| 1201 loadTimeData.getString('syncButtonTextSignIn'); | |
| 1202 $('start-stop-sync-indicator').hidden = signInButton.hidden; | 1195 $('start-stop-sync-indicator').hidden = signInButton.hidden; |
| 1203 | 1196 |
| 1204 $('account-info').textContent = syncData.accountInfo; | 1197 $('account-info').textContent = syncData.accountInfo; |
| 1205 $('account-info').hidden = !this.signedIn_; | 1198 $('account-info').hidden = !this.signedIn_; |
| 1206 | 1199 |
| 1207 // TODO(estade): can this just be textContent? | 1200 // TODO(estade): can this just be textContent? |
| 1208 $('sync-status-text').innerHTML = syncData.statusText; | 1201 $('sync-status-text').innerHTML = syncData.statusText; |
| 1209 var statusSet = syncData.statusText.length != 0; | 1202 var statusSet = syncData.statusText.length != 0; |
| 1210 $('sync-overview').hidden = | 1203 $('sync-overview').hidden = statusSet || |
| 1211 statusSet || | |
| 1212 (cr.isChromeOS && UIAccountTweaks.loggedInAsPublicAccount()); | 1204 (cr.isChromeOS && UIAccountTweaks.loggedInAsPublicAccount()); |
| 1213 $('sync-status').hidden = !statusSet; | 1205 $('sync-status').hidden = !statusSet; |
| 1214 | 1206 |
| 1215 $('sync-action-link').textContent = syncData.actionLinkText; | 1207 $('sync-action-link').textContent = syncData.actionLinkText; |
| 1216 // Don't show the action link if it is empty or undefined. | 1208 // Don't show the action link if it is empty or undefined. |
| 1217 $('sync-action-link').hidden = syncData.actionLinkText.length == 0; | 1209 $('sync-action-link').hidden = syncData.actionLinkText.length == 0; |
| 1218 $('sync-action-link').disabled = syncData.managed || | 1210 $('sync-action-link').disabled = |
| 1219 !syncData.syncSystemEnabled; | 1211 syncData.managed || !syncData.syncSystemEnabled; |
| 1220 | 1212 |
| 1221 $('sync-action-link').onclick = function(event) { | 1213 $('sync-action-link').onclick = function(event) { |
| 1222 switch (syncData.statusAction) { | 1214 switch (syncData.statusAction) { |
| 1223 case 'reauthenticate': | 1215 case 'reauthenticate': |
| 1224 SyncSetupOverlay.startSignIn(false /* creatingSupervisedUser */); | 1216 SyncSetupOverlay.startSignIn(false /* creatingSupervisedUser */); |
| 1225 break; | 1217 break; |
| 1226 case 'signOutAndSignIn': | 1218 case 'signOutAndSignIn': |
| 1227 // <if expr="chromeos"> | 1219 // <if expr="chromeos"> |
| 1228 // On Chrome OS, sign out the user and sign in again to get fresh | 1220 // On Chrome OS, sign out the user and sign in again to get fresh |
| 1229 // credentials on auth errors. | 1221 // credentials on auth errors. |
| 1230 SyncSetupOverlay.doSignOutOnAuthError(); | 1222 SyncSetupOverlay.doSignOutOnAuthError(); |
| 1231 // </if> | 1223 // </if> |
| 1232 // <if expr="not chromeos"> | 1224 // <if expr="not chromeos"> |
| 1233 if (syncData.signoutAllowed) { | 1225 if (syncData.signoutAllowed) { |
| 1234 // Silently sign the user out without deleting their profile and | 1226 // Silently sign the user out without deleting their profile and |
| 1235 // prompt them to sign back in. | 1227 // prompt them to sign back in. |
| 1236 chrome.send('SyncSetupStopSyncing', [false /* deleteProfile */]); | 1228 chrome.send('SyncSetupStopSyncing', [false /* deleteProfile */]); |
| 1237 SyncSetupOverlay.startSignIn(false /* creatingSupervisedUser */); | 1229 SyncSetupOverlay.startSignIn(false /* creatingSupervisedUser */); |
| 1238 } else { | 1230 } else { |
| 1239 chrome.send('showDisconnectManagedProfileDialog'); | 1231 chrome.send('showDisconnectManagedProfileDialog'); |
| 1240 } | 1232 } |
| 1241 // </if> | 1233 // </if> |
| 1242 break; | 1234 break; |
| 1243 case 'upgradeClient': | 1235 case 'upgradeClient': |
| 1244 PageManager.showPageByName('help'); | 1236 PageManager.showPageByName('help'); |
| 1245 break; | 1237 break; |
| 1246 default: | 1238 default: |
| 1247 SyncSetupOverlay.showSetupUI(); | 1239 SyncSetupOverlay.showSetupUI(); |
| 1248 } | 1240 } |
| 1249 }; | 1241 }; |
| 1250 | 1242 |
| 1251 if (syncData.hasError) | 1243 if (syncData.hasError) |
| 1252 $('sync-status').classList.add('sync-error'); | 1244 $('sync-status').classList.add('sync-error'); |
| 1253 else | 1245 else |
| 1254 $('sync-status').classList.remove('sync-error'); | 1246 $('sync-status').classList.remove('sync-error'); |
| 1255 | 1247 |
| 1256 // Disable the "customize / set up sync" button if sync has an | 1248 // Disable the "customize / set up sync" button if sync has an |
| 1257 // unrecoverable error. Also disable the button if sync has not been set | 1249 // unrecoverable error. Also disable the button if sync has not been set |
| 1258 // up and the user is being presented with a link to re-auth. | 1250 // up and the user is being presented with a link to re-auth. |
| 1259 // See crbug.com/289791. | 1251 // See crbug.com/289791. |
| 1260 customizeSyncButton.disabled = | 1252 customizeSyncButton.disabled = syncData.hasUnrecoverableError || |
| 1261 syncData.hasUnrecoverableError || | |
| 1262 (!syncData.setupCompleted && !$('sync-action-link').hidden); | 1253 (!syncData.setupCompleted && !$('sync-action-link').hidden); |
| 1263 }, | 1254 }, |
| 1264 | 1255 |
| 1265 /** | 1256 /** |
| 1266 * Update the UI depending on whether Easy Unlock is enabled for the current | 1257 * Update the UI depending on whether Easy Unlock is enabled for the current |
| 1267 * profile. | 1258 * profile. |
| 1268 * @param {boolean} isEnabled True if the feature is enabled for the current | 1259 * @param {boolean} isEnabled True if the feature is enabled for the current |
| 1269 * profile. | 1260 * profile. |
| 1270 */ | 1261 */ |
| 1271 updateEasyUnlock_: function(isEnabled) { | 1262 updateEasyUnlock_: function(isEnabled) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 } | 1307 } |
| 1317 }, | 1308 }, |
| 1318 | 1309 |
| 1319 /** | 1310 /** |
| 1320 * Activates the Hotword section from the System settings page. | 1311 * Activates the Hotword section from the System settings page. |
| 1321 * @param {string} sectionId The id of the section to display. | 1312 * @param {string} sectionId The id of the section to display. |
| 1322 * @param {string} indicatorId The id of the indicator to display. | 1313 * @param {string} indicatorId The id of the indicator to display. |
| 1323 * @param {string=} opt_error The error message to display. | 1314 * @param {string=} opt_error The error message to display. |
| 1324 * @private | 1315 * @private |
| 1325 */ | 1316 */ |
| 1326 showHotwordCheckboxAndIndicator_: function(sectionId, indicatorId, | 1317 showHotwordCheckboxAndIndicator_: function( |
| 1327 opt_error) { | 1318 sectionId, indicatorId, opt_error) { |
| 1328 $(sectionId).hidden = false; | 1319 $(sectionId).hidden = false; |
| 1329 $(indicatorId).setError(opt_error); | 1320 $(indicatorId).setError(opt_error); |
| 1330 if (opt_error) | 1321 if (opt_error) |
| 1331 $(indicatorId).updateBasedOnError(); | 1322 $(indicatorId).updateBasedOnError(); |
| 1332 }, | 1323 }, |
| 1333 | 1324 |
| 1334 /** | 1325 /** |
| 1335 * Activates the Hotword section from the System settings page. | 1326 * Activates the Hotword section from the System settings page. |
| 1336 * @param {string=} opt_error The error message to display. | 1327 * @param {string=} opt_error The error message to display. |
| 1337 * @private | 1328 * @private |
| 1338 */ | 1329 */ |
| 1339 showHotwordSection_: function(opt_error) { | 1330 showHotwordSection_: function(opt_error) { |
| 1340 this.showHotwordCheckboxAndIndicator_( | 1331 this.showHotwordCheckboxAndIndicator_( |
| 1341 'hotword-search', | 1332 'hotword-search', 'hotword-search-setting-indicator', opt_error); |
| 1342 'hotword-search-setting-indicator', | |
| 1343 opt_error); | |
| 1344 }, | 1333 }, |
| 1345 | 1334 |
| 1346 /** | 1335 /** |
| 1347 * Activates the Always-On Hotword sections from the | 1336 * Activates the Always-On Hotword sections from the |
| 1348 * System settings page. | 1337 * System settings page. |
| 1349 * @param {string=} opt_error The error message to display. | 1338 * @param {string=} opt_error The error message to display. |
| 1350 * @private | 1339 * @private |
| 1351 */ | 1340 */ |
| 1352 showHotwordAlwaysOnSection_: function(opt_error) { | 1341 showHotwordAlwaysOnSection_: function(opt_error) { |
| 1353 this.showHotwordCheckboxAndIndicator_( | 1342 this.showHotwordCheckboxAndIndicator_( |
| 1354 'hotword-always-on-search', | 1343 'hotword-always-on-search', |
| 1355 'hotword-always-on-search-setting-indicator', | 1344 'hotword-always-on-search-setting-indicator', opt_error); |
| 1356 opt_error); | |
| 1357 }, | 1345 }, |
| 1358 | 1346 |
| 1359 /** | 1347 /** |
| 1360 * Activates the Hotword section on devices with no DSP | 1348 * Activates the Hotword section on devices with no DSP |
| 1361 * from the System settings page. | 1349 * from the System settings page. |
| 1362 * @param {string=} opt_error The error message to display. | 1350 * @param {string=} opt_error The error message to display. |
| 1363 * @private | 1351 * @private |
| 1364 */ | 1352 */ |
| 1365 showHotwordNoDspSection_: function(opt_error) { | 1353 showHotwordNoDspSection_: function(opt_error) { |
| 1366 this.showHotwordCheckboxAndIndicator_( | 1354 this.showHotwordCheckboxAndIndicator_( |
| 1367 'hotword-no-dsp-search', | 1355 'hotword-no-dsp-search', 'hotword-no-dsp-search-setting-indicator', |
| 1368 'hotword-no-dsp-search-setting-indicator', | |
| 1369 opt_error); | 1356 opt_error); |
| 1370 }, | 1357 }, |
| 1371 | 1358 |
| 1372 /** | 1359 /** |
| 1373 * Controls the visibility of all the hotword sections. | 1360 * Controls the visibility of all the hotword sections. |
| 1374 * @param {boolean} visible Whether to show hotword sections. | 1361 * @param {boolean} visible Whether to show hotword sections. |
| 1375 * @private | 1362 * @private |
| 1376 */ | 1363 */ |
| 1377 setAllHotwordSectionsVisible_: function(visible) { | 1364 setAllHotwordSectionsVisible_: function(visible) { |
| 1378 $('hotword-search').hidden = !visible; | 1365 $('hotword-search').hidden = !visible; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 // for remote files, /home/chronos/user/Downloads or | 1452 // for remote files, /home/chronos/user/Downloads or |
| 1466 // /home/chronos/u-<hash>/Downloads with "Downloads" for local paths, | 1453 // /home/chronos/u-<hash>/Downloads with "Downloads" for local paths, |
| 1467 // and '/' with ' \u203a ' (angled quote sign) everywhere. The modified | 1454 // and '/' with ' \u203a ' (angled quote sign) everywhere. The modified |
| 1468 // path is used only for display purpose. | 1455 // path is used only for display purpose. |
| 1469 var path = $('downloadLocationPath').value; | 1456 var path = $('downloadLocationPath').value; |
| 1470 path = path.replace(/^\/special\/drive[^\/]*\/root/, 'Google Drive'); | 1457 path = path.replace(/^\/special\/drive[^\/]*\/root/, 'Google Drive'); |
| 1471 path = path.replace(/^\/home\/chronos\/(user|u-[^\/]*)\//, ''); | 1458 path = path.replace(/^\/home\/chronos\/(user|u-[^\/]*)\//, ''); |
| 1472 path = path.replace(/\//g, ' \u203a '); | 1459 path = path.replace(/\//g, ' \u203a '); |
| 1473 $('downloadLocationPath').value = path; | 1460 $('downloadLocationPath').value = path; |
| 1474 } | 1461 } |
| 1475 $('download-location-label').classList.toggle('disabled', | 1462 $('download-location-label') |
| 1476 event.value.disabled); | 1463 .classList.toggle('disabled', event.value.disabled); |
| 1477 $('downloadLocationChangeButton').disabled = event.value.disabled; | 1464 $('downloadLocationChangeButton').disabled = event.value.disabled; |
| 1478 }, | 1465 }, |
| 1479 | 1466 |
| 1480 /** | 1467 /** |
| 1481 * Update the Default Browsers section based on the current state. | 1468 * Update the Default Browsers section based on the current state. |
| 1482 * @param {string} statusString Description of the current default state. | 1469 * @param {string} statusString Description of the current default state. |
| 1483 * @param {boolean} isDefault Whether or not the browser is currently | 1470 * @param {boolean} isDefault Whether or not the browser is currently |
| 1484 * default. | 1471 * default. |
| 1485 * @param {boolean} canBeDefault Whether or not the browser can be default. | 1472 * @param {boolean} canBeDefault Whether or not the browser can be default. |
| 1486 * @private | 1473 * @private |
| 1487 */ | 1474 */ |
| 1488 updateDefaultBrowserState_: function(statusString, isDefault, | 1475 updateDefaultBrowserState_: function( |
| 1489 canBeDefault) { | 1476 statusString, isDefault, canBeDefault) { |
| 1490 if (!cr.isChromeOS) { | 1477 if (!cr.isChromeOS) { |
| 1491 var label = $('default-browser-state'); | 1478 var label = $('default-browser-state'); |
| 1492 label.textContent = statusString; | 1479 label.textContent = statusString; |
| 1493 | 1480 |
| 1494 $('set-as-default-browser').hidden = !canBeDefault || isDefault; | 1481 $('set-as-default-browser').hidden = !canBeDefault || isDefault; |
| 1495 } | 1482 } |
| 1496 }, | 1483 }, |
| 1497 | 1484 |
| 1498 /** | 1485 /** |
| 1499 * Clears the search engine popup. | 1486 * Clears the search engine popup. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 * Helper function to set the status of profile view buttons to disabled or | 1552 * Helper function to set the status of profile view buttons to disabled or |
| 1566 * enabled, depending on the number of profiles and selection status of the | 1553 * enabled, depending on the number of profiles and selection status of the |
| 1567 * profiles list. | 1554 * profiles list. |
| 1568 * @private | 1555 * @private |
| 1569 */ | 1556 */ |
| 1570 setProfileViewButtonsStatus_: function() { | 1557 setProfileViewButtonsStatus_: function() { |
| 1571 var profilesList = $('profiles-list'); | 1558 var profilesList = $('profiles-list'); |
| 1572 var selectedProfile = profilesList.selectedItem; | 1559 var selectedProfile = profilesList.selectedItem; |
| 1573 var hasSelection = selectedProfile != null; | 1560 var hasSelection = selectedProfile != null; |
| 1574 var hasSingleProfile = profilesList.dataModel.length == 1; | 1561 var hasSingleProfile = profilesList.dataModel.length == 1; |
| 1575 $('profiles-manage').disabled = !hasSelection || | 1562 $('profiles-manage').disabled = |
| 1576 !selectedProfile.isCurrentProfile; | 1563 !hasSelection || !selectedProfile.isCurrentProfile; |
| 1577 if (hasSelection && !selectedProfile.isCurrentProfile) | 1564 if (hasSelection && !selectedProfile.isCurrentProfile) |
| 1578 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); | 1565 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); |
| 1579 else | 1566 else |
| 1580 $('profiles-manage').title = ''; | 1567 $('profiles-manage').title = ''; |
| 1581 $('profiles-delete').disabled = !profilesList.canDeleteItems || | 1568 $('profiles-delete').disabled = |
| 1582 !hasSelection; | 1569 !profilesList.canDeleteItems || !hasSelection; |
| 1583 var importData = $('import-data'); | 1570 var importData = $('import-data'); |
| 1584 if (importData) { | 1571 if (importData) { |
| 1585 importData.disabled = $('import-data').disabled = hasSelection && | 1572 importData.disabled = $('import-data').disabled = |
| 1586 !selectedProfile.isCurrentProfile; | 1573 hasSelection && !selectedProfile.isCurrentProfile; |
| 1587 } | 1574 } |
| 1588 }, | 1575 }, |
| 1589 | 1576 |
| 1590 /** | 1577 /** |
| 1591 * Display the correct dialog layout, depending on how many profiles are | 1578 * Display the correct dialog layout, depending on how many profiles are |
| 1592 * available. | 1579 * available. |
| 1593 * @param {number} numProfiles The number of profiles to display. | 1580 * @param {number} numProfiles The number of profiles to display. |
| 1594 * @private | 1581 * @private |
| 1595 */ | 1582 */ |
| 1596 setProfileViewSingle_: function(numProfiles) { | 1583 setProfileViewSingle_: function(numProfiles) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 /** | 1637 /** |
| 1651 * Reports an error to the "create" overlay during profile creation. | 1638 * Reports an error to the "create" overlay during profile creation. |
| 1652 * @param {string} error The error message to display. | 1639 * @param {string} error The error message to display. |
| 1653 * @private | 1640 * @private |
| 1654 */ | 1641 */ |
| 1655 showCreateProfileError_: function(error) { | 1642 showCreateProfileError_: function(error) { |
| 1656 CreateProfileOverlay.onError(error); | 1643 CreateProfileOverlay.onError(error); |
| 1657 }, | 1644 }, |
| 1658 | 1645 |
| 1659 /** | 1646 /** |
| 1660 * Sends a warning message to the "create" overlay during profile creation. | 1647 * Sends a warning message to the "create" overlay during profile creation. |
| 1661 * @param {string} warning The warning message to display. | 1648 * @param {string} warning The warning message to display. |
| 1662 * @private | 1649 * @private |
| 1663 */ | 1650 */ |
| 1664 showCreateProfileWarning_: function(warning) { | 1651 showCreateProfileWarning_: function(warning) { |
| 1665 CreateProfileOverlay.onWarning(warning); | 1652 CreateProfileOverlay.onWarning(warning); |
| 1666 }, | 1653 }, |
| 1667 | 1654 |
| 1668 /** | 1655 /** |
| 1669 * Reports successful profile creation to the "create" overlay. | 1656 * Reports successful profile creation to the "create" overlay. |
| 1670 * @param {options.Profile} profileInfo An object of the form: | 1657 * @param {options.Profile} profileInfo An object of the form: |
| 1671 * profileInfo = { | 1658 * profileInfo = { |
| 1672 * name: "Profile Name", | 1659 * name: "Profile Name", |
| 1673 * filePath: "/path/to/profile/data/on/disk" | 1660 * filePath: "/path/to/profile/data/on/disk" |
| 1674 * isSupervised: (true|false), | 1661 * isSupervised: (true|false), |
| 1675 * }; | 1662 * }; |
| 1676 * @private | 1663 * @private |
| 1677 */ | 1664 */ |
| 1678 showCreateProfileSuccess_: function(profileInfo) { | 1665 showCreateProfileSuccess_: function(profileInfo) { |
| 1679 CreateProfileOverlay.onSuccess(profileInfo); | 1666 CreateProfileOverlay.onSuccess(profileInfo); |
| 1680 }, | 1667 }, |
| 1681 | 1668 |
| 1682 /** | 1669 /** |
| 1683 * Returns the currently active profile for this browser window. | 1670 * Returns the currently active profile for this browser window. |
| 1684 * @return {options.Profile} A profile info object. | 1671 * @return {options.Profile} A profile info object. |
| 1685 * @private | 1672 * @private |
| 1686 */ | 1673 */ |
| 1687 getCurrentProfile_: function() { | 1674 getCurrentProfile_: function() { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1728 picture.disabled = true; | 1715 picture.disabled = true; |
| 1729 ChangePictureOptions.closeOverlay(); | 1716 ChangePictureOptions.closeOverlay(); |
| 1730 } else { | 1717 } else { |
| 1731 picture.disabled = false; | 1718 picture.disabled = false; |
| 1732 } | 1719 } |
| 1733 | 1720 |
| 1734 // Create a synthetic pref change event decorated as | 1721 // Create a synthetic pref change event decorated as |
| 1735 // CoreOptionsHandler::CreateValueForPref() does. | 1722 // CoreOptionsHandler::CreateValueForPref() does. |
| 1736 var event = new Event('account-picture'); | 1723 var event = new Event('account-picture'); |
| 1737 if (managed) | 1724 if (managed) |
| 1738 event.value = { controlledBy: 'policy' }; | 1725 event.value = {controlledBy: 'policy'}; |
| 1739 else | 1726 else |
| 1740 event.value = {}; | 1727 event.value = {}; |
| 1741 $('account-picture-indicator').handlePrefChange(event); | 1728 $('account-picture-indicator').handlePrefChange(event); |
| 1742 }, | 1729 }, |
| 1743 | 1730 |
| 1744 /** | 1731 /** |
| 1745 * (Re)loads IMG element with current user account picture. | 1732 * (Re)loads IMG element with current user account picture. |
| 1746 * @private | 1733 * @private |
| 1747 */ | 1734 */ |
| 1748 updateAccountPicture_: function() { | 1735 updateAccountPicture_: function() { |
| 1749 var picture = $('account-picture'); | 1736 var picture = $('account-picture'); |
| 1750 if (picture) { | 1737 if (picture) { |
| 1751 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + | 1738 picture.src = |
| 1752 Date.now(); | 1739 'chrome://userimage/' + this.username_ + '?id=' + Date.now(); |
| 1753 } | 1740 } |
| 1754 }, | 1741 }, |
| 1755 | 1742 |
| 1756 /** | 1743 /** |
| 1757 * @param {boolean} managed | 1744 * @param {boolean} managed |
| 1758 */ | 1745 */ |
| 1759 setWallpaperManaged_: function(managed) { | 1746 setWallpaperManaged_: function(managed) { |
| 1760 if (managed) | 1747 if (managed) |
| 1761 $('set-wallpaper').disabled = true; | 1748 $('set-wallpaper').disabled = true; |
| 1762 else | 1749 else |
| 1763 this.enableElementIfPossible_(getRequiredElement('set-wallpaper')); | 1750 this.enableElementIfPossible_(getRequiredElement('set-wallpaper')); |
| 1764 | 1751 |
| 1765 // Create a synthetic pref change event decorated as | 1752 // Create a synthetic pref change event decorated as |
| 1766 // CoreOptionsHandler::CreateValueForPref() does. | 1753 // CoreOptionsHandler::CreateValueForPref() does. |
| 1767 var event = new Event('wallpaper'); | 1754 var event = new Event('wallpaper'); |
| 1768 event.value = managed ? { controlledBy: 'policy' } : {}; | 1755 event.value = managed ? {controlledBy: 'policy'} : {}; |
| 1769 $('wallpaper-indicator').handlePrefChange(event); | 1756 $('wallpaper-indicator').handlePrefChange(event); |
| 1770 }, | 1757 }, |
| 1771 | 1758 |
| 1772 /** | 1759 /** |
| 1773 * This enables or disables dependent settings in timezone section. | 1760 * This enables or disables dependent settings in timezone section. |
| 1774 * @private | 1761 * @private |
| 1775 */ | 1762 */ |
| 1776 updateTimezoneSectionState_: function() { | 1763 updateTimezoneSectionState_: function() { |
| 1777 var self = this; | 1764 var self = this; |
| 1778 $('resolve-timezone-by-geolocation') | 1765 $('resolve-timezone-by-geolocation').onclick = function(event) { |
| 1779 .onclick = function(event) { | |
| 1780 self.resolveTimezoneByGeolocation_ = event.currentTarget.checked; | 1766 self.resolveTimezoneByGeolocation_ = event.currentTarget.checked; |
| 1781 }; | 1767 }; |
| 1782 if (this.systemTimezoneIsManaged_) { | 1768 if (this.systemTimezoneIsManaged_) { |
| 1783 $('resolve-timezone-by-geolocation').disabled = true; | 1769 $('resolve-timezone-by-geolocation').disabled = true; |
| 1784 $('resolve-timezone-by-geolocation').checked = false; | 1770 $('resolve-timezone-by-geolocation').checked = false; |
| 1785 } else if (this.systemTimezoneAutomaticDetectionIsManaged_) { | 1771 } else if (this.systemTimezoneAutomaticDetectionIsManaged_) { |
| 1786 if (this.systemTimezoneAutomaticDetectionValue_ == | 1772 if (this.systemTimezoneAutomaticDetectionValue_ == |
| 1787 options.AutomaticTimezoneDetectionType.USERS_DECIDE) { | 1773 options.AutomaticTimezoneDetectionType.USERS_DECIDE) { |
| 1788 $('resolve-timezone-by-geolocation').disabled = false; | 1774 $('resolve-timezone-by-geolocation').disabled = false; |
| 1789 $('resolve-timezone-by-geolocation') | 1775 $('resolve-timezone-by-geolocation').checked = |
| 1790 .checked = this.resolveTimezoneByGeolocation_; | 1776 this.resolveTimezoneByGeolocation_; |
| 1791 $('timezone-value-select') | 1777 $('timezone-value-select').disabled = |
| 1792 .disabled = this.resolveTimezoneByGeolocation_; | 1778 this.resolveTimezoneByGeolocation_; |
| 1793 } else { | 1779 } else { |
| 1794 $('resolve-timezone-by-geolocation').disabled = true; | 1780 $('resolve-timezone-by-geolocation').disabled = true; |
| 1795 $('resolve-timezone-by-geolocation') | 1781 $('resolve-timezone-by-geolocation').checked = |
| 1796 .checked = | |
| 1797 (this.systemTimezoneAutomaticDetectionValue_ != | 1782 (this.systemTimezoneAutomaticDetectionValue_ != |
| 1798 options.AutomaticTimezoneDetectionType.DISABLED); | 1783 options.AutomaticTimezoneDetectionType.DISABLED); |
| 1799 $('timezone-value-select').disabled = true; | 1784 $('timezone-value-select').disabled = true; |
| 1800 } | 1785 } |
| 1801 } else { | 1786 } else { |
| 1802 this.enableElementIfPossible_( | 1787 this.enableElementIfPossible_( |
| 1803 getRequiredElement('resolve-timezone-by-geolocation')); | 1788 getRequiredElement('resolve-timezone-by-geolocation')); |
| 1804 $('timezone-value-select').disabled = | 1789 $('timezone-value-select').disabled = |
| 1805 this.resolveTimezoneByGeolocation_; | 1790 this.resolveTimezoneByGeolocation_; |
| 1806 $('resolve-timezone-by-geolocation') | 1791 $('resolve-timezone-by-geolocation').checked = |
| 1807 .checked = this.resolveTimezoneByGeolocation_; | 1792 this.resolveTimezoneByGeolocation_; |
| 1808 } | 1793 } |
| 1809 }, | 1794 }, |
| 1810 | 1795 |
| 1811 /** | 1796 /** |
| 1812 * Called when stylus hardware detection probing is complete. | 1797 * Called when stylus hardware detection probing is complete. |
| 1813 * @param {boolean} hasStylus | 1798 * @param {boolean} hasStylus |
| 1814 * @private | 1799 * @private |
| 1815 */ | 1800 */ |
| 1816 setStylusInputStatus_: function(hasStylus) { | 1801 setStylusInputStatus_: function(hasStylus) { |
| 1817 if (!hasStylus) | 1802 if (!hasStylus) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1857 onResolveTimezoneByGeolocationChanged_: function(value) { | 1842 onResolveTimezoneByGeolocationChanged_: function(value) { |
| 1858 this.resolveTimezoneByGeolocation_ = value.value.value; | 1843 this.resolveTimezoneByGeolocation_ = value.value.value; |
| 1859 this.updateTimezoneSectionState_(); | 1844 this.updateTimezoneSectionState_(); |
| 1860 }, | 1845 }, |
| 1861 | 1846 |
| 1862 /** | 1847 /** |
| 1863 * Handle the 'add device' button click. | 1848 * Handle the 'add device' button click. |
| 1864 * @private | 1849 * @private |
| 1865 */ | 1850 */ |
| 1866 handleAddBluetoothDevice_: function() { | 1851 handleAddBluetoothDevice_: function() { |
| 1867 chrome.send('coreOptionsUserMetricsAction', | 1852 chrome.send( |
| 1868 ['Options_BluetoothShowAddDevice']); | 1853 'coreOptionsUserMetricsAction', ['Options_BluetoothShowAddDevice']); |
| 1869 PageManager.showPageByName('bluetooth', false); | 1854 PageManager.showPageByName('bluetooth', false); |
| 1870 }, | 1855 }, |
| 1871 | 1856 |
| 1872 /** | 1857 /** |
| 1873 * Enables or disables the Manage SSL Certificates button. | 1858 * Enables or disables the Manage SSL Certificates button. |
| 1874 * @private | 1859 * @private |
| 1875 */ | 1860 */ |
| 1876 enableCertificateButton_: function(enabled) { | 1861 enableCertificateButton_: function(enabled) { |
| 1877 $('certificatesManageButton').disabled = !enabled; | 1862 $('certificatesManageButton').disabled = !enabled; |
| 1878 }, | 1863 }, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1898 * @private | 1883 * @private |
| 1899 */ | 1884 */ |
| 1900 enableFactoryResetSection_: function() { | 1885 enableFactoryResetSection_: function() { |
| 1901 $('factory-reset-section').hidden = false; | 1886 $('factory-reset-section').hidden = false; |
| 1902 }, | 1887 }, |
| 1903 | 1888 |
| 1904 /** | 1889 /** |
| 1905 * Set the checked state of the metrics reporting checkbox. | 1890 * Set the checked state of the metrics reporting checkbox. |
| 1906 * @private | 1891 * @private |
| 1907 */ | 1892 */ |
| 1908 setMetricsReportingCheckboxState_: function(checked, | 1893 setMetricsReportingCheckboxState_: function( |
| 1909 policyManaged, | 1894 checked, policyManaged, ownerManaged) { |
| 1910 ownerManaged) { | |
| 1911 $('metrics-reporting-enabled').checked = checked; | 1895 $('metrics-reporting-enabled').checked = checked; |
| 1912 $('metrics-reporting-enabled').disabled = policyManaged || ownerManaged; | 1896 $('metrics-reporting-enabled').disabled = policyManaged || ownerManaged; |
| 1913 | 1897 |
| 1914 // If checkbox gets disabled then add an attribute for displaying the | 1898 // If checkbox gets disabled then add an attribute for displaying the |
| 1915 // special icon. Otherwise remove the indicator attribute. | 1899 // special icon. Otherwise remove the indicator attribute. |
| 1916 if (policyManaged) { | 1900 if (policyManaged) { |
| 1917 $('metrics-reporting-disabled-icon').setAttribute('controlled-by', | 1901 $('metrics-reporting-disabled-icon') |
| 1918 'policy'); | 1902 .setAttribute('controlled-by', 'policy'); |
| 1919 } else if (ownerManaged) { | 1903 } else if (ownerManaged) { |
| 1920 $('metrics-reporting-disabled-icon').setAttribute('controlled-by', | 1904 $('metrics-reporting-disabled-icon') |
| 1921 'owner'); | 1905 .setAttribute('controlled-by', 'owner'); |
| 1922 } else { | 1906 } else { |
| 1923 $('metrics-reporting-disabled-icon').removeAttribute('controlled-by'); | 1907 $('metrics-reporting-disabled-icon').removeAttribute('controlled-by'); |
| 1924 } | 1908 } |
| 1925 | 1909 |
| 1926 }, | 1910 }, |
| 1927 | 1911 |
| 1928 /** | 1912 /** |
| 1929 * @private | 1913 * @private |
| 1930 */ | 1914 */ |
| 1931 setMetricsReportingSettingVisibility_: function(visible) { | 1915 setMetricsReportingSettingVisibility_: function(visible) { |
| 1932 if (visible) | 1916 if (visible) |
| 1933 $('metrics-reporting-setting').style.display = 'block'; | 1917 $('metrics-reporting-setting').style.display = 'block'; |
| 1934 else | 1918 else |
| 1935 $('metrics-reporting-setting').style.display = 'none'; | 1919 $('metrics-reporting-setting').style.display = 'none'; |
| 1936 }, | 1920 }, |
| 1937 | 1921 |
| 1938 /** | 1922 /** |
| 1939 * Set the checked state of the Safe Browsing Extended Reporting Enabled | 1923 * Set the checked state of the Safe Browsing Extended Reporting Enabled |
| 1940 * checkbox. | 1924 * checkbox. |
| 1941 * @private | 1925 * @private |
| 1942 */ | 1926 */ |
| 1943 setExtendedReportingEnabledCheckboxState_: function(checked) { | 1927 setExtendedReportingEnabledCheckboxState_: function(checked) { |
| 1944 $('safeBrowsingExtendedReportingCheckbox').checked = checked; | 1928 $('safeBrowsingExtendedReportingCheckbox').checked = checked; |
| 1945 }, | 1929 }, |
| 1946 | 1930 |
| 1947 /** | 1931 /** |
| 1948 * Set network prediction checkbox value. | 1932 * Set network prediction checkbox value. |
| 1949 * | 1933 * |
| 1950 * @param {{value: number, disabled: boolean}} pref Information about | 1934 * @param {{value: number, disabled: boolean}} pref Information about |
| 1951 * network prediction options. |pref.value| is the value of network | 1935 * network prediction options. |pref.value| is the value of network |
| 1952 * prediction options. |pref.disabled| shows if the pref is not user | 1936 * prediction options. |pref.disabled| shows if the pref is not user |
| 1953 * modifiable. | 1937 * modifiable. |
| 1954 * @private | 1938 * @private |
| 1955 */ | 1939 */ |
| 1956 setNetworkPredictionValue_: function(pref) { | 1940 setNetworkPredictionValue_: function(pref) { |
| 1957 var checkbox = $('networkPredictionOptions'); | 1941 var checkbox = $('networkPredictionOptions'); |
| 1958 checkbox.disabled = pref.disabled || | 1942 checkbox.disabled = |
| 1959 loadTimeData.getBoolean('profileIsGuest'); | 1943 pref.disabled || loadTimeData.getBoolean('profileIsGuest'); |
| 1960 checkbox.checked = (pref.value != NetworkPredictionOptions.NEVER); | 1944 checkbox.checked = (pref.value != NetworkPredictionOptions.NEVER); |
| 1961 }, | 1945 }, |
| 1962 | 1946 |
| 1963 /** | 1947 /** |
| 1964 * Set the font size selected item. This item actually reflects two | 1948 * Set the font size selected item. This item actually reflects two |
| 1965 * preferences: the default font size and the default fixed font size. | 1949 * preferences: the default font size and the default fixed font size. |
| 1966 * | 1950 * |
| 1967 * @param {{value: number, disabled: boolean, controlledBy: string}} pref | 1951 * @param {{value: number, disabled: boolean, controlledBy: string}} pref |
| 1968 * Information about the font size preferences. |pref.value| is the | 1952 * Information about the font size preferences. |pref.value| is the |
| 1969 * value of the default font size pref. |pref.disabled| is true if | 1953 * value of the default font size pref. |pref.disabled| is true if |
| 1970 * either pref not user modifiable. |pref.controlledBy| is the source of | 1954 * either pref not user modifiable. |pref.controlledBy| is the source of |
| 1971 * the pref value(s) if either pref is currently not controlled by the | 1955 * the pref value(s) if either pref is currently not controlled by the |
| 1972 * user. | 1956 * user. |
| 1973 * @private | 1957 * @private |
| 1974 */ | 1958 */ |
| 1975 setFontSize_: function(pref) { | 1959 setFontSize_: function(pref) { |
| 1976 var selectCtl = /** @type {HTMLSelectElement} */($('defaultFontSize')); | 1960 var selectCtl = /** @type {HTMLSelectElement} */ ($('defaultFontSize')); |
| 1977 selectCtl.disabled = pref.disabled; | 1961 selectCtl.disabled = pref.disabled; |
| 1978 // Create a synthetic pref change event decorated as | 1962 // Create a synthetic pref change event decorated as |
| 1979 // CoreOptionsHandler::CreateValueForPref() does. | 1963 // CoreOptionsHandler::CreateValueForPref() does. |
| 1980 var event = new Event('synthetic-font-size'); | 1964 var event = new Event('synthetic-font-size'); |
| 1981 event.value = { | 1965 event.value = { |
| 1982 value: pref.value, | 1966 value: pref.value, |
| 1983 controlledBy: pref.controlledBy, | 1967 controlledBy: pref.controlledBy, |
| 1984 disabled: pref.disabled | 1968 disabled: pref.disabled |
| 1985 }; | 1969 }; |
| 1986 $('font-size-indicator').handlePrefChange(event); | 1970 $('font-size-indicator').handlePrefChange(event); |
| 1987 | 1971 |
| 1988 for (var i = 0; i < selectCtl.options.length; i++) { | 1972 for (var i = 0; i < selectCtl.options.length; i++) { |
| 1989 if (selectCtl.options[i].value == pref.value) { | 1973 if (selectCtl.options[i].value == pref.value) { |
| 1990 selectCtl.selectedIndex = i; | 1974 selectCtl.selectedIndex = i; |
| 1991 if ($('Custom')) | 1975 if ($('Custom')) |
| 1992 selectCtl.remove($('Custom').index); | 1976 selectCtl.remove($('Custom').index); |
| 1993 return; | 1977 return; |
| 1994 } | 1978 } |
| 1995 } | 1979 } |
| 1996 | 1980 |
| 1997 // Add/Select Custom Option in the font size label list. | 1981 // Add/Select Custom Option in the font size label list. |
| 1998 if (!$('Custom')) { | 1982 if (!$('Custom')) { |
| 1999 var option = new Option(loadTimeData.getString('fontSizeLabelCustom'), | 1983 var option = new Option( |
| 2000 -1, false, true); | 1984 loadTimeData.getString('fontSizeLabelCustom'), -1, false, true); |
| 2001 option.setAttribute('id', 'Custom'); | 1985 option.setAttribute('id', 'Custom'); |
| 2002 selectCtl.add(option); | 1986 selectCtl.add(option); |
| 2003 } | 1987 } |
| 2004 $('Custom').selected = true; | 1988 $('Custom').selected = true; |
| 2005 }, | 1989 }, |
| 2006 | 1990 |
| 2007 /** | 1991 /** |
| 2008 * Populate the page zoom selector with values received from the caller. | 1992 * Populate the page zoom selector with values received from the caller. |
| 2009 * @param {Array} items An array of items to populate the selector. | 1993 * @param {Array} items An array of items to populate the selector. |
| 2010 * each object is an array with three elements as follows: | 1994 * each object is an array with three elements as follows: |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 * Set the enabled state for the proxy settings button and its associated | 2040 * Set the enabled state for the proxy settings button and its associated |
| 2057 * message when extension controlled. | 2041 * message when extension controlled. |
| 2058 * @param {boolean} disabled Whether the button should be disabled. | 2042 * @param {boolean} disabled Whether the button should be disabled. |
| 2059 * @param {boolean} extensionControlled Whether the proxy is extension | 2043 * @param {boolean} extensionControlled Whether the proxy is extension |
| 2060 * controlled. | 2044 * controlled. |
| 2061 * @private | 2045 * @private |
| 2062 */ | 2046 */ |
| 2063 setupProxySettingsButton_: function(disabled, extensionControlled) { | 2047 setupProxySettingsButton_: function(disabled, extensionControlled) { |
| 2064 if (!cr.isChromeOS) { | 2048 if (!cr.isChromeOS) { |
| 2065 $('proxiesConfigureButton').disabled = disabled; | 2049 $('proxiesConfigureButton').disabled = disabled; |
| 2066 $('proxiesLabel').textContent = | 2050 $('proxiesLabel').textContent = loadTimeData.getString( |
| 2067 loadTimeData.getString(extensionControlled ? | 2051 extensionControlled ? 'proxiesLabelExtension' : |
| 2068 'proxiesLabelExtension' : 'proxiesLabelSystem'); | 2052 'proxiesLabelSystem'); |
| 2069 } | 2053 } |
| 2070 }, | 2054 }, |
| 2071 | 2055 |
| 2072 /** | 2056 /** |
| 2073 * Set the initial state of the spoken feedback checkbox. | 2057 * Set the initial state of the spoken feedback checkbox. |
| 2074 * @private | 2058 * @private |
| 2075 */ | 2059 */ |
| 2076 setSpokenFeedbackCheckboxState_: function(checked) { | 2060 setSpokenFeedbackCheckboxState_: function(checked) { |
| 2077 $('accessibility-spoken-feedback-check').checked = checked; | 2061 $('accessibility-spoken-feedback-check').checked = checked; |
| 2078 }, | 2062 }, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 * various settings of Chrome. | 2140 * various settings of Chrome. |
| 2157 * @param {{searchEngine: options.ExtensionData, | 2141 * @param {{searchEngine: options.ExtensionData, |
| 2158 * homePage: options.ExtensionData, | 2142 * homePage: options.ExtensionData, |
| 2159 * startUpPage: options.ExtensionData, | 2143 * startUpPage: options.ExtensionData, |
| 2160 * newTabPage: options.ExtensionData, | 2144 * newTabPage: options.ExtensionData, |
| 2161 * proxy: options.ExtensionData}} details A dictionary of ID+name | 2145 * proxy: options.ExtensionData}} details A dictionary of ID+name |
| 2162 * pairs for each of the settings controlled by an extension. | 2146 * pairs for each of the settings controlled by an extension. |
| 2163 * @private | 2147 * @private |
| 2164 */ | 2148 */ |
| 2165 toggleExtensionIndicators_: function(details) { | 2149 toggleExtensionIndicators_: function(details) { |
| 2166 this.toggleExtensionControlledBox_('search-section-content', | 2150 this.toggleExtensionControlledBox_( |
| 2167 'search-engine-controlled', | 2151 'search-section-content', 'search-engine-controlled', |
| 2168 details.searchEngine.id, | 2152 details.searchEngine.id, details.searchEngine.name); |
| 2169 details.searchEngine.name); | 2153 this.toggleExtensionControlledBox_( |
| 2170 this.toggleExtensionControlledBox_('extension-controlled-container', | 2154 'extension-controlled-container', 'homepage-controlled', |
| 2171 'homepage-controlled', | 2155 details.homePage.id, details.homePage.name); |
| 2172 details.homePage.id, | 2156 this.toggleExtensionControlledBox_( |
| 2173 details.homePage.name); | 2157 'startup-section-content', 'startpage-controlled', |
| 2174 this.toggleExtensionControlledBox_('startup-section-content', | 2158 details.startUpPage.id, details.startUpPage.name); |
| 2175 'startpage-controlled', | 2159 this.toggleExtensionControlledBox_( |
| 2176 details.startUpPage.id, | 2160 'newtab-section-content', 'newtab-controlled', details.newTabPage.id, |
| 2177 details.startUpPage.name); | 2161 details.newTabPage.name); |
| 2178 this.toggleExtensionControlledBox_('newtab-section-content', | 2162 this.toggleExtensionControlledBox_( |
| 2179 'newtab-controlled', | 2163 'proxy-section-content', 'proxy-controlled', details.proxy.id, |
| 2180 details.newTabPage.id, | 2164 details.proxy.name); |
| 2181 details.newTabPage.name); | |
| 2182 this.toggleExtensionControlledBox_('proxy-section-content', | |
| 2183 'proxy-controlled', | |
| 2184 details.proxy.id, | |
| 2185 details.proxy.name); | |
| 2186 | 2165 |
| 2187 // The proxy section contains just the warning box and nothing else, so | 2166 // The proxy section contains just the warning box and nothing else, so |
| 2188 // if we're hiding the proxy warning box, we should also hide its header | 2167 // if we're hiding the proxy warning box, we should also hide its header |
| 2189 // section. | 2168 // section. |
| 2190 $('proxy-section').hidden = details.proxy.id.length == 0; | 2169 $('proxy-section').hidden = details.proxy.id.length == 0; |
| 2191 }, | 2170 }, |
| 2192 | 2171 |
| 2193 | 2172 |
| 2194 /** | 2173 /** |
| 2195 * Show/hide touchpad-related settings. | 2174 * Show/hide touchpad-related settings. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2351 showImagerPickerOverlay_: function() { | 2330 showImagerPickerOverlay_: function() { |
| 2352 PageManager.showPageByName('changePicture'); | 2331 PageManager.showPageByName('changePicture'); |
| 2353 }, | 2332 }, |
| 2354 | 2333 |
| 2355 /** | 2334 /** |
| 2356 * Shows (or not) the "User" section of the settings page based on whether | 2335 * Shows (or not) the "User" section of the settings page based on whether |
| 2357 * any of the sub-sections are present (or not). | 2336 * any of the sub-sections are present (or not). |
| 2358 * @private | 2337 * @private |
| 2359 */ | 2338 */ |
| 2360 maybeShowUserSection_: function() { | 2339 maybeShowUserSection_: function() { |
| 2361 $('sync-users-section').hidden = | 2340 $('sync-users-section').hidden = $('profiles-section').hidden && |
| 2362 $('profiles-section').hidden && | |
| 2363 $('sync-section').hidden && | 2341 $('sync-section').hidden && |
| 2364 $('profiles-supervised-dashboard-tip').hidden; | 2342 $('profiles-supervised-dashboard-tip').hidden; |
| 2365 }, | 2343 }, |
| 2366 | 2344 |
| 2367 /** | 2345 /** |
| 2368 * Updates the date and time section with time sync information. | 2346 * Updates the date and time section with time sync information. |
| 2369 * @param {boolean} canSetTime Whether the system time can be set. | 2347 * @param {boolean} canSetTime Whether the system time can be set. |
| 2370 * @private | 2348 * @private |
| 2371 */ | 2349 */ |
| 2372 setCanSetTime_: function(canSetTime) { | 2350 setCanSetTime_: function(canSetTime) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2478 BrowserOptions.setAndroidAppsSettingsVisibility = function(isVisible) { | 2456 BrowserOptions.setAndroidAppsSettingsVisibility = function(isVisible) { |
| 2479 var settings = $('android-apps-settings'); | 2457 var settings = $('android-apps-settings'); |
| 2480 if (!settings) | 2458 if (!settings) |
| 2481 return; | 2459 return; |
| 2482 | 2460 |
| 2483 settings.hidden = !isVisible; | 2461 settings.hidden = !isVisible; |
| 2484 }; | 2462 }; |
| 2485 } | 2463 } |
| 2486 | 2464 |
| 2487 // Export | 2465 // Export |
| 2488 return { | 2466 return {BrowserOptions: BrowserOptions}; |
| 2489 BrowserOptions: BrowserOptions | |
| 2490 }; | |
| 2491 }); | 2467 }); |
| OLD | NEW |