| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview This file contains methods that allow to tweak | 6 * @fileoverview This file contains methods that allow to tweak |
| 7 * internal page UI based on the status of current user (owner/user/guest). | 7 * internal page UI based on the status of current user (owner/user/guest). |
| 8 * It is assumed that required data is passed via i18n strings | 8 * It is assumed that required data is passed via i18n strings |
| 9 * (using templateData variable) that are filled with call to | 9 * (using loadTimeData dictionary) that are filled with call to |
| 10 * AddAccountUITweaksLocalizedValues in ui_account_tweaks.cc. | 10 * AddAccountUITweaksLocalizedValues in ui_account_tweaks.cc. |
| 11 * It is also assumed that tweaked page has chrome://resources/css/widgets.css | 11 * It is also assumed that tweaked page has chrome://resources/css/widgets.css |
| 12 * included. | 12 * included. |
| 13 */ | 13 */ |
| 14 | 14 |
| 15 cr.define('uiAccountTweaks', function() { | 15 cr.define('uiAccountTweaks', function() { |
| 16 | 16 |
| 17 ///////////////////////////////////////////////////////////////////////////// | 17 ///////////////////////////////////////////////////////////////////////////// |
| 18 // UIAccountTweaks class: | 18 // UIAccountTweaks class: |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Encapsulated handling of ChromeOS accounts options page. | 21 * Encapsulated handling of ChromeOS accounts options page. |
| 22 * @constructor | 22 * @constructor |
| 23 */ | 23 */ |
| 24 function UIAccountTweaks() { | 24 function UIAccountTweaks() { |
| 25 } | 25 } |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * @return {boolean} Whether the current user is owner or not. | 28 * @return {boolean} Whether the current user is owner or not. |
| 29 */ | 29 */ |
| 30 UIAccountTweaks.currentUserIsOwner = function() { | 30 UIAccountTweaks.currentUserIsOwner = function() { |
| 31 return templateData['currentUserIsOwner'] == 'true'; | 31 return loadTimeData.getBoolean('currentUserIsOwner'); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * @return {boolean} Whether we're currently in guest mode. | 35 * @return {boolean} Whether we're currently in guest mode. |
| 36 */ | 36 */ |
| 37 UIAccountTweaks.loggedInAsGuest = function() { | 37 UIAccountTweaks.loggedInAsGuest = function() { |
| 38 return templateData['loggedInAsGuest'] == 'true'; | 38 return loadTimeData.getBoolean('loggedInAsGuest'); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 /** | 41 /** |
| 42 * Disables or hides some elements in Guest mode in ChromeOS. | 42 * Disables or hides some elements in Guest mode in ChromeOS. |
| 43 * All elements within given document with guest-visibility | 43 * All elements within given document with guest-visibility |
| 44 * attribute are either hidden (for guest-visibility="hidden") | 44 * attribute are either hidden (for guest-visibility="hidden") |
| 45 * or disabled (for guest-visibility="disabled"). | 45 * or disabled (for guest-visibility="disabled"). |
| 46 * | 46 * |
| 47 * @param {Document} document Document that should processed. | 47 * @param {Document} document Document that should processed. |
| 48 */ | 48 */ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 }; | 106 }; |
| 107 } | 107 } |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 // Export | 110 // Export |
| 111 return { | 111 return { |
| 112 UIAccountTweaks: UIAccountTweaks | 112 UIAccountTweaks: UIAccountTweaks |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 }); | 115 }); |
| OLD | NEW |