Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: remoting/webapp/crd/js/remoting.js

Issue 848993002: Improve apps v2 upgrade UX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CL feedback Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« remoting/webapp/crd/js/host_list.js ('K') | « remoting/webapp/crd/js/host_list.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/remoting.js
diff --git a/remoting/webapp/crd/js/remoting.js b/remoting/webapp/crd/js/remoting.js
index f80d9f064944d4708090450e080084fbdf45b037..b8acbd6bf7eb7260c65f16a244e0a27c4bb23bd8 100644
--- a/remoting/webapp/crd/js/remoting.js
+++ b/remoting/webapp/crd/js/remoting.js
@@ -21,8 +21,6 @@ remoting.initGlobalObjects = function() {
if (base.isAppsV2()) {
var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode);
htmlNode.classList.add('apps-v2');
- } else {
- migrateLocalToChromeStorage_();
}
console.log(remoting.getExtensionInfo());
@@ -89,10 +87,16 @@ remoting.getExtensionInfo = function() {
}
};
+remoting.onBeforeUnload = function() {
+ migrateLocalToChromeStorage_();
+ return remoting.promptClose();
+};
+
/**
* If an IT2Me client or host is active then prompt the user before closing.
* If a Me2Me client is active then don't bother, since closing the window is
* the more intuitive way to end a Me2Me session, and re-connecting is easy.
+ * @return {?string}
*/
remoting.promptClose = function() {
if (remoting.clientSession &&
@@ -242,15 +246,13 @@ function migrateLocalToChromeStorage_() {
'oauth2-refresh-token',
'oauth2-refresh-token-revokable',
'oauth2-access-token',
- 'oauth2-xsrf-token',
- 'remoting-email'
+ 'oauth2-xsrf-token'
];
for (var setting in window.localStorage) {
if (oauthSettings.indexOf(setting) == -1) {
- var copy = {}
+ var copy = {};
copy[setting] = window.localStorage.getItem(setting);
chrome.storage.local.set(copy);
- window.localStorage.removeItem(setting);
}
}
}
« remoting/webapp/crd/js/host_list.js ('K') | « remoting/webapp/crd/js/host_list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698