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 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 if (picture) { | 1501 if (picture) { |
1502 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + | 1502 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + |
1503 Date.now(); | 1503 Date.now(); |
1504 } | 1504 } |
1505 }, | 1505 }, |
1506 | 1506 |
1507 /** | 1507 /** |
1508 * @param {boolean} managed | 1508 * @param {boolean} managed |
1509 */ | 1509 */ |
1510 setWallpaperManaged_: function(managed) { | 1510 setWallpaperManaged_: function(managed) { |
1511 var button = $('set-wallpaper'); | 1511 if (managed) |
1512 button.disabled = !!managed; | 1512 $('set-wallpaper').disabled = true; |
| 1513 else |
| 1514 this.enableElementIfPossible_($('set-wallpaper')); |
1513 | 1515 |
1514 // Create a synthetic pref change event decorated as | 1516 // Create a synthetic pref change event decorated as |
1515 // CoreOptionsHandler::CreateValueForPref() does. | 1517 // CoreOptionsHandler::CreateValueForPref() does. |
1516 var event = new Event('wallpaper'); | 1518 var event = new Event('wallpaper'); |
1517 if (managed) | 1519 event.value = managed ? { controlledBy: 'policy' } : {}; |
1518 event.value = { controlledBy: 'policy' }; | |
1519 else | |
1520 event.value = {}; | |
1521 $('wallpaper-indicator').handlePrefChange(event); | 1520 $('wallpaper-indicator').handlePrefChange(event); |
1522 }, | 1521 }, |
1523 | 1522 |
1524 /** | 1523 /** |
1525 * Handle the 'add device' button click. | 1524 * Handle the 'add device' button click. |
1526 * @private | 1525 * @private |
1527 */ | 1526 */ |
1528 handleAddBluetoothDevice_: function() { | 1527 handleAddBluetoothDevice_: function() { |
1529 chrome.send('findBluetoothDevices'); | 1528 chrome.send('findBluetoothDevices'); |
1530 PageManager.showPageByName('bluetooth', false); | 1529 PageManager.showPageByName('bluetooth', false); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1961 $('set-time').hidden = !canSetTime; | 1960 $('set-time').hidden = !canSetTime; |
1962 }, | 1961 }, |
1963 | 1962 |
1964 /** | 1963 /** |
1965 * Handle the 'set date and time' button click. | 1964 * Handle the 'set date and time' button click. |
1966 * @private | 1965 * @private |
1967 */ | 1966 */ |
1968 handleSetTime_: function() { | 1967 handleSetTime_: function() { |
1969 chrome.send('showSetTime'); | 1968 chrome.send('showSetTime'); |
1970 }, | 1969 }, |
| 1970 |
| 1971 /** |
| 1972 * Enables the given element if possible; on Chrome OS, it won't enable |
| 1973 * an element that must stay disabled for the session type. |
| 1974 * @param {!Element} element Element to enable. |
| 1975 */ |
| 1976 enableElementIfPossible_: function(element) { |
| 1977 if (cr.isChromeOS) |
| 1978 UIAccountTweaks.enableElementIfPossible(element); |
| 1979 else |
| 1980 element.disabled = false; |
| 1981 }, |
1971 }; | 1982 }; |
1972 | 1983 |
1973 //Forward public APIs to private implementations. | 1984 //Forward public APIs to private implementations. |
1974 cr.makePublic(BrowserOptions, [ | 1985 cr.makePublic(BrowserOptions, [ |
1975 'addBluetoothDevice', | 1986 'addBluetoothDevice', |
1976 'deleteCurrentProfile', | 1987 'deleteCurrentProfile', |
1977 'enableCertificateButton', | 1988 'enableCertificateButton', |
1978 'enableDisplayButton', | 1989 'enableDisplayButton', |
1979 'enableFactoryResetSection', | 1990 'enableFactoryResetSection', |
1980 'getCurrentProfile', | 1991 'getCurrentProfile', |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2066 } | 2077 } |
2067 button.textContent = loadTimeData.getString(strId); | 2078 button.textContent = loadTimeData.getString(strId); |
2068 }; | 2079 }; |
2069 } | 2080 } |
2070 | 2081 |
2071 // Export | 2082 // Export |
2072 return { | 2083 return { |
2073 BrowserOptions: BrowserOptions | 2084 BrowserOptions: BrowserOptions |
2074 }; | 2085 }; |
2075 }); | 2086 }); |
OLD | NEW |