diff options
Diffstat (limited to 'remoting/webapp')
-rw-r--r-- | remoting/webapp/appsv2.patch | 5 | ||||
-rw-r--r-- | remoting/webapp/background.js | 26 | ||||
-rw-r--r-- | remoting/webapp/jscompiler_hacks.js | 30 |
3 files changed, 57 insertions, 4 deletions
diff --git a/remoting/webapp/appsv2.patch b/remoting/webapp/appsv2.patch index 9deac20..7350ad4 100644 --- a/remoting/webapp/appsv2.patch +++ b/remoting/webapp/appsv2.patch @@ -37,13 +37,14 @@ index d1f8d1f..67bf660 100644 "optional_permissions": [ "<all_urls>" ], -@@ -42,16 +28,21 @@ +@@ -42,16 +28,22 @@ "clipboardRead", "clipboardWrite", - "nativeMessaging" + "nativeMessaging", + "fullscreen", -+ "identity" ++ "identity", ++ "contextMenus" ], - "plugins": [ - { "path": "remoting_host_plugin.dll", "public": false }, diff --git a/remoting/webapp/background.js b/remoting/webapp/background.js index 290b43a..118b7e57 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(); diff --git a/remoting/webapp/jscompiler_hacks.js b/remoting/webapp/jscompiler_hacks.js index ad4d755..57c9419 100644 --- a/remoting/webapp/jscompiler_hacks.js +++ b/remoting/webapp/jscompiler_hacks.js @@ -121,6 +121,36 @@ chrome.app.window = { create: function(name, parameters) {} }; +/** + * @type {Object} + * @see http://code.google.com/chrome/extensions/dev/contextMenus.html + */ +chrome.contextMenus = { + /** @type {chrome.Event} */ + onClicked: null, + /** + * @param {!Object} createProperties + * @param {function()=} opt_callback + * @return {string|number} + */ + create: function(createProperties, opt_callback) {}, + /** + * @param {string|number} menuItemId + * @param {function()=} opt_callback + */ + remove: function(menuItemId, opt_callback) {}, + /** + * @param {function()=} opt_callback + */ + removeAll: function(opt_callback) {}, + /** + * @param {string|number} id + * @param {!Object} updateProperties + * @param {function()=} opt_callback + */ + update: function(id, updateProperties, opt_callback) {} +}; + /** @type {Object} */ chrome.identity = { /** |