-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
27 lines (22 loc) · 869 Bytes
/
background.js
File metadata and controls
27 lines (22 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// I did not modify this script since it worked well to get information from
// the requested page.
/**
* Handles requests sent by the content script. Shows an infobar.
*/
function onRequest(request, sender, sendResponse) {
// The number of matches is sent in the request - pass it to the
// infobar.
var url = "infobar.html#" + request.pageScore;
// Show the infobar on the tab where the request was sent.
chrome.infobars.show({
tabId: sender.tab.id,
path: url
});
// Return nothing to let the connection be cleaned up.
sendResponse({});
};
// Listen for the content script to send a message to the background page.
chrome.extension.onRequest.addListener(onRequest);