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

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/browser_options.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6dab42b4e55e719ef8ebfe1928d5ee2b0beb0f6f 100644
--- a/ui/webui/resources/js/chromeos/ui_account_tweaks.js
+++ b/ui/webui/resources/js/chromeos/ui_account_tweaks.js
@@ -57,6 +57,26 @@ 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) {
+ 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")
@@ -68,10 +88,10 @@ cr.define('uiAccountTweaks', function() {
*/
UIAccountTweaks.applySessionTypeVisibility_ = function(document,
sessionType) {
- var elements = document.querySelectorAll('['+ sessionType +'-visibility]');
+ var elements = document.querySelectorAll('['+ sessionType + '-visibility]');
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
- var visibility = element.getAttribute(sessionType +'-visibility');
+ var visibility = element.getAttribute(sessionType + '-visibility');
if (visibility == 'hidden')
element.hidden = true;
else if (visibility == 'disabled')
@@ -86,7 +106,7 @@ cr.define('uiAccountTweaks', function() {
* @param {Document} document Document that should processed.
*/
UIAccountTweaks.applyGuestSessionVisibility = function(document) {
- if (!cr.isChromeOS || !UIAccountTweaks.loggedInAsGuest())
+ if (!UIAccountTweaks.loggedInAsGuest())
return;
UIAccountTweaks.applySessionTypeVisibility_(document, SESSION_TYPE_GUEST);
}
@@ -98,7 +118,7 @@ cr.define('uiAccountTweaks', function() {
* @param {Document} document Document that should processed.
*/
UIAccountTweaks.applyPublicSessionVisibility = function(document) {
- if (!cr.isChromeOS || !UIAccountTweaks.loggedInAsPublicAccount())
+ if (!UIAccountTweaks.loggedInAsPublicAccount())
return;
UIAccountTweaks.applySessionTypeVisibility_(document, SESSION_TYPE_PUBLIC);
}
« no previous file with comments | « chrome/browser/resources/options/browser_options.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698