Index: chrome/browser/resources/options/browser_options.js |
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js |
index 2266bdbe0b63cbdabd5865c5bb2e1a7b6d46c50e..edbd4cbff4885164647479b9499aa678b2def444 100644 |
--- a/chrome/browser/resources/options/browser_options.js |
+++ b/chrome/browser/resources/options/browser_options.js |
@@ -60,12 +60,8 @@ cr.define('options', function() { |
var ArrayDataModel = cr.ui.ArrayDataModel; |
var RepeatingButton = cr.ui.RepeatingButton; |
var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; |
- var NetworkPredictionOptions = { |
- ALWAYS: 0, |
- WIFI_ONLY: 1, |
- NEVER: 2, |
- DEFAULT: 1 |
- }; |
+ var NetworkPredictionOptions = |
+ {ALWAYS: 0, WIFI_ONLY: 1, NEVER: 2, DEFAULT: 1}; |
/** |
* Encapsulated handling of browser options page. |
@@ -73,8 +69,8 @@ cr.define('options', function() { |
* @extends {cr.ui.pageManager.Page} |
*/ |
function BrowserOptions() { |
- Page.call(this, 'settings', loadTimeData.getString('settingsTitle'), |
- 'settings'); |
+ Page.call( |
+ this, 'settings', loadTimeData.getString('settingsTitle'), 'settings'); |
} |
cr.addSingletonGetter(BrowserOptions); |
@@ -173,19 +169,20 @@ cr.define('options', function() { |
var showAdvanced = |
BrowserOptions.shouldShowSection_($('advanced-settings')); |
if (showAdvanced) { |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ShowAdvancedSettings']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', |
+ ['Options_ShowAdvancedSettings']); |
} |
self.toggleSectionWithAnimation_( |
- $('advanced-settings'), |
- $('advanced-settings-container')); |
+ $('advanced-settings'), $('advanced-settings-container')); |
// If the click was triggered using the keyboard and it showed the |
// section (rather than hiding it), focus the first element in the |
// container. |
if (e.detail == 0 && showAdvanced) { |
- var focusElement = $('advanced-settings-container').querySelector( |
- 'button, input, list, select, a[href]'); |
+ var focusElement = |
+ $('advanced-settings-container') |
+ .querySelector('button, input, list, select, a[href]'); |
if (focusElement) |
focusElement.focus(); |
} |
@@ -195,15 +192,15 @@ cr.define('options', function() { |
$('advanced-settings').hidden = true; |
} |
- $('advanced-settings').addEventListener('transitionend', |
- this.updateAdvancedSettingsExpander_.bind(this)); |
+ $('advanced-settings') |
+ .addEventListener( |
+ 'transitionend', this.updateAdvancedSettingsExpander_.bind(this)); |
if (loadTimeData.valueExists('aboutOverlayTabTitle')) { |
$('about-button').hidden = false; |
$('about-button').addEventListener('click', function() { |
PageManager.showPageByName('help'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_About']); |
+ chrome.send('coreOptionsUserMetricsAction', ['Options_About']); |
}); |
} |
@@ -215,11 +212,11 @@ cr.define('options', function() { |
} |
// Sync (Sign in) section. |
- this.updateSyncState_(/** @type {options.SyncStatus} */( |
+ this.updateSyncState_(/** @type {options.SyncStatus} */ ( |
loadTimeData.getValue('syncData'))); |
if (!$('sync-overview').hidden) { |
- chrome.send('metricsHandler:recordAction', |
- ['Signin_Impression_FromSettings']); |
+ chrome.send( |
+ 'metricsHandler:recordAction', ['Signin_Impression_FromSettings']); |
} |
$('start-stop-sync').onclick = function(event) { |
@@ -252,11 +249,11 @@ cr.define('options', function() { |
} |
// On Startup section. |
- Preferences.getInstance().addEventListener('session.restore_on_startup', |
+ Preferences.getInstance().addEventListener( |
+ 'session.restore_on_startup', |
this.onRestoreOnStartupChanged_.bind(this)); |
Preferences.getInstance().addEventListener( |
- 'session.startup_urls', |
- function(event) { |
+ 'session.startup_urls', function(event) { |
$('startup-set-pages').disabled = event.value.disabled; |
}); |
@@ -265,18 +262,18 @@ cr.define('options', function() { |
}; |
// Appearance section. |
- Preferences.getInstance().addEventListener('browser.show_home_button', |
- this.onShowHomeButtonChanged_.bind(this)); |
+ Preferences.getInstance().addEventListener( |
+ 'browser.show_home_button', this.onShowHomeButtonChanged_.bind(this)); |
- Preferences.getInstance().addEventListener('homepage', |
- this.onHomePageChanged_.bind(this)); |
- Preferences.getInstance().addEventListener('homepage_is_newtabpage', |
- this.onHomePageIsNtpChanged_.bind(this)); |
+ Preferences.getInstance().addEventListener( |
+ 'homepage', this.onHomePageChanged_.bind(this)); |
+ Preferences.getInstance().addEventListener( |
+ 'homepage_is_newtabpage', this.onHomePageIsNtpChanged_.bind(this)); |
$('change-home-page').onclick = function(event) { |
PageManager.showPageByName('homePageOverlay'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_Homepage_ShowSettings']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_Homepage_ShowSettings']); |
}; |
HotwordSearchSettingIndicator.decorate( |
@@ -294,15 +291,15 @@ cr.define('options', function() { |
if ($('set-wallpaper')) { |
$('set-wallpaper').onclick = function(event) { |
chrome.send('openWallpaperManager'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_OpenWallpaperManager']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_OpenWallpaperManager']); |
}; |
} |
// Control the hotword-always-on pref with the Hotword Audio |
// Verification app. |
- $('hotword-always-on-search-checkbox').customChangeHandler = |
- function(event) { |
+ $('hotword-always-on-search-checkbox').customChangeHandler = function( |
+ event) { |
if (!$('hotword-always-on-search-checkbox').checked) |
return false; |
@@ -321,8 +318,7 @@ cr.define('options', function() { |
$('themes-gallery').onclick = function(event) { |
window.open(loadTimeData.getString('themesGalleryURL')); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ThemesGallery']); |
+ chrome.send('coreOptionsUserMetricsAction', ['Options_ThemesGallery']); |
}; |
$('themes-reset').onclick = function(event) { |
chrome.send('themesReset'); |
@@ -347,36 +343,36 @@ cr.define('options', function() { |
if (loadTimeData.getBoolean('showPowerStatus')) { |
$('power-settings-link').onclick = function(evt) { |
PageManager.showPageByName('power-overlay'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ShowPowerSettings']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ShowPowerSettings']); |
}; |
$('power-row').hidden = false; |
} |
$('keyboard-settings-button').onclick = function(evt) { |
PageManager.showPageByName('keyboard-overlay'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ShowKeyboardSettings']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ShowKeyboardSettings']); |
}; |
$('pointer-settings-button').onclick = function(evt) { |
PageManager.showPageByName('pointer-overlay'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ShowTouchpadSettings']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ShowTouchpadSettings']); |
}; |
$('storage-manager-button').onclick = function(evt) { |
PageManager.showPageByName('storage'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ShowStorageManager']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ShowStorageManager']); |
}; |
} |
// Search section. |
$('manage-default-search-engines').onclick = function(event) { |
PageManager.showPageByName('searchEngines'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ManageSearchEngines']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ManageSearchEngines']); |
}; |
- $('default-search-engine').addEventListener('change', |
- this.setDefaultSearchEngine_); |
+ $('default-search-engine') |
+ .addEventListener('change', this.setDefaultSearchEngine_); |
// Users section. |
if (loadTimeData.valueExists('profilesInfo')) { |
@@ -388,27 +384,28 @@ cr.define('options', function() { |
profilesList.autoExpands = true; |
// The profiles info data in |loadTimeData| might be stale. |
- this.setProfilesInfo_(/** @type {!Array<!options.Profile>} */( |
+ this.setProfilesInfo_(/** @type {!Array<!options.Profile>} */ ( |
loadTimeData.getValue('profilesInfo'))); |
chrome.send('requestProfilesInfo'); |
- profilesList.addEventListener('change', |
- this.setProfileViewButtonsStatus_); |
+ profilesList.addEventListener( |
+ 'change', this.setProfileViewButtonsStatus_); |
$('profiles-create').onclick = function(event) { |
- chrome.send('metricsHandler:recordAction', |
- ['Options_ShowCreateProfileDlg']); |
+ chrome.send( |
+ 'metricsHandler:recordAction', ['Options_ShowCreateProfileDlg']); |
ManageProfileOverlay.showCreateDialog(); |
}; |
$('profiles-manage').onclick = function(event) { |
- chrome.send('metricsHandler:recordAction', |
- ['Options_ShowEditProfileDlg']); |
+ chrome.send( |
+ 'metricsHandler:recordAction', ['Options_ShowEditProfileDlg']); |
ManageProfileOverlay.showManageDialog(); |
}; |
$('profiles-delete').onclick = function(event) { |
var selectedProfile = self.getSelectedProfileItem_(); |
if (selectedProfile) { |
- chrome.send('metricsHandler:recordAction', |
- ['Options_ShowDeleteProfileDlg']); |
+ chrome.send( |
+ 'metricsHandler:recordAction', |
+ ['Options_ShowDeleteProfileDlg']); |
ManageProfileOverlay.showDeleteDialog(selectedProfile); |
} |
}; |
@@ -433,8 +430,8 @@ cr.define('options', function() { |
$('manage-accounts-button').onclick = function(event) { |
PageManager.showPageByName('accounts'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ManageAccounts']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ManageAccounts']); |
}; |
if (loadTimeData.getBoolean('showQuickUnlockSettings')) { |
@@ -489,8 +486,8 @@ cr.define('options', function() { |
$('privacyContentSettingsButton').onclick = function(event) { |
PageManager.showPageByName('content'); |
OptionsPage.showTab($('cookies-nav-tab')); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ContentSettings']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ContentSettings']); |
}; |
$('privacyClearDataButton').onclick = function(event) { |
PageManager.showPageByName('clearBrowserData'); |
@@ -506,20 +503,22 @@ cr.define('options', function() { |
// Crashpad, used on Mac, does not require a browser restart. |
var togglingMetricsRequiresRestart = !cr.isMac && !cr.isChromeOS; |
$('metrics-reporting-enabled').onclick = function(event) { |
- chrome.send('metricsReportingCheckboxChanged', |
+ chrome.send( |
+ 'metricsReportingCheckboxChanged', |
[Boolean(event.currentTarget.checked)]); |
if (cr.isChromeOS) { |
// 'metricsReportingEnabled' element is only present on Chrome |
// branded builds, and the 'metricsReportingCheckboxAction' message |
// is only handled on ChromeOS. |
- chrome.send('metricsReportingCheckboxAction', |
+ chrome.send( |
+ 'metricsReportingCheckboxAction', |
[String(event.currentTarget.checked)]); |
} |
if (togglingMetricsRequiresRestart) { |
$('metrics-reporting-reset-restart').hidden = |
loadTimeData.getBoolean('metricsReportingEnabledAtStart') == |
- $('metrics-reporting-enabled').checked; |
+ $('metrics-reporting-enabled').checked; |
} |
}; |
@@ -545,15 +544,12 @@ cr.define('options', function() { |
} |
} |
$('networkPredictionOptions').onchange = function(event) { |
- var value = (event.target.checked ? |
- NetworkPredictionOptions.WIFI_ONLY : |
- NetworkPredictionOptions.NEVER); |
+ var value = |
+ (event.target.checked ? NetworkPredictionOptions.WIFI_ONLY : |
+ NetworkPredictionOptions.NEVER); |
var metric = event.target.metric; |
Preferences.setIntegerPref( |
- 'net.network_prediction_options', |
- value, |
- true, |
- metric); |
+ 'net.network_prediction_options', value, true, metric); |
}; |
if (loadTimeData.valueExists('showWakeOnWifi') && |
loadTimeData.getBoolean('showWakeOnWifi')) { |
@@ -590,38 +586,40 @@ cr.define('options', function() { |
var state = $('enable-bluetooth').checked; |
chrome.bluetoothPrivate.setAdapterState({powered: state}, function() { |
if (chrome.runtime.lastError) { |
- console.error('Error enabling bluetooth:', |
- chrome.runtime.lastError.message); |
+ console.error( |
+ 'Error enabling bluetooth:', |
+ chrome.runtime.lastError.message); |
} |
}); |
}; |
$('bluetooth-reconnect-device').onclick = function(event) { |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_BluetoothConnectPairedDevice']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', |
+ ['Options_BluetoothConnectPairedDevice']); |
var device = $('bluetooth-paired-devices-list').selectedItem; |
BluetoothPairing.connect(device); |
}; |
- $('bluetooth-paired-devices-list').addEventListener('change', |
- function() { |
- var item = $('bluetooth-paired-devices-list').selectedItem; |
- var disabled = !item || item.connected || !item.connectable; |
- $('bluetooth-reconnect-device').disabled = disabled; |
- }); |
+ $('bluetooth-paired-devices-list') |
+ .addEventListener('change', function() { |
+ var item = $('bluetooth-paired-devices-list').selectedItem; |
+ var disabled = !item || item.connected || !item.connectable; |
+ $('bluetooth-reconnect-device').disabled = disabled; |
+ }); |
} |
// Passwords and Forms section. |
$('autofill-settings').onclick = function(event) { |
PageManager.showPageByName('autofill'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ShowAutofillSettings']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ShowAutofillSettings']); |
}; |
$('manage-passwords').onclick = function(event) { |
PageManager.showPageByName('passwords'); |
OptionsPage.showTab($('passwords-nav-tab')); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ShowPasswordManager']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ShowPasswordManager']); |
}; |
if (cr.isChromeOS && UIAccountTweaks.loggedInAsGuest()) { |
// Disable and turn off Autofill in guest mode. |
@@ -667,36 +665,39 @@ cr.define('options', function() { |
// Web Content section. |
$('fontSettingsCustomizeFontsButton').onclick = function(event) { |
PageManager.showPageByName('fonts'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ShowFontSettings']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_ShowFontSettings']); |
}; |
$('defaultFontSize').onchange = function(event) { |
var value = event.target.options[event.target.selectedIndex].value; |
Preferences.setIntegerPref( |
- 'webkit.webprefs.default_fixed_font_size', |
- value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, true); |
+ 'webkit.webprefs.default_fixed_font_size', |
+ value - OptionsPage.SIZE_DIFFERENCE_FIXED_STANDARD, true); |
chrome.send('defaultFontSizeAction', [String(value)]); |
}; |
$('defaultZoomFactor').onchange = function(event) { |
- chrome.send('defaultZoomFactorAction', |
+ chrome.send( |
+ 'defaultZoomFactorAction', |
[String(event.target.options[event.target.selectedIndex].value)]); |
}; |
$('safeBrowsingExtendedReportingCheckbox').onchange = function(event) { |
- chrome.send('safeBrowsingExtendedReportingAction', |
- [event.target.checked]); |
+ chrome.send( |
+ 'safeBrowsingExtendedReportingAction', [event.target.checked]); |
}; |
// Languages section. |
var showLanguageOptions = function(event) { |
PageManager.showPageByName('languages'); |
- chrome.send('coreOptionsUserMetricsAction', |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', |
['Options_LanuageAndSpellCheckSettings']); |
}; |
$('language-button').onclick = showLanguageOptions; |
$('manage-languages').onclick = showLanguageOptions; |
// Downloads section. |
- Preferences.getInstance().addEventListener('download.default_directory', |
+ Preferences.getInstance().addEventListener( |
+ 'download.default_directory', |
this.onDefaultDownloadDirectoryChanged_.bind(this)); |
$('downloadLocationChangeButton').onclick = function(event) { |
chrome.send('selectDownloadLocation'); |
@@ -717,8 +718,9 @@ cr.define('options', function() { |
} else { |
$('certificatesManageButton').onclick = function(event) { |
PageManager.showPageByName('certificates'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_ManageSSLCertificates']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', |
+ ['Options_ManageSSLCertificates']); |
}; |
} |
@@ -746,11 +748,11 @@ cr.define('options', function() { |
!($('accessibility-spoken-feedback-check').checked); |
}; |
Preferences.getInstance().addEventListener( |
- 'settings.accessibility', |
- updateAccessibilitySettingsSection); |
+ 'settings.accessibility', updateAccessibilitySettingsSection); |
$('accessibility-learn-more').onclick = function(unused_event) { |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_AccessibilityLearnMore']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', |
+ ['Options_AccessibilityLearnMore']); |
}; |
$('accessibility-settings-button').onclick = function(unused_event) { |
window.open(loadTimeData.getString('accessibilitySettingsURL')); |
@@ -785,8 +787,7 @@ cr.define('options', function() { |
if (cr.isChromeOS) { |
$('display-options').onclick = function(event) { |
PageManager.showPageByName('display'); |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_Display']); |
+ chrome.send('coreOptionsUserMetricsAction', ['Options_Display']); |
}; |
} |
@@ -819,33 +820,28 @@ cr.define('options', function() { |
// We use the hash to indicate the source of the reset request. The hash |
// is removed by the reset profile settings overlay once it has been |
// consumed. |
- PageManager.showPageByName('resetProfileSettings', true, |
- {hash: '#userclick'}); |
+ PageManager.showPageByName( |
+ 'resetProfileSettings', true, {hash: '#userclick'}); |
}; |
// Extension controlled UI. |
- this.addExtensionControlledBox_('search-section-content', |
- 'search-engine-controlled', |
- true); |
- this.addExtensionControlledBox_('extension-controlled-container', |
- 'homepage-controlled', |
- true); |
- this.addExtensionControlledBox_('startup-section-content', |
- 'startpage-controlled', |
- false); |
- this.addExtensionControlledBox_('newtab-section-content', |
- 'newtab-controlled', |
- false); |
- this.addExtensionControlledBox_('proxy-section-content', |
- 'proxy-controlled', |
- true); |
+ this.addExtensionControlledBox_( |
+ 'search-section-content', 'search-engine-controlled', true); |
+ this.addExtensionControlledBox_( |
+ 'extension-controlled-container', 'homepage-controlled', true); |
+ this.addExtensionControlledBox_( |
+ 'startup-section-content', 'startpage-controlled', false); |
+ this.addExtensionControlledBox_( |
+ 'newtab-section-content', 'newtab-controlled', false); |
+ this.addExtensionControlledBox_( |
+ 'proxy-section-content', 'proxy-controlled', true); |
document.body.addEventListener('click', function(e) { |
var target = assertInstanceof(e.target, Node); |
var button = findAncestor(target, function(el) { |
return el.tagName == 'BUTTON' && |
- el.dataset.extensionId !== undefined && |
- el.dataset.extensionId.length; |
+ el.dataset.extensionId !== undefined && |
+ el.dataset.extensionId.length; |
}); |
if (button) |
chrome.send('disableExtension', [button.dataset.extensionId]); |
@@ -867,10 +863,10 @@ cr.define('options', function() { |
}); |
$('android-apps-settings-link').addEventListener('click', function(e) { |
- // MouseEvent.detail indicates the current click count (or tap |
- // count, in the case of touch events) in the 'click' event. |
- var activatedFromKeyboard = e.detail == 0; |
- chrome.send('showAndroidAppsSettings', [activatedFromKeyboard]); |
+ // MouseEvent.detail indicates the current click count (or tap |
+ // count, in the case of touch events) in the 'click' event. |
+ var activatedFromKeyboard = e.detail == 0; |
+ chrome.send('showAndroidAppsSettings', [activatedFromKeyboard]); |
}); |
} |
}, |
@@ -880,11 +876,11 @@ cr.define('options', function() { |
$('search-field').focus(); |
}, |
- /** |
- * Called after all C++ UI handlers have called InitializePage to notify |
- * that initialization is complete. |
- * @private |
- */ |
+ /** |
+ * Called after all C++ UI handlers have called InitializePage to notify |
+ * that initialization is complete. |
+ * @private |
+ */ |
notifyInitializationComplete_: function() { |
this.initializationComplete_ = true; |
cr.dispatchSimpleEvent(document, 'initializationComplete'); |
@@ -921,7 +917,7 @@ cr.define('options', function() { |
* @private |
*/ |
handleWindowMessage_: function(e) { |
- if ((/** @type {{method: string}} */(e.data)).method == 'frameSelected') |
+ if ((/** @type {{method: string}} */ (e.data)).method == 'frameSelected') |
$('search-field').focus(); |
}, |
@@ -1023,20 +1019,19 @@ cr.define('options', function() { |
var advancedSettings = $('advanced-settings'); |
var container = $('advanced-settings-container'); |
var expander = $('advanced-settings-expander'); |
- if (!expander.hidden && |
- advancedSettings.hidden && |
+ if (!expander.hidden && advancedSettings.hidden && |
section.parentNode == container) { |
- this.showSection_($('advanced-settings'), |
- $('advanced-settings-container'), |
- /* animate */ false); |
+ this.showSection_( |
+ $('advanced-settings'), $('advanced-settings-container'), |
+ /* animate */ false); |
this.updateAdvancedSettingsExpander_(); |
} |
if (!this.initializationComplete_) { |
var self = this; |
var callback = function() { |
- document.removeEventListener('initializationComplete', callback); |
- self.scrollToSection_(section); |
+ document.removeEventListener('initializationComplete', callback); |
+ self.scrollToSection_(section); |
}; |
document.addEventListener('initializationComplete', callback); |
return; |
@@ -1071,8 +1066,8 @@ cr.define('options', function() { |
if (section.hasTransitionEndListener_) |
return; |
- section.addEventListener('transitionend', |
- this.onTransitionEnd_.bind(this)); |
+ section.addEventListener( |
+ 'transitionend', this.onTransitionEnd_.bind(this)); |
section.hasTransitionEndListener_ = true; |
}, |
@@ -1165,9 +1160,8 @@ cr.define('options', function() { |
// not managed/disabled. If the user is signed in, but sync is disabled, |
// this button is used to re-enable sync. |
var customizeSyncButton = $('customize-sync'); |
- customizeSyncButton.hidden = !this.signedIn_ || |
- syncData.managed || |
- !syncData.syncSystemEnabled; |
+ customizeSyncButton.hidden = |
+ !this.signedIn_ || syncData.managed || !syncData.syncSystemEnabled; |
// Only modify the customize button's text if the new text is different. |
// Otherwise, it can affect search-highlighting in the settings page. |
@@ -1193,12 +1187,11 @@ cr.define('options', function() { |
// status). |
signInButton.hidden = cr.isChromeOS || syncData.supervisedUser; |
- signInButton.textContent = |
- this.signedIn_ ? |
- loadTimeData.getString('syncButtonTextStop') : |
- syncData.setupInProgress ? |
- loadTimeData.getString('syncButtonTextInProgress') : |
- loadTimeData.getString('syncButtonTextSignIn'); |
+ signInButton.textContent = this.signedIn_ ? |
+ loadTimeData.getString('syncButtonTextStop') : |
+ syncData.setupInProgress ? |
+ loadTimeData.getString('syncButtonTextInProgress') : |
+ loadTimeData.getString('syncButtonTextSignIn'); |
$('start-stop-sync-indicator').hidden = signInButton.hidden; |
$('account-info').textContent = syncData.accountInfo; |
@@ -1207,16 +1200,15 @@ cr.define('options', function() { |
// TODO(estade): can this just be textContent? |
$('sync-status-text').innerHTML = syncData.statusText; |
var statusSet = syncData.statusText.length != 0; |
- $('sync-overview').hidden = |
- statusSet || |
+ $('sync-overview').hidden = statusSet || |
(cr.isChromeOS && UIAccountTweaks.loggedInAsPublicAccount()); |
$('sync-status').hidden = !statusSet; |
$('sync-action-link').textContent = syncData.actionLinkText; |
// Don't show the action link if it is empty or undefined. |
$('sync-action-link').hidden = syncData.actionLinkText.length == 0; |
- $('sync-action-link').disabled = syncData.managed || |
- !syncData.syncSystemEnabled; |
+ $('sync-action-link').disabled = |
+ syncData.managed || !syncData.syncSystemEnabled; |
$('sync-action-link').onclick = function(event) { |
switch (syncData.statusAction) { |
@@ -1224,12 +1216,12 @@ cr.define('options', function() { |
SyncSetupOverlay.startSignIn(false /* creatingSupervisedUser */); |
break; |
case 'signOutAndSignIn': |
-// <if expr="chromeos"> |
+ // <if expr="chromeos"> |
// On Chrome OS, sign out the user and sign in again to get fresh |
// credentials on auth errors. |
SyncSetupOverlay.doSignOutOnAuthError(); |
-// </if> |
-// <if expr="not chromeos"> |
+ // </if> |
+ // <if expr="not chromeos"> |
if (syncData.signoutAllowed) { |
// Silently sign the user out without deleting their profile and |
// prompt them to sign back in. |
@@ -1238,7 +1230,7 @@ cr.define('options', function() { |
} else { |
chrome.send('showDisconnectManagedProfileDialog'); |
} |
-// </if> |
+ // </if> |
break; |
case 'upgradeClient': |
PageManager.showPageByName('help'); |
@@ -1257,8 +1249,7 @@ cr.define('options', function() { |
// unrecoverable error. Also disable the button if sync has not been set |
// up and the user is being presented with a link to re-auth. |
// See crbug.com/289791. |
- customizeSyncButton.disabled = |
- syncData.hasUnrecoverableError || |
+ customizeSyncButton.disabled = syncData.hasUnrecoverableError || |
(!syncData.setupCompleted && !$('sync-action-link').hidden); |
}, |
@@ -1323,8 +1314,8 @@ cr.define('options', function() { |
* @param {string=} opt_error The error message to display. |
* @private |
*/ |
- showHotwordCheckboxAndIndicator_: function(sectionId, indicatorId, |
- opt_error) { |
+ showHotwordCheckboxAndIndicator_: function( |
+ sectionId, indicatorId, opt_error) { |
$(sectionId).hidden = false; |
$(indicatorId).setError(opt_error); |
if (opt_error) |
@@ -1338,9 +1329,7 @@ cr.define('options', function() { |
*/ |
showHotwordSection_: function(opt_error) { |
this.showHotwordCheckboxAndIndicator_( |
- 'hotword-search', |
- 'hotword-search-setting-indicator', |
- opt_error); |
+ 'hotword-search', 'hotword-search-setting-indicator', opt_error); |
}, |
/** |
@@ -1352,8 +1341,7 @@ cr.define('options', function() { |
showHotwordAlwaysOnSection_: function(opt_error) { |
this.showHotwordCheckboxAndIndicator_( |
'hotword-always-on-search', |
- 'hotword-always-on-search-setting-indicator', |
- opt_error); |
+ 'hotword-always-on-search-setting-indicator', opt_error); |
}, |
/** |
@@ -1364,8 +1352,7 @@ cr.define('options', function() { |
*/ |
showHotwordNoDspSection_: function(opt_error) { |
this.showHotwordCheckboxAndIndicator_( |
- 'hotword-no-dsp-search', |
- 'hotword-no-dsp-search-setting-indicator', |
+ 'hotword-no-dsp-search', 'hotword-no-dsp-search-setting-indicator', |
opt_error); |
}, |
@@ -1472,8 +1459,8 @@ cr.define('options', function() { |
path = path.replace(/\//g, ' \u203a '); |
$('downloadLocationPath').value = path; |
} |
- $('download-location-label').classList.toggle('disabled', |
- event.value.disabled); |
+ $('download-location-label') |
+ .classList.toggle('disabled', event.value.disabled); |
$('downloadLocationChangeButton').disabled = event.value.disabled; |
}, |
@@ -1485,8 +1472,8 @@ cr.define('options', function() { |
* @param {boolean} canBeDefault Whether or not the browser can be default. |
* @private |
*/ |
- updateDefaultBrowserState_: function(statusString, isDefault, |
- canBeDefault) { |
+ updateDefaultBrowserState_: function( |
+ statusString, isDefault, canBeDefault) { |
if (!cr.isChromeOS) { |
var label = $('default-browser-state'); |
label.textContent = statusString; |
@@ -1572,18 +1559,18 @@ cr.define('options', function() { |
var selectedProfile = profilesList.selectedItem; |
var hasSelection = selectedProfile != null; |
var hasSingleProfile = profilesList.dataModel.length == 1; |
- $('profiles-manage').disabled = !hasSelection || |
- !selectedProfile.isCurrentProfile; |
+ $('profiles-manage').disabled = |
+ !hasSelection || !selectedProfile.isCurrentProfile; |
if (hasSelection && !selectedProfile.isCurrentProfile) |
$('profiles-manage').title = loadTimeData.getString('currentUserOnly'); |
else |
$('profiles-manage').title = ''; |
- $('profiles-delete').disabled = !profilesList.canDeleteItems || |
- !hasSelection; |
+ $('profiles-delete').disabled = |
+ !profilesList.canDeleteItems || !hasSelection; |
var importData = $('import-data'); |
if (importData) { |
- importData.disabled = $('import-data').disabled = hasSelection && |
- !selectedProfile.isCurrentProfile; |
+ importData.disabled = $('import-data').disabled = |
+ hasSelection && !selectedProfile.isCurrentProfile; |
} |
}, |
@@ -1657,24 +1644,24 @@ cr.define('options', function() { |
}, |
/** |
- * Sends a warning message to the "create" overlay during profile creation. |
- * @param {string} warning The warning message to display. |
- * @private |
- */ |
+ * Sends a warning message to the "create" overlay during profile creation. |
+ * @param {string} warning The warning message to display. |
+ * @private |
+ */ |
showCreateProfileWarning_: function(warning) { |
CreateProfileOverlay.onWarning(warning); |
}, |
/** |
- * Reports successful profile creation to the "create" overlay. |
+ * Reports successful profile creation to the "create" overlay. |
* @param {options.Profile} profileInfo An object of the form: |
* profileInfo = { |
* name: "Profile Name", |
* filePath: "/path/to/profile/data/on/disk" |
* isSupervised: (true|false), |
* }; |
- * @private |
- */ |
+ * @private |
+ */ |
showCreateProfileSuccess_: function(profileInfo) { |
CreateProfileOverlay.onSuccess(profileInfo); |
}, |
@@ -1735,7 +1722,7 @@ cr.define('options', function() { |
// CoreOptionsHandler::CreateValueForPref() does. |
var event = new Event('account-picture'); |
if (managed) |
- event.value = { controlledBy: 'policy' }; |
+ event.value = {controlledBy: 'policy'}; |
else |
event.value = {}; |
$('account-picture-indicator').handlePrefChange(event); |
@@ -1748,8 +1735,8 @@ cr.define('options', function() { |
updateAccountPicture_: function() { |
var picture = $('account-picture'); |
if (picture) { |
- picture.src = 'chrome://userimage/' + this.username_ + '?id=' + |
- Date.now(); |
+ picture.src = |
+ 'chrome://userimage/' + this.username_ + '?id=' + Date.now(); |
} |
}, |
@@ -1765,7 +1752,7 @@ cr.define('options', function() { |
// Create a synthetic pref change event decorated as |
// CoreOptionsHandler::CreateValueForPref() does. |
var event = new Event('wallpaper'); |
- event.value = managed ? { controlledBy: 'policy' } : {}; |
+ event.value = managed ? {controlledBy: 'policy'} : {}; |
$('wallpaper-indicator').handlePrefChange(event); |
}, |
@@ -1775,8 +1762,7 @@ cr.define('options', function() { |
*/ |
updateTimezoneSectionState_: function() { |
var self = this; |
- $('resolve-timezone-by-geolocation') |
- .onclick = function(event) { |
+ $('resolve-timezone-by-geolocation').onclick = function(event) { |
self.resolveTimezoneByGeolocation_ = event.currentTarget.checked; |
}; |
if (this.systemTimezoneIsManaged_) { |
@@ -1786,14 +1772,13 @@ cr.define('options', function() { |
if (this.systemTimezoneAutomaticDetectionValue_ == |
options.AutomaticTimezoneDetectionType.USERS_DECIDE) { |
$('resolve-timezone-by-geolocation').disabled = false; |
- $('resolve-timezone-by-geolocation') |
- .checked = this.resolveTimezoneByGeolocation_; |
- $('timezone-value-select') |
- .disabled = this.resolveTimezoneByGeolocation_; |
+ $('resolve-timezone-by-geolocation').checked = |
+ this.resolveTimezoneByGeolocation_; |
+ $('timezone-value-select').disabled = |
+ this.resolveTimezoneByGeolocation_; |
} else { |
$('resolve-timezone-by-geolocation').disabled = true; |
- $('resolve-timezone-by-geolocation') |
- .checked = |
+ $('resolve-timezone-by-geolocation').checked = |
(this.systemTimezoneAutomaticDetectionValue_ != |
options.AutomaticTimezoneDetectionType.DISABLED); |
$('timezone-value-select').disabled = true; |
@@ -1803,8 +1788,8 @@ cr.define('options', function() { |
getRequiredElement('resolve-timezone-by-geolocation')); |
$('timezone-value-select').disabled = |
this.resolveTimezoneByGeolocation_; |
- $('resolve-timezone-by-geolocation') |
- .checked = this.resolveTimezoneByGeolocation_; |
+ $('resolve-timezone-by-geolocation').checked = |
+ this.resolveTimezoneByGeolocation_; |
} |
}, |
@@ -1864,8 +1849,8 @@ cr.define('options', function() { |
* @private |
*/ |
handleAddBluetoothDevice_: function() { |
- chrome.send('coreOptionsUserMetricsAction', |
- ['Options_BluetoothShowAddDevice']); |
+ chrome.send( |
+ 'coreOptionsUserMetricsAction', ['Options_BluetoothShowAddDevice']); |
PageManager.showPageByName('bluetooth', false); |
}, |
@@ -1905,20 +1890,19 @@ cr.define('options', function() { |
* Set the checked state of the metrics reporting checkbox. |
* @private |
*/ |
- setMetricsReportingCheckboxState_: function(checked, |
- policyManaged, |
- ownerManaged) { |
+ setMetricsReportingCheckboxState_: function( |
+ checked, policyManaged, ownerManaged) { |
$('metrics-reporting-enabled').checked = checked; |
$('metrics-reporting-enabled').disabled = policyManaged || ownerManaged; |
// If checkbox gets disabled then add an attribute for displaying the |
// special icon. Otherwise remove the indicator attribute. |
if (policyManaged) { |
- $('metrics-reporting-disabled-icon').setAttribute('controlled-by', |
- 'policy'); |
+ $('metrics-reporting-disabled-icon') |
+ .setAttribute('controlled-by', 'policy'); |
} else if (ownerManaged) { |
- $('metrics-reporting-disabled-icon').setAttribute('controlled-by', |
- 'owner'); |
+ $('metrics-reporting-disabled-icon') |
+ .setAttribute('controlled-by', 'owner'); |
} else { |
$('metrics-reporting-disabled-icon').removeAttribute('controlled-by'); |
} |
@@ -1936,10 +1920,10 @@ cr.define('options', function() { |
}, |
/** |
- * Set the checked state of the Safe Browsing Extended Reporting Enabled |
- * checkbox. |
- * @private |
- */ |
+ * Set the checked state of the Safe Browsing Extended Reporting Enabled |
+ * checkbox. |
+ * @private |
+ */ |
setExtendedReportingEnabledCheckboxState_: function(checked) { |
$('safeBrowsingExtendedReportingCheckbox').checked = checked; |
}, |
@@ -1955,8 +1939,8 @@ cr.define('options', function() { |
*/ |
setNetworkPredictionValue_: function(pref) { |
var checkbox = $('networkPredictionOptions'); |
- checkbox.disabled = pref.disabled || |
- loadTimeData.getBoolean('profileIsGuest'); |
+ checkbox.disabled = |
+ pref.disabled || loadTimeData.getBoolean('profileIsGuest'); |
checkbox.checked = (pref.value != NetworkPredictionOptions.NEVER); |
}, |
@@ -1973,7 +1957,7 @@ cr.define('options', function() { |
* @private |
*/ |
setFontSize_: function(pref) { |
- var selectCtl = /** @type {HTMLSelectElement} */($('defaultFontSize')); |
+ var selectCtl = /** @type {HTMLSelectElement} */ ($('defaultFontSize')); |
selectCtl.disabled = pref.disabled; |
// Create a synthetic pref change event decorated as |
// CoreOptionsHandler::CreateValueForPref() does. |
@@ -1996,8 +1980,8 @@ cr.define('options', function() { |
// Add/Select Custom Option in the font size label list. |
if (!$('Custom')) { |
- var option = new Option(loadTimeData.getString('fontSizeLabelCustom'), |
- -1, false, true); |
+ var option = new Option( |
+ loadTimeData.getString('fontSizeLabelCustom'), -1, false, true); |
option.setAttribute('id', 'Custom'); |
selectCtl.add(option); |
} |
@@ -2063,9 +2047,9 @@ cr.define('options', function() { |
setupProxySettingsButton_: function(disabled, extensionControlled) { |
if (!cr.isChromeOS) { |
$('proxiesConfigureButton').disabled = disabled; |
- $('proxiesLabel').textContent = |
- loadTimeData.getString(extensionControlled ? |
- 'proxiesLabelExtension' : 'proxiesLabelSystem'); |
+ $('proxiesLabel').textContent = loadTimeData.getString( |
+ extensionControlled ? 'proxiesLabelExtension' : |
+ 'proxiesLabelSystem'); |
} |
}, |
@@ -2163,26 +2147,21 @@ cr.define('options', function() { |
* @private |
*/ |
toggleExtensionIndicators_: function(details) { |
- this.toggleExtensionControlledBox_('search-section-content', |
- 'search-engine-controlled', |
- details.searchEngine.id, |
- details.searchEngine.name); |
- this.toggleExtensionControlledBox_('extension-controlled-container', |
- 'homepage-controlled', |
- details.homePage.id, |
- details.homePage.name); |
- this.toggleExtensionControlledBox_('startup-section-content', |
- 'startpage-controlled', |
- details.startUpPage.id, |
- details.startUpPage.name); |
- this.toggleExtensionControlledBox_('newtab-section-content', |
- 'newtab-controlled', |
- details.newTabPage.id, |
- details.newTabPage.name); |
- this.toggleExtensionControlledBox_('proxy-section-content', |
- 'proxy-controlled', |
- details.proxy.id, |
- details.proxy.name); |
+ this.toggleExtensionControlledBox_( |
+ 'search-section-content', 'search-engine-controlled', |
+ details.searchEngine.id, details.searchEngine.name); |
+ this.toggleExtensionControlledBox_( |
+ 'extension-controlled-container', 'homepage-controlled', |
+ details.homePage.id, details.homePage.name); |
+ this.toggleExtensionControlledBox_( |
+ 'startup-section-content', 'startpage-controlled', |
+ details.startUpPage.id, details.startUpPage.name); |
+ this.toggleExtensionControlledBox_( |
+ 'newtab-section-content', 'newtab-controlled', details.newTabPage.id, |
+ details.newTabPage.name); |
+ this.toggleExtensionControlledBox_( |
+ 'proxy-section-content', 'proxy-controlled', details.proxy.id, |
+ details.proxy.name); |
// The proxy section contains just the warning box and nothing else, so |
// if we're hiding the proxy warning box, we should also hide its header |
@@ -2358,8 +2337,7 @@ cr.define('options', function() { |
* @private |
*/ |
maybeShowUserSection_: function() { |
- $('sync-users-section').hidden = |
- $('profiles-section').hidden && |
+ $('sync-users-section').hidden = $('profiles-section').hidden && |
$('sync-section').hidden && |
$('profiles-supervised-dashboard-tip').hidden; |
}, |
@@ -2485,7 +2463,5 @@ cr.define('options', function() { |
} |
// Export |
- return { |
- BrowserOptions: BrowserOptions |
- }; |
+ return {BrowserOptions: BrowserOptions}; |
}); |