| 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 e4c0651a0666e68dc189469b9fed9bb5e057dbce..0afa56faf725d86905549cdc043981a7523a6184 100644
|
| --- a/chrome/browser/resources/options2/chromeos/accounts_options.js
|
| +++ b/chrome/browser/resources/options2/chromeos/accounts_options.js
|
| @@ -160,6 +160,50 @@ cr.define('options', function() {
|
| $('userList').updateAccountPicture(username);
|
| };
|
|
|
| + /**
|
| + * Disable and mark page elements for Guest mode.
|
| + * It 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.
|
| + * It 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
|
|
|