diff options
| author | ilya | 2009-12-30 14:25:00 -0800 |
|---|---|---|
| committer | ilya | 2009-12-30 14:25:00 -0800 |
| commit | b1506439e172f81f8233b17489fc6f0190eef95b (patch) | |
| tree | d4b2bea58922cb5ef0d980a62213684ca017b2e0 /background_page.html | |
| parent | 29d1d535b056e38a8f7338fd5146d4ba4444db21 (diff) | |
| download | vimium-b1506439e172f81f8233b17489fc6f0190eef95b.tar.bz2 | |
Add infrastructure to handle sendRequest calls in the background page.
Diffstat (limited to 'background_page.html')
| -rw-r--r-- | background_page.html | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/background_page.html b/background_page.html index 9a30f55d..0213eebc 100644 --- a/background_page.html +++ b/background_page.html @@ -18,6 +18,8 @@ getSetting: getSetting }; + var sendRequestHandlers = {}; + // Event handlers var selectionChangedHandlers = []; var getScrollPositionHandlers = {}; // tabId -> function(tab, scrollX, scrollY); @@ -40,6 +42,13 @@ }); + chrome.extension.onRequest.addListener(function (request, sender, sendResponse) { + var senderTabId = sender.tab ? sender.tab.id : null; + + if (sendRequestHandlers[request.handler]) + sendResponse(sendRequestHandlers[request.handler](request)); + }); + function handleReturnScrollPosition(args) { if (getScrollPositionHandlers[args.currentTab.id]) { // Delete first to be sure there's no circular events. |
