| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 User pod row implementation. | 6 * @fileoverview User pod row implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 cr.define('login', function() { | 9 cr.define('login', function() { |
| 10 /** | 10 /** |
| (...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1998 | 1998 |
| 1999 // Array of apps that are shown in addition to other user pods. | 1999 // Array of apps that are shown in addition to other user pods. |
| 2000 apps_: [], | 2000 apps_: [], |
| 2001 | 2001 |
| 2002 // True to show app pods along with user pods. | 2002 // True to show app pods along with user pods. |
| 2003 shouldShowApps_: true, | 2003 shouldShowApps_: true, |
| 2004 | 2004 |
| 2005 // Array of users that are shown (public/supervised/regular). | 2005 // Array of users that are shown (public/supervised/regular). |
| 2006 users_: [], | 2006 users_: [], |
| 2007 | 2007 |
| 2008 // If we're disabling single pod autofocus for Touch View. |
| 2009 touchViewSinglePodExperimentOn_: true, |
| 2010 |
| 2011 |
| 2008 /** @override */ | 2012 /** @override */ |
| 2009 decorate: function() { | 2013 decorate: function() { |
| 2010 // Event listeners that are installed for the time period during which | 2014 // Event listeners that are installed for the time period during which |
| 2011 // the element is visible. | 2015 // the element is visible. |
| 2012 this.listeners_ = { | 2016 this.listeners_ = { |
| 2013 focus: [this.handleFocus_.bind(this), true /* useCapture */], | 2017 focus: [this.handleFocus_.bind(this), true /* useCapture */], |
| 2014 click: [this.handleClick_.bind(this), true], | 2018 click: [this.handleClick_.bind(this), true], |
| 2015 mousemove: [this.handleMouseMove_.bind(this), false], | 2019 mousemove: [this.handleMouseMove_.bind(this), false], |
| 2016 keydown: [this.handleKeyDown.bind(this), false] | 2020 keydown: [this.handleKeyDown.bind(this), false] |
| 2017 }; | 2021 }; |
| 2018 | 2022 |
| 2019 var isDesktopUserManager = Oobe.getInstance().displayType == | 2023 var isDesktopUserManager = Oobe.getInstance().displayType == |
| 2020 DISPLAY_TYPE.DESKTOP_USER_MANAGER; | 2024 DISPLAY_TYPE.DESKTOP_USER_MANAGER; |
| 2021 this.userPodHeight_ = isDesktopUserManager ? DESKTOP_POD_HEIGHT : | 2025 this.userPodHeight_ = isDesktopUserManager ? DESKTOP_POD_HEIGHT : |
| 2022 CROS_POD_HEIGHT; | 2026 CROS_POD_HEIGHT; |
| 2023 // Same for Chrome OS and desktop. | 2027 // Same for Chrome OS and desktop. |
| 2024 this.userPodWidth_ = POD_WIDTH; | 2028 this.userPodWidth_ = POD_WIDTH; |
| 2025 }, | 2029 }, |
| 2026 | 2030 |
| 2027 /** | 2031 /** |
| 2028 * Returns all the pods in this pod row. | 2032 * Returns all the pods in this pod row. |
| 2029 * @type {NodeList} | 2033 * @type {NodeList} |
| 2030 */ | 2034 */ |
| 2031 get pods() { | 2035 get pods() { |
| 2032 return Array.prototype.slice.call(this.children); | 2036 return Array.prototype.slice.call(this.children); |
| 2033 }, | 2037 }, |
| 2034 | 2038 |
| 2035 /** | 2039 /** |
| 2036 * Return true if user pod row has only single user pod in it, which should | 2040 * Return true if user pod row has only single user pod in it, which should |
| 2037 * always be focused. | 2041 * always be focused except desktop and touch view modes. |
| 2038 * @type {boolean} | 2042 * @type {boolean} |
| 2039 */ | 2043 */ |
| 2040 get alwaysFocusSinglePod() { | 2044 get alwaysFocusSinglePod() { |
| 2041 var isDesktopUserManager = Oobe.getInstance().displayType == | 2045 var isDesktopUserManager = Oobe.getInstance().displayType == |
| 2042 DISPLAY_TYPE.DESKTOP_USER_MANAGER; | 2046 DISPLAY_TYPE.DESKTOP_USER_MANAGER; |
| 2043 | 2047 |
| 2044 return isDesktopUserManager ? false : this.children.length == 1; | 2048 return (isDesktopUserManager || |
| 2049 (this.touchViewSinglePodExperimentOn_ && |
| 2050 this.touchViewEnabled_)) ? |
| 2051 false : this.children.length == 1; |
| 2045 }, | 2052 }, |
| 2046 | 2053 |
| 2047 /** | 2054 /** |
| 2048 * Returns pod with the given app id. | 2055 * Returns pod with the given app id. |
| 2049 * @param {!string} app_id Application id to be matched. | 2056 * @param {!string} app_id Application id to be matched. |
| 2050 * @return {Object} Pod with the given app id. null if pod hasn't been | 2057 * @return {Object} Pod with the given app id. null if pod hasn't been |
| 2051 * found. | 2058 * found. |
| 2052 */ | 2059 */ |
| 2053 getPodWithAppId_: function(app_id) { | 2060 getPodWithAppId_: function(app_id) { |
| 2054 for (var i = 0, pod; pod = this.pods[i]; ++i) { | 2061 for (var i = 0, pod; pod = this.pods[i]; ++i) { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 var pod = this.getPodWithUsername_(username); | 2372 var pod = this.getPodWithUsername_(username); |
| 2366 if (pod == null) { | 2373 if (pod == null) { |
| 2367 console.error('Unable to set auth type for ' + username + | 2374 console.error('Unable to set auth type for ' + username + |
| 2368 ': user pod not found.'); | 2375 ': user pod not found.'); |
| 2369 return; | 2376 return; |
| 2370 } | 2377 } |
| 2371 pod.setAuthType(authType, value); | 2378 pod.setAuthType(authType, value); |
| 2372 }, | 2379 }, |
| 2373 | 2380 |
| 2374 /** | 2381 /** |
| 2382 * Sets the state of touch view mode. |
| 2383 * @param {boolean} isTouchViewEnabled true if the mode is on. |
| 2384 */ |
| 2385 setTouchViewState: function(isTouchViewEnabled) { |
| 2386 this.touchViewEnabled_ = isTouchViewEnabled; |
| 2387 }, |
| 2388 |
| 2389 /** |
| 2375 * Updates the display name shown on a public session pod. | 2390 * Updates the display name shown on a public session pod. |
| 2376 * @param {string} userID The user ID of the public session | 2391 * @param {string} userID The user ID of the public session |
| 2377 * @param {string} displayName The new display name | 2392 * @param {string} displayName The new display name |
| 2378 */ | 2393 */ |
| 2379 setPublicSessionDisplayName: function(userID, displayName) { | 2394 setPublicSessionDisplayName: function(userID, displayName) { |
| 2380 var pod = this.getPodWithUsername_(userID); | 2395 var pod = this.getPodWithUsername_(userID); |
| 2381 if (pod != null) | 2396 if (pod != null) |
| 2382 pod.setDisplayName(displayName); | 2397 pod.setDisplayName(displayName); |
| 2383 }, | 2398 }, |
| 2384 | 2399 |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2987 if (pod && pod.multiProfilesPolicyApplied) { | 3002 if (pod && pod.multiProfilesPolicyApplied) { |
| 2988 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3003 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 2989 } | 3004 } |
| 2990 } | 3005 } |
| 2991 }; | 3006 }; |
| 2992 | 3007 |
| 2993 return { | 3008 return { |
| 2994 PodRow: PodRow | 3009 PodRow: PodRow |
| 2995 }; | 3010 }; |
| 2996 }); | 3011 }); |
| OLD | NEW |