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

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: 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
Index: remoting/webapp/crd/js/remoting.js
diff --git a/remoting/webapp/crd/js/remoting.js b/remoting/webapp/crd/js/remoting.js
index d08287e17253006c8fdaf8eb0b081cd7bc437d88..8885b78e072875a3758217849a74ee1613b52127 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() {
kelvinp 2015/01/13 23:05:47 The 'remoting-email' is not set when initGlobalObj
Jamie 2015/01/15 20:51:30 This code is all about moving settings from window
+ 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 &&
@@ -244,15 +248,13 @@ function migrateLocalToChromeStorage_() {
'oauth2-refresh-token',
'oauth2-refresh-token-revokable',
'oauth2-access-token',
- 'oauth2-xsrf-token',
- 'remoting-email'
kelvinp 2015/01/13 23:05:47 We need to migrate 'remoting-email' as well.
Jamie 2015/01/15 20:51:30 See above; this is not about migrating settings fr
+ '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);
Jamie 2015/01/15 20:51:30 I don't think you wanted to remove this line.
}
}
}

Powered by Google App Engine
This is Rietveld 408576698