forked from jacksenechal/Skype-for-Chrome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.html
38 lines (35 loc) · 1.28 KB
/
background.html
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
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<!--
* Copyright (c) 2011 Jack Senechal. All rights reserved. Use of this
* source code is governed by a BSD-style license that can be found in the
* LICENSE file.
-->
<html>
<head>
<script type="text/javascript" src="options.js"></script>
<script>
// Check that options are set. If not, set them using the defaults from options.js
for (key in defaults) {
if (!localStorage[key]) {
localStorage[key] = defaults[key];
}
}
// Called when a message is passed.
function onRequest(request, sender, sendResponse) {
if (request.action == 'options') {
// Send the localStorage variable to the content script so that it
// can use the options set in the options page
sendResponse({ options: localStorage });
} else if (request.action == 'showPageAction') {
// Show the page action for the tab that the sender (content script)
// was on.
chrome.pageAction.show(sender.tab.id);
}
// 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);
</script>
</head>
</html>