OLD | NEW |
1 <!-- | 1 <!-- |
2 * Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
3 * source code is governed by a BSD-style license that can be found in the | 3 * source code is governed by a BSD-style license that can be found in the |
4 * LICENSE file. | 4 * LICENSE file. |
5 --> | 5 --> |
6 <html> | 6 <html> |
7 <head> | 7 <head> |
8 <script> | 8 <script src="background.js"></script> |
9 // This makes sure we only enable the page action once per tab. | |
10 var hasEnabled = {}; | |
11 | |
12 chrome.extension.onRequest.addListener(function(request, sender) { | |
13 if (request.msg == "feedIcon") { | |
14 console.log('url: ' + sender.tab.url); | |
15 | |
16 if (!hasEnabled[sender.tab.id]) { | |
17 console.log('Enabling for ' + sender.tab.id); | |
18 | |
19 // We have received a list of feed urls found on the page. | |
20 // Enable the page action icon. | |
21 chrome.pageAction.setTitle({ tabId: sender.tab.id, | |
22 title: "Page action..."}); | |
23 chrome.pageAction.show(sender.tab.id); | |
24 hasEnabled[sender.tab.id] = true; | |
25 hasEnabledLastTabId = sender.tab.id; | |
26 } else { | |
27 console.log('We are not doing this more than once (for ' + | |
28 sender.tab.id + ')'); | |
29 } | |
30 } | |
31 }); | |
32 | |
33 </script> | |
34 </head> | 9 </head> |
35 </html> | 10 </html> |
OLD | NEW |