Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: chrome/browser/resources/options/browser_options.js

Issue 599723002: Disable wallpaper button in Guest mode settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak UIAccountTweaks Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 this.setElementEnabled_($('set-wallpaper'), !managed);
1496 button.disabled = !!managed;
1497 1496
1498 // Create a synthetic pref change event decorated as 1497 // Create a synthetic pref change event decorated as
1499 // CoreOptionsHandler::CreateValueForPref() does. 1498 // CoreOptionsHandler::CreateValueForPref() does.
1500 var event = new Event('wallpaper'); 1499 var event = new Event('wallpaper');
1501 if (managed) 1500 if (managed)
1502 event.value = { controlledBy: 'policy' }; 1501 event.value = { controlledBy: 'policy' };
1503 else 1502 else
1504 event.value = {}; 1503 event.value = {};
1505 $('wallpaper-indicator').handlePrefChange(event); 1504 $('wallpaper-indicator').handlePrefChange(event);
1506 }, 1505 },
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 $('set-time').hidden = !canSetTime; 1931 $('set-time').hidden = !canSetTime;
1933 }, 1932 },
1934 1933
1935 /** 1934 /**
1936 * Handle the 'set date and time' button click. 1935 * Handle the 'set date and time' button click.
1937 * @private 1936 * @private
1938 */ 1937 */
1939 handleSetTime_: function() { 1938 handleSetTime_: function() {
1940 chrome.send('showSetTime'); 1939 chrome.send('showSetTime');
1941 }, 1940 },
1941
1942 /**
1943 * Enables or disables the given element. On Chrome OS, this uses
1944 * UIAccountTweaks so we don't enable an element that must stay disabled.
1945 * @param {!Element} element Element to enable or disable.
1946 * @param {boolean} enabled Whether to enable or disable the element.
1947 */
1948 setElementEnabled_: function(element, enabled) {
1949 if (!cr.isChromeOS || !enabled)
stevenjb 2014/09/25 15:45:33 Putting !cr.isChromeOS in a method called simply '
michaelpg 2014/09/29 18:50:56 We really should use this every time we enable/dis
1950 element.disabled = !enabled;
1951 else
1952 UIAccountTweaks.enableElementIfPossible(element);
1953 },
1942 }; 1954 };
1943 1955
1944 //Forward public APIs to private implementations. 1956 //Forward public APIs to private implementations.
1945 cr.makePublic(BrowserOptions, [ 1957 cr.makePublic(BrowserOptions, [
1946 'addBluetoothDevice', 1958 'addBluetoothDevice',
1947 'deleteCurrentProfile', 1959 'deleteCurrentProfile',
1948 'enableCertificateButton', 1960 'enableCertificateButton',
1949 'enableFactoryResetSection', 1961 'enableFactoryResetSection',
1950 'getCurrentProfile', 1962 'getCurrentProfile',
1951 'getStartStopSyncButton', 1963 'getStartStopSyncButton',
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 } 2048 }
2037 button.textContent = loadTimeData.getString(strId); 2049 button.textContent = loadTimeData.getString(strId);
2038 }; 2050 };
2039 } 2051 }
2040 2052
2041 // Export 2053 // Export
2042 return { 2054 return {
2043 BrowserOptions: BrowserOptions 2055 BrowserOptions: BrowserOptions
2044 }; 2056 };
2045 }); 2057 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698