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

Side by Side 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 outstanding feedbacks 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 unified diff | Download patch
OLDNEW
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 /** 10 /**
11 * @type {base.EventSource} An event source object for handling global events. 11 * @type {base.EventSource} An event source object for handling global events.
12 * This is an interim hack. Eventually, we should move functionalities 12 * This is an interim hack. Eventually, we should move functionalities
13 * away from the remoting namespace and into smaller objects. 13 * away from the remoting namespace and into smaller objects.
14 */ 14 */
15 remoting.testEvents; 15 remoting.testEvents;
16 16
17 /** 17 /**
18 * Initialization tasks that are common to all remoting apps. 18 * Initialization tasks that are common to all remoting apps.
19 */ 19 */
20 remoting.initGlobalObjects = function() { 20 remoting.initGlobalObjects = function() {
21 if (base.isAppsV2()) { 21 if (base.isAppsV2()) {
22 var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode); 22 var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode);
23 htmlNode.classList.add('apps-v2'); 23 htmlNode.classList.add('apps-v2');
24 } else {
25 migrateLocalToChromeStorage_();
26 } 24 }
27 25
28 console.log(remoting.getExtensionInfo()); 26 console.log(remoting.getExtensionInfo());
29 l10n.localize(); 27 l10n.localize();
30 28
31 if (base.isAppsV2()) { 29 if (base.isAppsV2()) {
32 remoting.fullscreen = new remoting.FullscreenAppsV2(); 30 remoting.fullscreen = new remoting.FullscreenAppsV2();
33 } else { 31 } else {
34 remoting.fullscreen = new remoting.FullscreenAppsV1(); 32 remoting.fullscreen = new remoting.FullscreenAppsV1();
35 } 33 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 chrome.windows.get(tab.windowId, null, windowCallback); 222 chrome.windows.get(tab.windowId, null, windowCallback);
225 } 223 }
226 }; 224 };
227 if (chrome.tabs) { 225 if (chrome.tabs) {
228 chrome.tabs.getCurrent(tabCallback); 226 chrome.tabs.getCurrent(tabCallback);
229 } else { 227 } else {
230 console.error('chome.tabs is not available.'); 228 console.error('chome.tabs is not available.');
231 } 229 }
232 } 230 }
233 231
234 /**
235 * Migrate settings in window.localStorage to chrome.storage.local so that
236 * users of older web-apps that used the former do not lose their settings.
237 */
238 function migrateLocalToChromeStorage_() {
239 // The OAuth2 class still uses window.localStorage, so don't migrate any of
240 // those settings.
241 var oauthSettings = [
242 'oauth2-refresh-token',
243 'oauth2-refresh-token-revokable',
244 'oauth2-access-token',
245 'oauth2-xsrf-token',
246 'remoting-email'
247 ];
248 for (var setting in window.localStorage) {
249 if (oauthSettings.indexOf(setting) == -1) {
250 var copy = {}
251 copy[setting] = window.localStorage.getItem(setting);
252 chrome.storage.local.set(copy);
253 window.localStorage.removeItem(setting);
254 }
255 }
256 }
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/host_list.js ('k') | remoting/webapp/unittests/apps_v2_migration_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698