| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 'control-bar' is the horizontal bar at the bottom of the user | 6 * @fileoverview 'control-bar' is the horizontal bar at the bottom of the user |
| 7 * manager screen. | 7 * manager screen. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'control-bar', | 10 is: 'control-bar', |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 /** | 26 /** |
| 27 * True if 'Add Person' button is displayed. | 27 * True if 'Add Person' button is displayed. |
| 28 * @type {boolean} | 28 * @type {boolean} |
| 29 */ | 29 */ |
| 30 showAddPerson: { | 30 showAddPerson: { |
| 31 type: Boolean, | 31 type: Boolean, |
| 32 value: false | 32 value: false |
| 33 }, | 33 }, |
| 34 | 34 |
| 35 /** @private {!signin.ProfileBrowserProxy} */ | 35 /** @private {!signin.ProfileBrowserProxy} */ |
| 36 browserProxy_: Object | 36 browserProxy_: Object, |
| 37 |
| 38 /** |
| 39 * True if the force sign in policy is enabled. |
| 40 * @private {boolean} |
| 41 */ |
| 42 isForceSigninEnabled_: { |
| 43 type: Boolean, |
| 44 value: function() { |
| 45 return loadTimeData.getBoolean('isForceSigninEnabled'); |
| 46 }, |
| 47 } |
| 37 }, | 48 }, |
| 38 | 49 |
| 39 /** @override */ | 50 /** @override */ |
| 40 created: function() { | 51 created: function() { |
| 41 this.browserProxy_ = signin.ProfileBrowserProxyImpl.getInstance(); | 52 this.browserProxy_ = signin.ProfileBrowserProxyImpl.getInstance(); |
| 42 }, | 53 }, |
| 43 | 54 |
| 44 /** | 55 /** |
| 45 * Handler for 'Browse as Guest' button click event. | 56 * Handler for 'Browse as Guest' button click event. |
| 46 * @param {!Event} event | 57 * @param {!Event} event |
| 47 * @private | 58 * @private |
| 48 */ | 59 */ |
| 49 onLaunchGuestTap_: function(event) { | 60 onLaunchGuestTap_: function(event) { |
| 50 this.browserProxy_.areAllProfilesLocked().then( | 61 this.browserProxy_.areAllProfilesLocked().then( |
| 51 function(allProfilesLocked) { | 62 function(allProfilesLocked) { |
| 52 if (!allProfilesLocked) { | 63 if (!allProfilesLocked || this.isForceSigninEnabled_) { |
| 53 this.browserProxy_.launchGuestUser(); | 64 this.browserProxy_.launchGuestUser(); |
| 54 } else { | 65 } else { |
| 55 document.querySelector('error-dialog').show( | 66 document.querySelector('error-dialog').show( |
| 56 this.i18n('browseAsGuestAllProfilesLockedError')); | 67 this.i18n('browseAsGuestAllProfilesLockedError')); |
| 57 } | 68 } |
| 58 }.bind(this)); | 69 }.bind(this)); |
| 59 }, | 70 }, |
| 60 | 71 |
| 61 /** | 72 /** |
| 62 * Handler for 'Add Person' button click event. | 73 * Handler for 'Add Person' button click event. |
| 63 * @param {!Event} event | 74 * @param {!Event} event |
| 64 * @private | 75 * @private |
| 65 */ | 76 */ |
| 66 onAddUserTap_: function(event) { | 77 onAddUserTap_: function(event) { |
| 67 this.browserProxy_.areAllProfilesLocked().then( | 78 this.browserProxy_.areAllProfilesLocked().then( |
| 68 function(allProfilesLocked) { | 79 function(allProfilesLocked) { |
| 69 if (!allProfilesLocked) { | 80 if (!allProfilesLocked || this.isForceSigninEnabled_) { |
| 70 // Event is caught by user-manager-pages. | 81 // Event is caught by user-manager-pages. |
| 71 this.fire('change-page', {page: 'create-user-page'}); | 82 this.fire('change-page', {page: 'create-user-page'}); |
| 72 } else { | 83 } else { |
| 73 document.querySelector('error-dialog').show( | 84 document.querySelector('error-dialog').show( |
| 74 this.i18n('addProfileAllProfilesLockedError')); | 85 this.i18n('addProfileAllProfilesLockedError')); |
| 75 } | 86 } |
| 76 }.bind(this)); | 87 }.bind(this)); |
| 77 } | 88 } |
| 78 }); | 89 }); |
| OLD | NEW |