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

Unified Diff: remoting/webapp/remoting.js

Issue 13619010: Migrate window.localStorage settings to chrome.storage.local at start-up. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/remoting.js
diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js
index c487fa1a666bad14a1ac285d72c4be1186b94216..78a9d5810819d77f0a3ef78b3a8b9379f2329954 100644
--- a/remoting/webapp/remoting.js
+++ b/remoting/webapp/remoting.js
@@ -34,6 +34,8 @@ function consentRequired_(authContinue) {
* Entry point for app initialization.
*/
remoting.init = function() {
+ migrateSettings_();
Wez 2013/04/04 18:51:40 nit: migrateLocalToChromeStorage_()?
Jamie 2013/04/04 19:23:39 Done.
+
// TODO(jamiewalch): Remove this when we migrate to apps v2
// (http://crbug.com/ 134213).
remoting.initMockStorage();
@@ -356,3 +358,23 @@ function isWindowed_(callback) {
console.error('chome.tabs is not available.');
}
}
+
+function migrateSettings_() {
+ // The OAuth2 class still uses window.localStorage, so don't migrate any of
+ // those settings.
Wez 2013/04/04 18:51:40 nit: I'd suggest rewording to explain that we're m
Jamie 2013/04/04 19:23:39 I've added a doc comment to the function to explai
+ var oauthSettings = [
+ 'oauth2-refresh-token',
+ 'oauth2-refresh-token-revokable',
+ 'oauth2-access-token',
+ 'oauth2-xsrf-token',
+ 'remoting-email'
+ ];
+ for (var setting in window.localStorage) {
+ if (oauthSettings.indexOf(setting) == -1) {
+ var copy = {}
+ copy[setting] = window.localStorage.getItem(setting);
+ chrome.storage.local.set(copy);
Wez 2013/04/04 18:51:40 nit: You could collate the values to copy and do a
Jamie 2013/04/04 19:23:39 I don't think that would be any clearer.
+ window.localStorage.removeItem(setting);
+ }
+ }
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698