Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / remoting / webapp / crd / js / background.js
blob12bc56f6ffdd2d7eb402c6de803ebd2d886aea90
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 /** @suppress {duplicate} */
6 var remoting = remoting || {};
8 (function(){
10 'use strict';
12 /**
13  * @constructor
14  */
15 var BackgroundPage = function() {
16   /** @private {remoting.AppLauncher} */
17   this.appLauncher_ = null;
18   /** @private {remoting.ActivationHandler} */
19   this.activationHandler_ = null;
20   this.preInit_();
23 /**
24  * Initialize members and globals that are valid throughout the entire lifetime
25  * of the background page.
26  *
27  * @private
28  */
29 BackgroundPage.prototype.preInit_ = function() {
30   remoting.settings = new remoting.Settings();
31   if (base.isAppsV2()) {
32     remoting.identity = new remoting.Identity();
33   } else {
34     remoting.oauth2 = new remoting.OAuth2();
35     var oauth2 = /** @type {*} */ (remoting.oauth2);
36     remoting.identity = /** @type {remoting.Identity} */ (oauth2);
37   }
39   if (base.isAppsV2()) {
40     this.appLauncher_ = new remoting.V2AppLauncher();
41     this.activationHandler_ = new remoting.ActivationHandler(
42         base.Ipc.getInstance(), this.appLauncher_);
43   } else {
44     this.appLauncher_ = new remoting.V1AppLauncher();
45   }
49 window.addEventListener('load', function() {
50   remoting.backgroundPage = new BackgroundPage();
51 }, false);
53 }());