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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
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 1bc711f8e33eaccc7c1fde4d77f5493a1b866c1f..a373375126df5593bbcf12fe1710ae90041e1d79 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -1492,8 +1492,7 @@ cr.define('options', function() {
* @param {boolean} managed
*/
setWallpaperManaged_: function(managed) {
- var button = $('set-wallpaper');
- button.disabled = !!managed;
+ this.setElementEnabled_($('set-wallpaper'), !managed);
// Create a synthetic pref change event decorated as
// CoreOptionsHandler::CreateValueForPref() does.
@@ -1939,6 +1938,19 @@ cr.define('options', function() {
handleSetTime_: function() {
chrome.send('showSetTime');
},
+
+ /**
+ * Enables or disables the given element. On Chrome OS, this uses
+ * UIAccountTweaks so we don't enable an element that must stay disabled.
+ * @param {!Element} element Element to enable or disable.
+ * @param {boolean} enabled Whether to enable or disable the element.
+ */
+ setElementEnabled_: function(element, enabled) {
+ 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
+ element.disabled = !enabled;
+ else
+ UIAccountTweaks.enableElementIfPossible(element);
+ },
};
//Forward public APIs to private implementations.

Powered by Google App Engine
This is Rietveld 408576698