| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script> | 3 <script> |
| 4 // The Page Action ID. | 4 // The Page Action ID. |
| 5 var pageActionId = "RssPageAction"; | 5 var pageActionId = "RssPageAction"; |
| 6 | 6 |
| 7 // The icon to use. This corresponds to the icon listed in the manifest. | 7 // The icon to use. This corresponds to the icon listed in the manifest. |
| 8 var subscribeId = 0; | 8 var subscribeId = 0; |
| 9 | 9 |
| 10 // A dictionary keyed off of tabId that keeps track of data per tab (for | 10 // A dictionary keyed off of tabId that keeps track of data per tab (for |
| 11 // example what feedUrl was detected in the tab). | 11 // example what feedUrl was detected in the tab). |
| 12 var feedData = {}; | 12 var feedData = {}; |
| 13 | 13 |
| 14 chrome.self.onConnect.addListener(function(port) { | 14 chrome.extension.onConnect.addListener(function(port) { |
| 15 // This will get called from the content script using PostMessage. | 15 // This will get called from the content script using PostMessage. |
| 16 // |feedUrls| is a list of URL feeds found on the page. We only need 1 to | 16 // |feedUrls| is a list of URL feeds found on the page. We only need 1 to |
| 17 // enable the PageAction icon in the Omnibox. | 17 // enable the PageAction icon in the Omnibox. |
| 18 port.onMessage.addListener(function(feedUrls) { | 18 port.onMessage.addListener(function(feedUrls) { |
| 19 feedUrl = feedUrls[0]; | 19 feedUrl = feedUrls[0]; |
| 20 // Let Chrome know that the PageAction needs to be enabled for this tabId | 20 // Let Chrome know that the PageAction needs to be enabled for this tabId |
| 21 // and for the url of this page. | 21 // and for the url of this page. |
| 22 if (feedUrl) { | 22 if (feedUrl) { |
| 23 feedData[port.tab.id] = {pageUrl: port.tab.url, | 23 feedData[port.tab.id] = {pageUrl: port.tab.url, |
| 24 feedUrl: feedUrl}; | 24 feedUrl: feedUrl}; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 50 }); | 50 }); |
| 51 }); | 51 }); |
| 52 }); | 52 }); |
| 53 | 53 |
| 54 chrome.tabs.onRemoved.addListener(function(reply) { | 54 chrome.tabs.onRemoved.addListener(function(reply) { |
| 55 feedData[reply.tabId] = null; | 55 feedData[reply.tabId] = null; |
| 56 }); | 56 }); |
| 57 </script> | 57 </script> |
| 58 </head> | 58 </head> |
| 59 </html> | 59 </html> |
| OLD | NEW |