Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 var dialog_border = document.getElementById('auth-dialog-border'); | 40 var dialog_border = document.getElementById('auth-dialog-border'); |
| 41 // TODO(garykac): Refactor to remove auth dialog from the main html file | 41 // TODO(garykac): Refactor to remove auth dialog from the main html file |
| 42 // and place in a separate window. | 42 // and place in a separate window. |
| 43 remoting.authDialog = new remoting.AuthDialog(dialog_border); | 43 remoting.authDialog = new remoting.AuthDialog(dialog_border); |
| 44 remoting.windowShape.addCallback(remoting.authDialog); | 44 remoting.windowShape.addCallback(remoting.authDialog); |
| 45 | 45 |
| 46 button.addEventListener('click', consentGranted, false); | 46 button.addEventListener('click', consentGranted, false); |
| 47 } | 47 } |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Entry point for test code. In order to make test and production code as | |
| 51 * similar as possible, the same entry point is used for production code, | |
| 52 * but since production code should never have 'source' set to 'about_page', | |
| 53 * it will continue with initialization immediately. As a fail-safe, the | |
| 54 * mechanism by which initialization completes when under test is controlled | |
| 55 * by a simple UI, making it possible to use the app even if the previous | |
| 56 * assumption fails to hold in some corner cases. | |
| 57 */ | |
| 58 remoting.initForTesting = function() { | |
|
garykac
2014/12/02 16:43:22
This belongs in (the newly created) crd_main.js.
| |
| 59 var urlParams = getUrlParameters_(); | |
| 60 if (urlParams['source'] === 'about_page') { | |
| 61 document.getElementById('browser-test-continue-init').addEventListener( | |
| 62 'click', remoting.init, false); | |
| 63 document.getElementById('browser-test-deferred-init').hidden = false; | |
| 64 } else { | |
| 65 remoting.init(); | |
| 66 } | |
| 67 }; | |
| 68 | |
| 69 /** | |
| 50 * Entry point for app initialization. | 70 * Entry point for app initialization. |
| 51 */ | 71 */ |
| 52 remoting.init = function() { | 72 remoting.init = function() { |
| 53 if (base.isAppsV2()) { | 73 if (base.isAppsV2()) { |
| 54 var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode); | 74 var htmlNode = /** @type {HTMLElement} */ (document.body.parentNode); |
| 55 htmlNode.classList.add('apps-v2'); | 75 htmlNode.classList.add('apps-v2'); |
| 56 } else { | 76 } else { |
| 57 migrateLocalToChromeStorage_(); | 77 migrateLocalToChromeStorage_(); |
| 58 } | 78 } |
| 59 | 79 |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 ]; | 538 ]; |
| 519 for (var setting in window.localStorage) { | 539 for (var setting in window.localStorage) { |
| 520 if (oauthSettings.indexOf(setting) == -1) { | 540 if (oauthSettings.indexOf(setting) == -1) { |
| 521 var copy = {} | 541 var copy = {} |
| 522 copy[setting] = window.localStorage.getItem(setting); | 542 copy[setting] = window.localStorage.getItem(setting); |
| 523 chrome.storage.local.set(copy); | 543 chrome.storage.local.set(copy); |
| 524 window.localStorage.removeItem(setting); | 544 window.localStorage.removeItem(setting); |
| 525 } | 545 } |
| 526 } | 546 } |
| 527 } | 547 } |
| OLD | NEW |