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

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: Address 2nd round feedbacks 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
« no previous file with comments | « remoting/webapp/background/app_launcher.js ('k') | remoting/webapp/base.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(){
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')
36 });
37 chrome.contextMenus.onClicked.addListener(onContextMenu);
38 }
39
40 initializeContextMenu();
41 chrome.app.runtime.onLaunched.addListener(
42 appLauncher.launch.bind(appLauncher)
43 );
44 }
45
46 function main() {
47 /** @type {remoting.AppLauncher} */
48 var appLauncher = new remoting.V1AppLauncher();
49 if (isAppsV2()) {
50 appLauncher = new remoting.V2AppLauncher();
51 initializeAppV2(appLauncher);
52 }
53 }
54
55 window.addEventListener('load', main, false);
56
57 }());
OLDNEW
« no previous file with comments | « remoting/webapp/background/app_launcher.js ('k') | remoting/webapp/base.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698