Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1803)

Unified Diff: ceee/firefox/content/tab_api.js

Issue 5277004: Add implementation of tabs.getCurrent() API, and correct implementation of... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ceee/firefox/content/overlay.js ('k') | ceee/firefox/content/window_api.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ceee/firefox/content/tab_api.js
===================================================================
--- ceee/firefox/content/tab_api.js (revision 67259)
+++ ceee/firefox/content/tab_api.js (working copy)
@@ -258,6 +258,22 @@
return this.buildTabValue(mainBrowser, tab);
};
+CEEE_tabs_internal_.CMD_GET_CURRENT_TAB = 'tabs.getCurrent';
+CEEE_tabs_internal_.getCurrentTab_ = function(cmd, data) {
+ // TODO(rogerta@chromium.org): Revisit this implementation. I'm not sure
+ // it strictly obeys the chrome extension API spec.
+ var cfTab = data.tab;
+ if (cfTab) {
+ var win = CEEE_mozilla_windows.findWindowFromCfSessionId(cfTab.id);
+ if (win) {
+ var mainBrowser = win.document.getElementById(
+ CEEE_globals.MAIN_BROWSER_ID);
+ var tab = mainBrowser.selectedTab;
+ return this.buildTabValue(mainBrowser, tab);
+ }
+ }
+};
+
CEEE_tabs_internal_.CMD_GET_ALL_TABS_IN_WINDOW = 'tabs.getAllInWindow';
CEEE_tabs_internal_.getAllTabsInWindow_ = function(cmd, data) {
var args = CEEE_json.decode(data.args);
@@ -455,6 +471,9 @@
ceeeInstance.registerExtensionHandler(tabs.CMD_GET_SELECTED_TAB,
tabs,
tabs.getSelectedTab_);
+ ceeeInstance.registerExtensionHandler(tabs.CMD_GET_CURRENT_TAB,
+ tabs,
+ tabs.getCurrentTab_);
ceeeInstance.registerExtensionHandler(tabs.CMD_GET_ALL_TABS_IN_WINDOW,
tabs,
tabs.getAllTabsInWindow_);
« no previous file with comments | « ceee/firefox/content/overlay.js ('k') | ceee/firefox/content/window_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698