Index: chrome/browser/resources/options2/chromeos/accounts_options.js |
diff --git a/chrome/browser/resources/options2/chromeos/accounts_options.js b/chrome/browser/resources/options2/chromeos/accounts_options.js |
index ce32b620049c6b9e182e897a381c1a40d139c152..6d19937c69c7ba06e62788140f5768bc99f056c7 100644 |
--- a/chrome/browser/resources/options2/chromeos/accounts_options.js |
+++ b/chrome/browser/resources/options2/chromeos/accounts_options.js |
@@ -42,7 +42,7 @@ cr.define('options', function() { |
// If the current user is not the owner, show some warning, |
// and do not show the user list. |
- this.showWhitelist_ = AccountsOptions.currentUserIsOwner(); |
+ this.showWhitelist_ = UIAccountTweaks.currentUserIsOwner(); |
if (this.showWhitelist_) { |
options.accounts.UserList.decorate(userList); |
} else { |
@@ -130,19 +130,6 @@ cr.define('options', function() { |
} |
}; |
- /** |
- * Returns whether the current user is owner or not. |
- */ |
- AccountsOptions.currentUserIsOwner = function() { |
- return localStrings.getString('current_user_is_owner') == 'true'; |
- }; |
- |
- /** |
- * Returns whether we're currently in guest mode. |
- */ |
- AccountsOptions.loggedInAsGuest = function() { |
- return localStrings.getString('loggedInAsGuest') == 'true'; |
- }; |
/** |
* Returns whether the whitelist is managed by policy or not. |
@@ -160,73 +147,6 @@ cr.define('options', function() { |
$('userList').updateAccountPicture(username); |
}; |
- /** |
- * Disable or hide some elements in Guest mode in ChromeOS. |
- * All elements within given document with guest-visibility |
- * attribute are either hidden (for guest-visibility="hidden") |
- * or disabled (for guest-visibility="disabled"). |
- * |
- * @param {Document} document Document that should processed. |
- */ |
- AccountsOptions.applyGuestModeVisibility = function(document) { |
- if (!cr.isChromeOS || !AccountsOptions.loggedInAsGuest()) |
- return; |
- var elements = document.querySelectorAll('[guest-visibility]'); |
- for (var i = 0; i < elements.length; i++) { |
- var element = elements[i]; |
- var visibility = element.getAttribute('guest-visibility'); |
- if (visibility == 'hidden') { |
- element.hidden = true; |
- } else if (visibility == 'disabled') { |
- AccountsOptions.disableElementsForGuest(element); |
- } |
- } |
- } |
- |
- /** |
- * Disables and marks page elements for Guest mode. |
- * Adds guest-disabled css class to all elements within given subtree, |
- * disables interactive elements (input/select/button), and removes href |
- * attribute from <a> elements. |
- * |
- * @param {Element} element Root element of DOM subtree that should be |
- * disabled. |
- */ |
- AccountsOptions.disableElementsForGuest = function(element) { |
- AccountsOptions.disableElementForGuest_(element); |
- |
- // Walk the tree, searching each ELEMENT node. |
- var walker = document.createTreeWalker(element, |
- NodeFilter.SHOW_ELEMENT, |
- null, |
- false); |
- |
- var node = walker.nextNode(); |
- while (node) { |
- AccountsOptions.disableElementForGuest_(node); |
- node = walker.nextNode(); |
- } |
- }; |
- |
- /** |
- * Disables single element for Guest mode. |
- * Adds guest-disabled css class, adds disabled attribute for appropriate |
- * elements (input/select/button), and removes href attribute from |
- * <a> element. |
- * |
- * @private |
- * @param {Element} element Element that should be disabled. |
- */ |
- AccountsOptions.disableElementForGuest_ = function(element) { |
- element.classList.add('guest-disabled'); |
- if (element.nodeName == 'INPUT' || |
- element.nodeName == 'SELECT' || |
- element.nodeName == 'BUTTON') |
- element.disabled = true; |
- if (element.nodeName == 'A') |
- element.removeAttribute('href'); |
- }; |
- |
// Export |
return { |
AccountsOptions: AccountsOptions |