| 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', |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 onSigninTap_: function() { | 207 onSigninTap_: function() { |
| 208 this.syncBrowserProxy_.startSignIn(); | 208 this.syncBrowserProxy_.startSignIn(); |
| 209 }, | 209 }, |
| 210 | 210 |
| 211 /** @private */ | 211 /** @private */ |
| 212 onDisconnectTap_: function() { | 212 onDisconnectTap_: function() { |
| 213 this.$.disconnectDialog.open(); | 213 this.$.disconnectDialog.open(); |
| 214 }, | 214 }, |
| 215 | 215 |
| 216 /** @private */ | 216 /** @private */ |
| 217 onDisconnectCancel_: function() { |
| 218 this.$.disconnectDialog.close(); |
| 219 }, |
| 220 |
| 221 /** @private */ |
| 217 onDisconnectConfirm_: function() { | 222 onDisconnectConfirm_: function() { |
| 218 var deleteProfile = this.$.deleteProfile && this.$.deleteProfile.checked; | 223 var deleteProfile = !!this.syncStatus.domain || |
| 224 (this.$.deleteProfile && this.$.deleteProfile.checked); |
| 219 this.syncBrowserProxy_.signOut(deleteProfile); | 225 this.syncBrowserProxy_.signOut(deleteProfile); |
| 220 | 226 |
| 221 // Dialog automatically closed because button has dialog-confirm attribute. | 227 this.$.disconnectDialog.close(); |
| 222 }, | 228 }, |
| 223 | 229 |
| 224 /** @private */ | 230 /** @private */ |
| 225 onSyncTap_: function() { | 231 onSyncTap_: function() { |
| 226 assert(this.syncStatus.signedIn); | 232 assert(this.syncStatus.signedIn); |
| 227 assert(this.syncStatus.syncSystemEnabled); | 233 assert(this.syncStatus.syncSystemEnabled); |
| 228 | 234 |
| 229 if (this.syncStatus.managed) | 235 if (this.syncStatus.managed) |
| 230 return; | 236 return; |
| 231 | 237 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 */ | 273 */ |
| 268 getDomainHtml_: function(domain) { | 274 getDomainHtml_: function(domain) { |
| 269 var innerSpan = | 275 var innerSpan = |
| 270 '<span id="managed-by-domain-name">' + domain + '</span>'; | 276 '<span id="managed-by-domain-name">' + domain + '</span>'; |
| 271 return loadTimeData.getStringF('domainManagedProfile', innerSpan); | 277 return loadTimeData.getStringF('domainManagedProfile', innerSpan); |
| 272 }, | 278 }, |
| 273 </if> | 279 </if> |
| 274 | 280 |
| 275 /** | 281 /** |
| 276 * @private | 282 * @private |
| 283 * @param {string} domain |
| 284 * @return {string} |
| 285 */ |
| 286 getDisconnectExplanationHtml_: function(domain) { |
| 287 <if expr="not chromeos"> |
| 288 if (domain) { |
| 289 return loadTimeData.getStringF( |
| 290 'syncDisconnectManagedProfileExplanation', |
| 291 '<span id="managed-by-domain-name">' + domain + '</span>'); |
| 292 } |
| 293 </if> |
| 294 return loadTimeData.getString('syncDisconnectExplanation'); |
| 295 }, |
| 296 |
| 297 /** |
| 298 * @private |
| 277 * @param {?settings.SyncStatus} syncStatus | 299 * @param {?settings.SyncStatus} syncStatus |
| 278 * @return {boolean} | 300 * @return {boolean} |
| 279 */ | 301 */ |
| 280 isAdvancedSyncSettingsVisible_: function(syncStatus) { | 302 isAdvancedSyncSettingsVisible_: function(syncStatus) { |
| 281 return !!syncStatus && !!syncStatus.signedIn && | 303 return !!syncStatus && !!syncStatus.signedIn && |
| 282 !!syncStatus.syncSystemEnabled; | 304 !!syncStatus.syncSystemEnabled; |
| 283 }, | 305 }, |
| 284 | 306 |
| 285 /** | 307 /** |
| 286 * @private | 308 * @private |
| 287 * @param {?settings.SyncStatus} syncStatus | 309 * @param {?settings.SyncStatus} syncStatus |
| 288 * @return {string} | 310 * @return {string} |
| 289 */ | 311 */ |
| 290 getSyncIcon_: function(syncStatus) { | 312 getSyncIcon_: function(syncStatus) { |
| 291 if (!syncStatus) | 313 if (!syncStatus) |
| 292 return ''; | 314 return ''; |
| 293 if (syncStatus.hasError) | 315 if (syncStatus.hasError) |
| 294 return 'settings:sync-problem'; | 316 return 'settings:sync-problem'; |
| 295 if (syncStatus.managed) | 317 if (syncStatus.managed) |
| 296 return 'settings:sync-disabled'; | 318 return 'settings:sync-disabled'; |
| 297 | 319 |
| 298 return 'settings:done'; | 320 return 'settings:done'; |
| 299 }, | 321 }, |
| 300 }); | 322 }); |
| OLD | NEW |