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', |
11 | 11 |
| 12 behaviors: [ |
| 13 I18nBehavior, |
| 14 ], |
| 15 |
12 properties: { | 16 properties: { |
13 /** | 17 /** |
14 * True if 'Browse as Guest' button is displayed. | 18 * True if 'Browse as Guest' button is displayed. |
15 * @type {boolean} | 19 * @type {boolean} |
16 */ | 20 */ |
17 showGuest: { | 21 showGuest: { |
18 type: Boolean, | 22 type: Boolean, |
19 value: false | 23 value: false |
20 }, | 24 }, |
21 | 25 |
(...skipping 14 matching lines...) Expand all Loading... |
36 created: function() { | 40 created: function() { |
37 this.browserProxy_ = signin.ProfileBrowserProxyImpl.getInstance(); | 41 this.browserProxy_ = signin.ProfileBrowserProxyImpl.getInstance(); |
38 }, | 42 }, |
39 | 43 |
40 /** | 44 /** |
41 * Handler for 'Browse as Guest' button click event. | 45 * Handler for 'Browse as Guest' button click event. |
42 * @param {!Event} event | 46 * @param {!Event} event |
43 * @private | 47 * @private |
44 */ | 48 */ |
45 onLaunchGuestTap_: function(event) { | 49 onLaunchGuestTap_: function(event) { |
46 this.browserProxy_.launchGuestUser(); | 50 this.browserProxy_.areAllProfilesLocked().then( |
| 51 function(allProfilesLocked) { |
| 52 if (!allProfilesLocked) { |
| 53 this.browserProxy_.launchGuestUser(); |
| 54 } else { |
| 55 document.querySelector('error-dialog').show( |
| 56 this.i18n('browseAsGuestAllProfilesLockedError')); |
| 57 } |
| 58 }.bind(this)); |
47 }, | 59 }, |
48 | 60 |
49 /** | 61 /** |
50 * Handler for 'Add Person' button click event. | 62 * Handler for 'Add Person' button click event. |
51 * @param {!Event} event | 63 * @param {!Event} event |
52 * @private | 64 * @private |
53 */ | 65 */ |
54 onAddUserTap_: function(event) { | 66 onAddUserTap_: function(event) { |
55 // Event is caught by user-manager-pages. | 67 this.browserProxy_.areAllProfilesLocked().then( |
56 this.fire('change-page', {page: 'create-user-page'}); | 68 function(allProfilesLocked) { |
| 69 if (!allProfilesLocked) { |
| 70 // Event is caught by user-manager-pages. |
| 71 this.fire('change-page', {page: 'create-user-page'}); |
| 72 } else { |
| 73 document.querySelector('error-dialog').show( |
| 74 this.i18n('addProfileAllProfilesLockedError')); |
| 75 } |
| 76 }.bind(this)); |
57 } | 77 } |
58 }); | 78 }); |
OLD | NEW |