aboutsummaryrefslogtreecommitdiffstats
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/chromium/vapi-background.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js
index 9c9f231..9381cb8 100644
--- a/platform/chromium/vapi-background.js
+++ b/platform/chromium/vapi-background.js
@@ -392,6 +392,27 @@ vAPI.tabs.reload = function(tabId /*, flags*/) {
/******************************************************************************/
+// Select a specific tab.
+
+vAPI.tabs.select = function(tabId) {
+ tabId = toChromiumTabId(tabId);
+ if ( tabId === 0 ) {
+ return;
+ }
+
+ chrome.tabs.update(tabId, { active: true }, function(tab) {
+ if ( chrome.runtime.lastError ) {
+ /* noop */
+ }
+ if ( !tab ) {
+ return;
+ }
+ chrome.windows.update(tab.windowId, { focused: true });
+ });
+};
+
+/******************************************************************************/
+
vAPI.tabs.injectScript = function(tabId, details, callback) {
var onScriptExecuted = function() {
// https://code.google.com/p/chromium/issues/detail?id=410868#c8