OLD | NEW |
1 /** | 1 /** |
2 * Handles requests sent by the content script. Shows an infobar. | 2 * Handles requests sent by the content script. Shows an infobar. |
3 */ | 3 */ |
4 function onRequest(request, sender, sendResponse) { | 4 function onRequest(request, sender, sendResponse) { |
5 // The number of matches is sent in the request - pass it to the | 5 // The number of matches is sent in the request - pass it to the |
6 // infobar. | 6 // infobar. |
7 var url = "infobar.html#" + request.count; | 7 var url = "infobar.html#" + request.count; |
8 | 8 |
9 // Show the infobar on the tab where the request was sent. | 9 // Show the infobar on the tab where the request was sent. |
10 chrome.experimental.infobars.show({ | 10 chrome.infobars.show({ |
11 tabId: sender.tab.id, | 11 tabId: sender.tab.id, |
12 path: url | 12 path: url |
13 }); | 13 }); |
14 | 14 |
15 // Return nothing to let the connection be cleaned up. | 15 // Return nothing to let the connection be cleaned up. |
16 sendResponse({}); | 16 sendResponse({}); |
17 }; | 17 }; |
18 | 18 |
19 // Listen for the content script to send a message to the background page. | 19 // Listen for the content script to send a message to the background page. |
20 chrome.extension.onRequest.addListener(onRequest); | 20 chrome.extension.onRequest.addListener(onRequest); |
OLD | NEW |