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 * hasError: (boolean|undefined), | 9 * hasError: (boolean|undefined), |
10 * hasUnrecoverableError: (boolean|undefined), | 10 * hasUnrecoverableError: (boolean|undefined), |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 $('themes-native-button').disabled = true; | 262 $('themes-native-button').disabled = true; |
263 $('themes-native-button').hidden = true; | 263 $('themes-native-button').hidden = true; |
264 } | 264 } |
265 // Supervised users have just one default theme, even on Linux. So use | 265 // Supervised users have just one default theme, even on Linux. So use |
266 // the same button for Linux as for the other platforms. | 266 // the same button for Linux as for the other platforms. |
267 $('themes-reset').textContent = loadTimeData.getString('themesReset'); | 267 $('themes-reset').textContent = loadTimeData.getString('themesReset'); |
268 } | 268 } |
269 | 269 |
270 // Device section (ChromeOS only). | 270 // Device section (ChromeOS only). |
271 if (cr.isChromeOS) { | 271 if (cr.isChromeOS) { |
| 272 $('power-settings-button').onclick = function(evt) { |
| 273 PageManager.showPageByName('power-overlay'); |
| 274 chrome.send('coreOptionsUserMetricsAction', |
| 275 ['Options_ShowPowerSettings']); |
| 276 }; |
272 $('battery-button').onclick = function(evt) { | 277 $('battery-button').onclick = function(evt) { |
273 WebsiteSettingsManager.showWebsiteSettings('battery'); | 278 WebsiteSettingsManager.showWebsiteSettings('battery'); |
274 }; | 279 }; |
275 $('stored-data-button').onclick = function(evt) { | 280 $('stored-data-button').onclick = function(evt) { |
276 WebsiteSettingsManager.showWebsiteSettings('storage'); | 281 WebsiteSettingsManager.showWebsiteSettings('storage'); |
277 }; | 282 }; |
278 $('keyboard-settings-button').onclick = function(evt) { | 283 $('keyboard-settings-button').onclick = function(evt) { |
279 PageManager.showPageByName('keyboard-overlay'); | 284 PageManager.showPageByName('keyboard-overlay'); |
280 chrome.send('coreOptionsUserMetricsAction', | 285 chrome.send('coreOptionsUserMetricsAction', |
281 ['Options_ShowKeyboardSettings']); | 286 ['Options_ShowKeyboardSettings']); |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 * Enables the given element if possible; on Chrome OS, it won't enable | 1977 * Enables the given element if possible; on Chrome OS, it won't enable |
1973 * an element that must stay disabled for the session type. | 1978 * an element that must stay disabled for the session type. |
1974 * @param {!Element} element Element to enable. | 1979 * @param {!Element} element Element to enable. |
1975 */ | 1980 */ |
1976 enableElementIfPossible_: function(element) { | 1981 enableElementIfPossible_: function(element) { |
1977 if (cr.isChromeOS) | 1982 if (cr.isChromeOS) |
1978 UIAccountTweaks.enableElementIfPossible(element); | 1983 UIAccountTweaks.enableElementIfPossible(element); |
1979 else | 1984 else |
1980 element.disabled = false; | 1985 element.disabled = false; |
1981 }, | 1986 }, |
| 1987 |
| 1988 /** |
| 1989 * Sets the icon in the battery section. |
| 1990 * @param {string} iconData The data representing the icon to display. |
| 1991 * @private |
| 1992 */ |
| 1993 setBatteryIcon_: function(iconData) { |
| 1994 $('battery-icon').style.backgroundImage = 'url(' + iconData + ')'; |
| 1995 $('battery-icon').hidden = false; |
| 1996 }, |
| 1997 |
| 1998 /** |
| 1999 * Sets the text for the battery section. |
| 2000 * @param {string} statusText The battery status, with a relevant label. |
| 2001 * @private |
| 2002 */ |
| 2003 setBatteryStatusText_: function(statusText) { |
| 2004 $('battery').hidden = !statusText.length; |
| 2005 if (statusText.length) { |
| 2006 $('battery-status').textContent = statusText; |
| 2007 chrome.send('requestBatteryIcon'); |
| 2008 } |
| 2009 }, |
1982 }; | 2010 }; |
1983 | 2011 |
1984 //Forward public APIs to private implementations. | 2012 //Forward public APIs to private implementations. |
1985 cr.makePublic(BrowserOptions, [ | 2013 cr.makePublic(BrowserOptions, [ |
1986 'addBluetoothDevice', | 2014 'addBluetoothDevice', |
1987 'deleteCurrentProfile', | 2015 'deleteCurrentProfile', |
1988 'enableCertificateButton', | 2016 'enableCertificateButton', |
1989 'enableDisplayButton', | 2017 'enableDisplayButton', |
1990 'enableFactoryResetSection', | 2018 'enableFactoryResetSection', |
1991 'getCurrentProfile', | 2019 'getCurrentProfile', |
1992 'getStartStopSyncButton', | 2020 'getStartStopSyncButton', |
1993 'hideBluetoothSettings', | 2021 'hideBluetoothSettings', |
1994 'notifyInitializationComplete', | 2022 'notifyInitializationComplete', |
1995 'removeBluetoothDevice', | 2023 'removeBluetoothDevice', |
1996 'scrollToSection', | 2024 'scrollToSection', |
1997 'setAccountPictureManaged', | 2025 'setAccountPictureManaged', |
1998 'setWallpaperManaged', | 2026 'setWallpaperManaged', |
1999 'setAutoOpenFileTypesDisplayed', | 2027 'setAutoOpenFileTypesDisplayed', |
| 2028 'setBatteryIcon', |
| 2029 'setBatteryStatusText', |
2000 'setBluetoothState', | 2030 'setBluetoothState', |
2001 'setCanSetTime', | 2031 'setCanSetTime', |
2002 'setFontSize', | 2032 'setFontSize', |
2003 'setNativeThemeButtonEnabled', | 2033 'setNativeThemeButtonEnabled', |
2004 'setNetworkPredictionValue', | 2034 'setNetworkPredictionValue', |
2005 'setHighContrastCheckboxState', | 2035 'setHighContrastCheckboxState', |
2006 'setMetricsReportingCheckboxState', | 2036 'setMetricsReportingCheckboxState', |
2007 'setMetricsReportingSettingVisibility', | 2037 'setMetricsReportingSettingVisibility', |
2008 'setProfilesInfo', | 2038 'setProfilesInfo', |
2009 'setSpokenFeedbackCheckboxState', | 2039 'setSpokenFeedbackCheckboxState', |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 } | 2107 } |
2078 button.textContent = loadTimeData.getString(strId); | 2108 button.textContent = loadTimeData.getString(strId); |
2079 }; | 2109 }; |
2080 } | 2110 } |
2081 | 2111 |
2082 // Export | 2112 // Export |
2083 return { | 2113 return { |
2084 BrowserOptions: BrowserOptions | 2114 BrowserOptions: BrowserOptions |
2085 }; | 2115 }; |
2086 }); | 2116 }); |
OLD | NEW |