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 cr.webUIListenerCallback( | |
dpapad
2016/05/31 21:05:51
The original intent of cr.webUIListenerCallback is
Moe
2016/05/31 22:14:05
b/c user_manager.js includes a bunch of legacy js
| |
56 'show-error-dialog', | |
57 this.i18n('BrowseAsGuestAllProfilesLockedError')); | |
58 } | |
59 }.bind(this)); | |
47 }, | 60 }, |
48 | 61 |
49 /** | 62 /** |
50 * Handler for 'Add Person' button click event. | 63 * Handler for 'Add Person' button click event. |
51 * @param {!Event} event | 64 * @param {!Event} event |
52 * @private | 65 * @private |
53 */ | 66 */ |
54 onAddUserTap_: function(event) { | 67 onAddUserTap_: function(event) { |
55 // Event is caught by user-manager-pages. | 68 this.browserProxy_.areAllProfilesLocked().then( |
56 this.fire('change-page', {page: 'create-user-page'}); | 69 function(allProfilesLocked) { |
70 if (!allProfilesLocked) { | |
71 // Event is caught by user-manager-pages. | |
72 this.fire('change-page', {page: 'create-user-page'}); | |
73 } else { | |
74 cr.webUIListenerCallback( | |
dpapad
2016/05/31 21:05:51
Same here.
Moe
2016/05/31 22:14:05
Done.
| |
75 'show-error-dialog', | |
76 this.i18n('AddProfileAllProfilesLockedError')); | |
77 } | |
78 }.bind(this)); | |
57 } | 79 } |
58 }); | 80 }); |
OLD | NEW |