OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
1 /** | 5 /** |
2 * Handles requests sent by the content script. Shows an infobar. | 6 * Handles requests sent by the content script. Shows an infobar. |
3 */ | 7 */ |
4 function onRequest(request, sender, sendResponse) { | 8 function onRequest(request, sender, sendResponse) { |
5 // The number of matches is sent in the request - pass it to the | 9 // The number of matches is sent in the request - pass it to the |
6 // infobar. | 10 // infobar. |
7 var url = "infobar.html#" + request.count; | 11 var url = "infobar.html#" + request.count; |
8 | 12 |
9 // Show the infobar on the tab where the request was sent. | 13 // Show the infobar on the tab where the request was sent. |
10 chrome.experimental.infobars.show({ | 14 chrome.infobars.show({ |
11 tabId: sender.tab.id, | 15 tabId: sender.tab.id, |
12 path: url | 16 path: url |
13 }); | 17 }); |
14 | 18 |
15 // Return nothing to let the connection be cleaned up. | 19 // Return nothing to let the connection be cleaned up. |
16 sendResponse({}); | 20 sendResponse({}); |
17 }; | 21 }; |
18 | 22 |
19 // Listen for the content script to send a message to the background page. | 23 // Listen for the content script to send a message to the background page. |
20 chrome.extension.onRequest.addListener(onRequest); | 24 chrome.extension.onRequest.addListener(onRequest); |
OLD | NEW |