| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Saves the email and full name of the current user as the migration settings | 85 * Saves the email and full name of the current user as the migration settings |
| 86 * in the v1 app. Clears the migration settings in the v2 app. | 86 * in the v1 app. Clears the migration settings in the v2 app. |
| 87 */ | 87 */ |
| 88 remoting.AppsV2Migration.saveUserInfo = function() { | 88 remoting.AppsV2Migration.saveUserInfo = function() { |
| 89 if (base.isAppsV2()) { | 89 if (base.isAppsV2()) { |
| 90 chrome.storage.local.remove(MIGRATION_KEY_); | 90 chrome.storage.local.remove(MIGRATION_KEY_); |
| 91 } else { | 91 } else { |
| 92 /** | 92 remoting.identity.getUserInfo( |
| 93 * @param {string} email | 93 /** |
| 94 * @param {string} fullName | 94 * @param {string} email |
| 95 */ | 95 * @param {string} fullName |
| 96 remoting.identity.getUserInfo(function(email, fullName) { | 96 */ |
| 97 var preference = {}; | 97 function(email, fullName) { |
| 98 preference[MIGRATION_KEY_] = | 98 var preference = {}; |
| 99 new remoting.MigrationSettings(email, fullName); | 99 preference[MIGRATION_KEY_] = |
| 100 chrome.storage.local.set(preference); | 100 new remoting.MigrationSettings(email, fullName); |
| 101 }, base.doNothing); | 101 chrome.storage.local.set(preference); |
| 102 }, base.doNothing); |
| 102 } | 103 } |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 }()); | 106 }()); |
| 106 | 107 |
| OLD | NEW |