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

Side by Side Diff: ui/webui/resources/js/chromeos/ui_account_tweaks.js

Issue 2603443002: Clang format JS: Disallow single line functions, conditionals, loops, and switch statements (Closed)
Patch Set: more options Created 3 years, 12 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 unified diff | Download patch
OLDNEW
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 loadTimeData dictionary) 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 // String specificators for different types of sessions. 20 // String specificators for different types of sessions.
21 /** @const */ var SESSION_TYPE_GUEST = 'guest'; 21 /** @const */ var SESSION_TYPE_GUEST = 'guest';
22 /** @const */ var SESSION_TYPE_PUBLIC = 'public-account'; 22 /** @const */ var SESSION_TYPE_PUBLIC = 'public-account';
23 23
24 /** 24 /**
25 * Encapsulated handling of ChromeOS accounts options page. 25 * Encapsulated handling of ChromeOS accounts options page.
26 * @constructor 26 * @constructor
27 */ 27 */
28 function UIAccountTweaks() {} 28 function UIAccountTweaks() {
29 }
dschuyler 2016/12/22 22:34:27 Maybe add "Empty" (SFS_Empty) to AllowShortFunctio
Dan Beam 2016/12/22 22:37:30 Done.
29 30
30 /** 31 /**
31 * @return {boolean} Whether the current user is owner or not. 32 * @return {boolean} Whether the current user is owner or not.
32 */ 33 */
33 UIAccountTweaks.currentUserIsOwner = function() { 34 UIAccountTweaks.currentUserIsOwner = function() {
34 return loadTimeData.getBoolean('currentUserIsOwner'); 35 return loadTimeData.getBoolean('currentUserIsOwner');
35 }; 36 };
36 37
37 /** 38 /**
38 * @return {boolean} Whether we're currently in guest session. 39 * @return {boolean} Whether we're currently in guest session.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 * @param {!Element} element Element that should be disabled. 160 * @param {!Element} element Element that should be disabled.
160 * @param {string} sessionType account session Type specificator. 161 * @param {string} sessionType account session Type specificator.
161 */ 162 */
162 UIAccountTweaks.disableElementForSessionType_ = function( 163 UIAccountTweaks.disableElementForSessionType_ = function(
163 element, sessionType) { 164 element, sessionType) {
164 element.classList.add(sessionType + '-disabled'); 165 element.classList.add(sessionType + '-disabled');
165 if (element.nodeName == 'INPUT' || element.nodeName == 'SELECT' || 166 if (element.nodeName == 'INPUT' || element.nodeName == 'SELECT' ||
166 element.nodeName == 'BUTTON') { 167 element.nodeName == 'BUTTON') {
167 element.disabled = true; 168 element.disabled = true;
168 } else if (element.nodeName == 'A') { 169 } else if (element.nodeName == 'A') {
169 element.onclick = function() { return false; }; 170 element.onclick = function() {
171 return false;
172 };
170 } 173 }
171 }; 174 };
172 175
173 // Export 176 // Export
174 return {UIAccountTweaks: UIAccountTweaks}; 177 return {UIAccountTweaks: UIAccountTweaks};
175 178
176 }); 179 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698