diff --git a/background.js b/background.js index 5930d608b..57bf12a72 100644 --- a/background.js +++ b/background.js @@ -468,6 +468,18 @@ var ChromeService = (function() { chrome.tabs.remove(tabs[0].id); }); break; + case 'chooseTab': + chrome.tabs.query({ + currentWindow: true, + active: true + }, function(resp) { + var cur = resp[0].id; + chrome.tabs.sendMessage(cur, { + target: 'content_runtime', + subject: 'chooseTab' + }); + }); + break; case 'proxyThis': chrome.tabs.query({ currentWindow: true, diff --git a/content_scripts/front.js b/content_scripts/front.js index 9fbe9e4cb..742602de4 100644 --- a/content_scripts/front.js +++ b/content_scripts/front.js @@ -290,6 +290,10 @@ var Front = (function() { }); }; + runtime.runtime_handlers['chooseTab'] = function(msg, sender, response) { + self.chooseTab(); + }; + runtime.runtime_handlers['focusFrame'] = function(msg, sender, response) { if (msg.frameId === window.frameId) { window.focus(); diff --git a/manifest.json b/manifest.json index 9bf5c387c..20478b071 100644 --- a/manifest.json +++ b/manifest.json @@ -22,6 +22,9 @@ "closeTab": { "description": "Close the current tab." }, + "chooseTab": { + "description": "Invoke tab selector." + }, "proxyThis": { "description": "Toggle current site in autoproxy_hosts." }