OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** @type {remoting.HostSession} */ remoting.hostSession = null; | 10 /** @type {remoting.HostSession} */ remoting.hostSession = null; |
(...skipping 16 matching lines...) Expand all Loading... | |
27 authContinue(); | 27 authContinue(); |
28 }; | 28 }; |
29 dialog.hidden = false; | 29 dialog.hidden = false; |
30 button.addEventListener('click', consentGranted, false); | 30 button.addEventListener('click', consentGranted, false); |
31 } | 31 } |
32 | 32 |
33 /** | 33 /** |
34 * Entry point for app initialization. | 34 * Entry point for app initialization. |
35 */ | 35 */ |
36 remoting.init = function() { | 36 remoting.init = function() { |
37 migrateSettings_(); | |
Wez
2013/04/04 18:51:40
nit: migrateLocalToChromeStorage_()?
Jamie
2013/04/04 19:23:39
Done.
| |
38 | |
37 // TODO(jamiewalch): Remove this when we migrate to apps v2 | 39 // TODO(jamiewalch): Remove this when we migrate to apps v2 |
38 // (http://crbug.com/ 134213). | 40 // (http://crbug.com/ 134213). |
39 remoting.initMockStorage(); | 41 remoting.initMockStorage(); |
40 | 42 |
41 remoting.logExtensionInfo_(); | 43 remoting.logExtensionInfo_(); |
42 l10n.localize(); | 44 l10n.localize(); |
43 // Create global objects. | 45 // Create global objects. |
44 remoting.settings = new remoting.Settings(); | 46 remoting.settings = new remoting.Settings(); |
45 remoting.oauth2 = new remoting.OAuth2(); | 47 remoting.oauth2 = new remoting.OAuth2(); |
46 // TODO(jamiewalch): Reinstate this when we migrate to apps v2 | 48 // TODO(jamiewalch): Reinstate this when we migrate to apps v2 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 } else { | 351 } else { |
350 chrome.windows.get(tab.windowId, null, windowCallback); | 352 chrome.windows.get(tab.windowId, null, windowCallback); |
351 } | 353 } |
352 }; | 354 }; |
353 if (chrome.tabs) { | 355 if (chrome.tabs) { |
354 chrome.tabs.getCurrent(tabCallback); | 356 chrome.tabs.getCurrent(tabCallback); |
355 } else { | 357 } else { |
356 console.error('chome.tabs is not available.'); | 358 console.error('chome.tabs is not available.'); |
357 } | 359 } |
358 } | 360 } |
361 | |
362 function migrateSettings_() { | |
363 // The OAuth2 class still uses window.localStorage, so don't migrate any of | |
364 // 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
| |
365 var oauthSettings = [ | |
366 'oauth2-refresh-token', | |
367 'oauth2-refresh-token-revokable', | |
368 'oauth2-access-token', | |
369 'oauth2-xsrf-token', | |
370 'remoting-email' | |
371 ]; | |
372 for (var setting in window.localStorage) { | |
373 if (oauthSettings.indexOf(setting) == -1) { | |
374 var copy = {} | |
375 copy[setting] = window.localStorage.getItem(setting); | |
376 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.
| |
377 window.localStorage.removeItem(setting); | |
378 } | |
379 } | |
380 } | |
OLD | NEW |