diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-10 04:23:12 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-10 04:23:12 +0000 |
commit | 84b76116ad73f9e05dcb0d9f740957bc426a0c9b (patch) | |
tree | f2101ad40653a32e575aef7964eb18cd4dd90dc6 /chrome/renderer | |
parent | b1e3eed28b3089c74fe43eef2e153608cc9d0e03 (diff) | |
download | chromium_src-84b76116ad73f9e05dcb0d9f740957bc426a0c9b.zip chromium_src-84b76116ad73f9e05dcb0d9f740957bc426a0c9b.tar.gz chromium_src-84b76116ad73f9e05dcb0d9f740957bc426a0c9b.tar.bz2 |
Flesh out more extensions tab api (added getTab, removeTab, updateTab)
Review URL: http://codereview.chromium.org/62178
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/resources/extension_process_bindings.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index 85d4d53..3a18c97 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -6,8 +6,15 @@ var chromium; // callback handling var callbacks = []; chromium._dispatchCallback = function(callbackId, str) { - callbacks[callbackId](goog.json.parse(str)); - delete callbacks[callbackId]; + try { + if (str) { + callbacks[callbackId](goog.json.parse(str)); + } else { + callbacks[callbackId](); + } + } finally { + delete callbacks[callbackId]; + } }; // Send an API request and optionally register a callback. @@ -29,8 +36,20 @@ var chromium; native function GetTabsForWindow(); sendRequest(GetTabsForWindow, null, callback); }; + chromium.tabs.getTab = function(tabId, callback) { + native function GetTab(); + sendRequest(GetTab, tabId, callback); + }; chromium.tabs.createTab = function(tab, callback) { native function CreateTab(); sendRequest(CreateTab, tab, callback); }; + chromium.tabs.updateTab = function(tab) { + native function UpdateTab(); + sendRequest(UpdateTab, tab); + }; + chromium.tabs.removeTab = function(tabId) { + native function RemoveTab(); + sendRequest(RemoveTab, tabId); + }; })(); |