OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 6 * @fileoverview |
7 * 'settings-people-page' is the settings page containing sign-in settings. | 7 * 'settings-people-page' is the settings page containing sign-in settings. |
8 */ | 8 */ |
9 Polymer({ | 9 Polymer({ |
10 is: 'settings-people-page', | 10 is: 'settings-people-page', |
11 | 11 |
12 behaviors: [ | 12 behaviors: [ |
| 13 settings.RouteObserverBehavior, |
13 I18nBehavior, | 14 I18nBehavior, |
14 WebUIListenerBehavior, | 15 WebUIListenerBehavior, |
15 <if expr="chromeos"> | 16 <if expr="chromeos"> |
16 LockStateBehavior, | 17 LockStateBehavior, |
17 </if> | 18 </if> |
18 ], | 19 ], |
19 | 20 |
20 properties: { | 21 properties: { |
21 /** | 22 /** |
22 * Preferences state. | 23 * Preferences state. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if (this.easyUnlockAllowed_) { | 133 if (this.easyUnlockAllowed_) { |
133 this.addWebUIListener( | 134 this.addWebUIListener( |
134 'easy-unlock-enabled-status', | 135 'easy-unlock-enabled-status', |
135 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); | 136 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); |
136 this.easyUnlockBrowserProxy_.getEnabledStatus().then( | 137 this.easyUnlockBrowserProxy_.getEnabledStatus().then( |
137 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); | 138 this.handleEasyUnlockEnabledStatusChanged_.bind(this)); |
138 } | 139 } |
139 </if> | 140 </if> |
140 }, | 141 }, |
141 | 142 |
| 143 /** @protected */ |
| 144 currentRouteChanged: function() { |
| 145 if (settings.getCurrentRoute() == settings.Route.SIGN_OUT) |
| 146 this.$.disconnectDialog.showModal(); |
| 147 else if (this.$.disconnectDialog.open) |
| 148 this.$.disconnectDialog.close(); |
| 149 }, |
| 150 |
142 <if expr="chromeos"> | 151 <if expr="chromeos"> |
143 /** @private */ | 152 /** @private */ |
144 getPasswordState_: function(hasPin, enableScreenLock) { | 153 getPasswordState_: function(hasPin, enableScreenLock) { |
145 if (!enableScreenLock) | 154 if (!enableScreenLock) |
146 return this.i18n('lockScreenNone'); | 155 return this.i18n('lockScreenNone'); |
147 if (hasPin) | 156 if (hasPin) |
148 return this.i18n('lockScreenPinOrPassword'); | 157 return this.i18n('lockScreenPinOrPassword'); |
149 return this.i18n('lockScreenPasswordOnly'); | 158 return this.i18n('lockScreenPasswordOnly'); |
150 }, | 159 }, |
151 </if> | 160 </if> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 this.syncBrowserProxy_.openActivityControlsUrl(); | 219 this.syncBrowserProxy_.openActivityControlsUrl(); |
211 }, | 220 }, |
212 | 221 |
213 /** @private */ | 222 /** @private */ |
214 onSigninTap_: function() { | 223 onSigninTap_: function() { |
215 this.syncBrowserProxy_.startSignIn(); | 224 this.syncBrowserProxy_.startSignIn(); |
216 }, | 225 }, |
217 | 226 |
218 /** @private */ | 227 /** @private */ |
219 onDisconnectTap_: function() { | 228 onDisconnectTap_: function() { |
220 this.$.disconnectDialog.showModal(); | 229 settings.navigateTo(settings.Route.SIGN_OUT); |
221 }, | 230 }, |
222 | 231 |
223 /** @private */ | 232 /** @private */ |
224 onDisconnectCancel_: function() { | 233 onDisconnectCancel_: function() { |
225 this.$.disconnectDialog.close(); | 234 settings.navigateToPreviousRoute(); |
226 }, | 235 }, |
227 | 236 |
228 /** @private */ | 237 /** @private */ |
229 onDisconnectConfirm_: function() { | 238 onDisconnectConfirm_: function() { |
230 var deleteProfile = !!this.syncStatus.domain || | 239 var deleteProfile = !!this.syncStatus.domain || |
231 (this.$.deleteProfile && this.$.deleteProfile.checked); | 240 (this.$.deleteProfile && this.$.deleteProfile.checked); |
232 this.syncBrowserProxy_.signOut(deleteProfile); | 241 this.syncBrowserProxy_.signOut(deleteProfile); |
233 | 242 |
234 this.$.disconnectDialog.close(); | 243 settings.navigateToPreviousRoute(); |
235 }, | 244 }, |
236 | 245 |
237 /** @private */ | 246 /** @private */ |
238 onSyncTap_: function() { | 247 onSyncTap_: function() { |
239 assert(this.syncStatus.signedIn); | 248 assert(this.syncStatus.signedIn); |
240 assert(this.syncStatus.syncSystemEnabled); | 249 assert(this.syncStatus.syncSystemEnabled); |
241 | 250 |
242 if (this.syncStatus.managed) | 251 if (this.syncStatus.managed) |
243 return; | 252 return; |
244 | 253 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 343 |
335 /** | 344 /** |
336 * @param {string} iconUrl | 345 * @param {string} iconUrl |
337 * @return {string} A CSS imageset for multiple scale factors. | 346 * @return {string} A CSS imageset for multiple scale factors. |
338 * @private | 347 * @private |
339 */ | 348 */ |
340 getIconImageset_: function(iconUrl) { | 349 getIconImageset_: function(iconUrl) { |
341 return cr.icon.getProfileAvatarIcon(iconUrl); | 350 return cr.icon.getProfileAvatarIcon(iconUrl); |
342 }, | 351 }, |
343 }); | 352 }); |
OLD | NEW |