Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * The current v1 web-app allows users to sign in as any user. Some users may | 7 * The current v1 web-app allows users to sign in as any user. Some users may |
| 8 * be signed in using a different account than their chrome profile. When these | 8 * be signed in using a different account than their chrome profile. When these |
| 9 * users upgrade to the v2 app, their host list will be empty and it is not | 9 * users upgrade to the v2 app, their host list will be empty and it is not |
| 10 * obvious why. remoting.AppsV2Migration shows a migration tip to the user to | 10 * obvious why. remoting.AppsV2Migration shows a migration tip to the user to |
| 11 * sign in to their previous accounts if necessary. | 11 * sign in to their previous accounts if necessary. |
| 12 */ | 12 */ |
| 13 | 13 |
| 14 'use strict'; | 14 'use strict'; |
| 15 | 15 |
| 16 /** @suppress {duplicate} */ | 16 /** @suppress {duplicate} */ |
| 17 var remoting = remoting || {}; | 17 var remoting = remoting || {}; |
| 18 | 18 |
| 19 (function() { | 19 (function() { |
| 20 | 20 |
| 21 // Storage key used for the migration settings. | 21 // Storage key used for the migration settings. |
| 22 var MIGRATION_KEY_ = 'remoting-v2-migration'; | 22 var MIGRATION_KEY_ = 'remoting-v2-migration'; |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * @constructor | |
| 26 * @param {string} email | 25 * @param {string} email |
| 27 * @param {string} fullName | 26 * @param {string} fullName |
| 27 * @constructor | |
| 28 */ | 28 */ |
| 29 remoting.MigrationSettings = function(email, fullName) { | 29 remoting.MigrationSettings = function(email, fullName) { |
| 30 this.email = email; | 30 this.email = email; |
| 31 this.fullName = fullName; | 31 this.fullName = fullName; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 remoting.AppsV2Migration = function() {}; | 34 remoting.AppsV2Migration = function() {}; |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * @return {Promise} A Promise object that would resolve to | 37 * @return {Promise} A Promise object that would resolve to |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 /** | 83 /** |
| 84 * Saves the email and full name of the current user as the migration settings | 84 * Saves the email and full name of the current user as the migration settings |
| 85 * in the v1 app. Clears the migration settings in the v2 app. | 85 * in the v1 app. Clears the migration settings in the v2 app. |
| 86 */ | 86 */ |
| 87 remoting.AppsV2Migration.saveUserInfo = function() { | 87 remoting.AppsV2Migration.saveUserInfo = function() { |
| 88 if (base.isAppsV2()) { | 88 if (base.isAppsV2()) { |
| 89 chrome.storage.local.remove(MIGRATION_KEY_); | 89 chrome.storage.local.remove(MIGRATION_KEY_); |
| 90 } else { | 90 } else { |
| 91 /** | 91 remoting.identity.getUserInfo().then( |
| 92 * @param {string} email | 92 /** @param {{email:string, name:string}} userInfo */ |
|
kelvinp
2015/02/28 03:03:52
Nit: Don't think we need the JSDoc at all, as the
garykac
2015/02/28 03:28:23
This was added at the request of jscompile.
| |
| 93 * @param {string} fullName | 93 function(userInfo) { |
| 94 */ | 94 var preference = {}; |
| 95 remoting.identity.getUserInfo().then(function(userInfo) { | 95 preference[MIGRATION_KEY_] = |
| 96 var preference = {}; | 96 new remoting.MigrationSettings(userInfo.email, userInfo.name); |
| 97 preference[MIGRATION_KEY_] = | 97 chrome.storage.local.set(preference); |
| 98 new remoting.MigrationSettings(userInfo.email, userInfo.name); | 98 }).catch(base.doNothing); |
| 99 chrome.storage.local.set(preference); | |
| 100 }).catch(base.doNothing); | |
| 101 } | 99 } |
| 102 }; | 100 }; |
| 103 | 101 |
| 104 }()); | 102 }()); |
| OLD | NEW |