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

Side by Side Diff: remoting/webapp/background/background.js

Issue 450383003: Hangout remote desktop part II - background.html and AppLauncher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 /** @suppress {duplicate} */
6 var remoting = remoting || {};
7
8 (function(){
Jamie 2014/08/12 02:24:57 We don't use this construct elsewhere, and IIRC, i
kelvinp 2014/08/12 18:22:44 Before this CL, JSCompile is not run on background
Jamie 2014/08/12 20:42:53 Acknowledged.
9
10 /** @return {boolean} */
11 function isAppsV2() {
12 var manifest = chrome.runtime.getManifest();
13 if (manifest && manifest.app && manifest.app.background) {
14 return true;
15 }
16 return false;
17 }
18
19 /** @param {remoting.AppLauncher} appLauncher */
20 function initializeAppV2(appLauncher) {
21 /** @type {string} */
22 var kNewWindowId = 'new-window';
23
24 /** @param {OnClickData} info */
25 function onContextMenu(info) {
26 if (info.menuItemId == kNewWindowId) {
27 appLauncher.launch();
28 }
29 }
30
31 function initializeContextMenu() {
32 chrome.contextMenus.create({
33 id: kNewWindowId,
34 contexts: ['launcher'],
35 title: chrome.i18n.getMessage(/*i18n-content*/'NEW_WINDOW')
Jamie 2014/08/12 02:24:57 Please verify that moving this string to a new fil
kelvinp 2014/08/12 18:22:44 Hence the renaming of the file in remoting.gyp.
36 });
37 chrome.contextMenus.onClicked.addListener(onContextMenu);
38 }
39
40 initializeContextMenu();
41 chrome.app.runtime.onLaunched.addListener(appLauncher.launch);
Jamie 2014/08/12 02:24:57 Does appLauncher.launch need a bind()?
kelvinp 2014/08/12 18:22:44 No, AppLauncher.launch does not refer to any local
Jamie 2014/08/12 20:42:52 The question is whether it's a static function or
42 }
43
44 /**
45 * The background service is responsible for listening to incoming connection
46 * requests from the hangout page and the webapp.
Jamie 2014/08/12 02:24:57 s/hangout/Hangouts/ (branding)
kelvinp 2014/08/12 18:22:44 Done.
47 * @param {remoting.AppLauncher} appLauncher
48 */
49 function initializeBackgroundService(appLauncher) {
50 /** @type {remoting.It2MeService} */
51 var it2meService = new remoting.It2MeService(appLauncher);
52 it2meService.init();
53 remoting.it2meService = it2meService;
54
55 chrome.runtime.onSuspend.addListener(function() {
56 it2meService.dispose();
57 });
58 }
59
60 function main() {
61 /** @type {remoting.AppLauncher} */
62 var appLauncher = new remoting.V1AppLauncher();
63 if (isAppsV2()) {
64 appLauncher = new remoting.V2AppLauncher();
65 initializeAppV2(appLauncher);
66 }
67 initializeBackgroundService(appLauncher);
68 }
69
70 main();
71
72 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698