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 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 if (picture) { | 1485 if (picture) { |
1486 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + | 1486 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + |
1487 Date.now(); | 1487 Date.now(); |
1488 } | 1488 } |
1489 }, | 1489 }, |
1490 | 1490 |
1491 /** | 1491 /** |
1492 * @param {boolean} managed | 1492 * @param {boolean} managed |
1493 */ | 1493 */ |
1494 setWallpaperManaged_: function(managed) { | 1494 setWallpaperManaged_: function(managed) { |
1495 var button = $('set-wallpaper'); | 1495 if (managed) |
1496 button.disabled = !!managed; | 1496 $('set-wallpaper').disabled = true; |
| 1497 else |
| 1498 this.enableElementIfPossible_($('set-wallpaper')); |
1497 | 1499 |
1498 // Create a synthetic pref change event decorated as | 1500 // Create a synthetic pref change event decorated as |
1499 // CoreOptionsHandler::CreateValueForPref() does. | 1501 // CoreOptionsHandler::CreateValueForPref() does. |
1500 var event = new Event('wallpaper'); | 1502 var event = new Event('wallpaper'); |
1501 if (managed) | 1503 if (managed) |
1502 event.value = { controlledBy: 'policy' }; | 1504 event.value = { controlledBy: 'policy' }; |
1503 else | 1505 else |
1504 event.value = {}; | 1506 event.value = {}; |
1505 $('wallpaper-indicator').handlePrefChange(event); | 1507 $('wallpaper-indicator').handlePrefChange(event); |
1506 }, | 1508 }, |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 $('set-time').hidden = !canSetTime; | 1934 $('set-time').hidden = !canSetTime; |
1933 }, | 1935 }, |
1934 | 1936 |
1935 /** | 1937 /** |
1936 * Handle the 'set date and time' button click. | 1938 * Handle the 'set date and time' button click. |
1937 * @private | 1939 * @private |
1938 */ | 1940 */ |
1939 handleSetTime_: function() { | 1941 handleSetTime_: function() { |
1940 chrome.send('showSetTime'); | 1942 chrome.send('showSetTime'); |
1941 }, | 1943 }, |
| 1944 |
| 1945 /** |
| 1946 * Enables the given element if possible; on Chrome OS, it won't enable |
| 1947 * an element that must stay disabled for the session type. |
| 1948 * @param {!Element} element Element to enable. |
| 1949 */ |
| 1950 enableElementIfPossible_: function(element) { |
| 1951 if (cr.isChromeOS) |
| 1952 UIAccountTweaks.enableElementIfPossible(element); |
| 1953 else |
| 1954 element.disabled = false; |
| 1955 }, |
1942 }; | 1956 }; |
1943 | 1957 |
1944 //Forward public APIs to private implementations. | 1958 //Forward public APIs to private implementations. |
1945 cr.makePublic(BrowserOptions, [ | 1959 cr.makePublic(BrowserOptions, [ |
1946 'addBluetoothDevice', | 1960 'addBluetoothDevice', |
1947 'deleteCurrentProfile', | 1961 'deleteCurrentProfile', |
1948 'enableCertificateButton', | 1962 'enableCertificateButton', |
1949 'enableFactoryResetSection', | 1963 'enableFactoryResetSection', |
1950 'getCurrentProfile', | 1964 'getCurrentProfile', |
1951 'getStartStopSyncButton', | 1965 'getStartStopSyncButton', |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 } | 2050 } |
2037 button.textContent = loadTimeData.getString(strId); | 2051 button.textContent = loadTimeData.getString(strId); |
2038 }; | 2052 }; |
2039 } | 2053 } |
2040 | 2054 |
2041 // Export | 2055 // Export |
2042 return { | 2056 return { |
2043 BrowserOptions: BrowserOptions | 2057 BrowserOptions: BrowserOptions |
2044 }; | 2058 }; |
2045 }); | 2059 }); |
OLD | NEW |