OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 /** @suppress {duplicate} */ | 5 /** @suppress {duplicate} */ |
6 var remoting = remoting || {}; | 6 var remoting = remoting || {}; |
7 | 7 |
8 (function(){ | 8 (function(){ |
9 | 9 |
10 /** @return {boolean} */ | 10 /** @return {boolean} */ |
(...skipping 25 matching lines...) Expand all Loading... | |
36 }); | 36 }); |
37 chrome.contextMenus.onClicked.addListener(onContextMenu); | 37 chrome.contextMenus.onClicked.addListener(onContextMenu); |
38 } | 38 } |
39 | 39 |
40 initializeContextMenu(); | 40 initializeContextMenu(); |
41 chrome.app.runtime.onLaunched.addListener( | 41 chrome.app.runtime.onLaunched.addListener( |
42 appLauncher.launch.bind(appLauncher) | 42 appLauncher.launch.bind(appLauncher) |
43 ); | 43 ); |
44 } | 44 } |
45 | 45 |
46 /** | |
47 * The background service is responsible for listening to incoming connection | |
48 * requests from Hangouts and the webapp. | |
49 * | |
50 * @param {remoting.AppLauncher} appLauncher | |
51 */ | |
52 function initializeBackgroundService(appLauncher) { | |
53 /** @type {remoting.It2MeService} */ | |
54 var it2meService = new remoting.It2MeService(appLauncher); | |
55 it2meService.init(); | |
56 remoting.it2meService = it2meService; | |
57 | |
58 chrome.runtime.onSuspend.addListener(function() { | |
59 it2meService.dispose(); | |
Jamie
2014/08/13 01:44:52
Reset remoting.it2meService to null? In fact, it m
kelvinp
2014/08/13 23:44:09
Done.
| |
60 }); | |
61 } | |
62 | |
46 function main() { | 63 function main() { |
47 /** @type {remoting.AppLauncher} */ | 64 /** @type {remoting.AppLauncher} */ |
48 var appLauncher = new remoting.V1AppLauncher(); | 65 var appLauncher = new remoting.V1AppLauncher(); |
49 if (isAppsV2()) { | 66 if (isAppsV2()) { |
50 appLauncher = new remoting.V2AppLauncher(); | 67 appLauncher = new remoting.V2AppLauncher(); |
51 initializeAppV2(appLauncher); | 68 initializeAppV2(appLauncher); |
52 } | 69 } |
70 initializeBackgroundService(appLauncher); | |
53 } | 71 } |
54 | 72 |
55 window.addEventListener('load', main, false); | 73 window.addEventListener('load', main, false); |
56 | 74 |
57 }()); | 75 }()); |
OLD | NEW |