Index: remoting/webapp/background.js |
diff --git a/remoting/webapp/background.js b/remoting/webapp/background.js |
index 290b43a0ee6929c268999f22f9a4494d3c049d8f..118b7e578809ff8f4d94bfaa87e7c015c82b4e88 100644 |
--- a/remoting/webapp/background.js |
+++ b/remoting/webapp/background.js |
@@ -2,9 +2,31 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-chrome.app.runtime.onLaunched.addListener(function() { |
+/** @type {string} */ |
+var kNewWindowId = 'new-window'; |
+ |
+function createWindow() { |
chrome.app.window.create('main.html', { |
'width': 800, |
'height': 600 |
}); |
-}); |
+}; |
+ |
+/** @param {OnClickData} info */ |
+function onContextMenu(info) { |
+ if (info.menuItemId == kNewWindowId) { |
+ createWindow(); |
+ } |
+}; |
+ |
+function initializeContextMenu() { |
+ chrome.contextMenus.create({ |
+ id: kNewWindowId, |
+ contexts: ['launcher'], |
+ title: chrome.i18n.getMessage(/*i18n-content*/'NEW_WINDOW') |
+ }); |
+} |
+ |
+chrome.app.runtime.onLaunched.addListener(createWindow); |
+chrome.contextMenus.onClicked.addListener(onContextMenu); |
+initializeContextMenu(); |