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") |