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