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
|| {};
15 var BackgroundPage = function() {
16 /** @private {remoting.AppLauncher} */
17 this.appLauncher_
= null;
18 /** @private {remoting.ActivationHandler} */
19 this.activationHandler_
= null;
20 /** @private {remoting.TelemetryEventWriter.Service} */
21 this.telemetryService_
= null;
23 this.disposables_
= new base
.Disposables();
28 * Initialize members and globals that are valid throughout the entire lifetime
29 * of the background page.
33 BackgroundPage
.prototype.preInit_ = function() {
34 remoting
.settings
= new remoting
.Settings();
35 if (base
.isAppsV2()) {
36 remoting
.identity
= new remoting
.Identity();
38 remoting
.oauth2
= new remoting
.OAuth2();
39 var oauth2
= /** @type {*} */ (remoting
.oauth2
);
40 remoting
.identity
= /** @type {remoting.Identity} */ (oauth2
);
43 if (base
.isAppsV2()) {
44 this.appLauncher_
= new remoting
.V2AppLauncher();
45 this.telemetryService_
= remoting
.TelemetryEventWriter
.Service
.create();
46 this.telemetryService_
.init();
47 this.activationHandler_
= new remoting
.ActivationHandler(
48 base
.Ipc
.getInstance(), this.appLauncher_
, this.telemetryService_
);
49 this.disposables_
.add(new base
.EventHook(
50 this.activationHandler_
, remoting
.ActivationHandler
.Events
.windowClosed
,
51 this.telemetryService_
.unbindSession
.bind(this.telemetryService_
)));
53 this.appLauncher_
= new remoting
.V1AppLauncher();
58 window
.addEventListener('load', function() {
59 remoting
.backgroundPage
= new BackgroundPage();