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

Unified Diff: ui/webui/resources/js/chromeos/ui_account_tweaks.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: ui/webui/resources/js/chromeos/ui_account_tweaks.js
diff --git a/ui/webui/resources/js/chromeos/ui_account_tweaks.js b/ui/webui/resources/js/chromeos/ui_account_tweaks.js
index 76c2d90d1e93a7a158178ea97fc4135dec19351f..876942528b278e2c3d7e4e8d82cf399db3ad6c75 100644
--- a/ui/webui/resources/js/chromeos/ui_account_tweaks.js
+++ b/ui/webui/resources/js/chromeos/ui_account_tweaks.js
@@ -57,6 +57,28 @@ cr.define('uiAccountTweaks', function() {
};
/**
+ * Enables an element unless it should be disabled for the session type.
+ *
+ * @param {!Element} element Element that should be enabled.
+ */
+ UIAccountTweaks.enableElementIfPossible = function(element) {
stevenjb 2014/09/25 15:45:33 Again, this function name seems too generic for th
michaelpg 2014/09/29 18:50:56 enableElementIfAllowed? enableElementIfEditable? t
+ if (cr.isChromeOS) {
stevenjb 2014/09/25 15:45:33 Shouldn't this always be true since this is in js/
michaelpg 2014/09/29 18:50:56 Yes. I've done a sanity check anyway, and nothing
+ var sessionType;
+ if (UIAccountTweaks.loggedInAsGuest())
+ sessionType = SESSION_TYPE_GUEST;
+ else if (UIAccountTweaks.loggedInAsPublicAccount())
+ sessionType = SESSION_TYPE_PUBLIC;
+
+ if (sessionType &&
+ element.getAttribute(sessionType +'-visibility') == 'disabled') {
+ return;
+ }
+ }
+
+ element.disabled = false;
+ }
+
+ /**
* Disables or hides some elements in specified type of session in ChromeOS.
* All elements within given document with *sessionType*-visibility
* attribute are either hidden (for *sessionType*-visibility="hidden")

Powered by Google App Engine
This is Rietveld 408576698