| 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 chrome.pageActions.enableForTab( | 26 chrome.pageActions.enableForTab( |
| 27 pageActionId, {tabId: port.tab.id, | 27 pageActionId, {tabId: port.tab.id, |
| 28 url: port.tab.url, | 28 url: port.tab.url, |
| 29 title: "Click to subscribe...", | 29 title: "Click to subscribe...", |
| 30 iconId: subscribeId}); | 30 iconId: subscribeId}); |
| 31 } | 31 } |
| 32 }); | 32 }); |
| 33 }); | 33 }); |
| 34 | 34 |
| 35 // Chrome will call into us when the user clicks on the icon in the OmniBox. | 35 // Chrome will call into us when the user clicks on the icon in the OmniBox. |
| 36 chrome.pageActions["RssPageAction"].addListener(function(reply) { | 36 chrome.pageActions["RssPageAction"].addListener(function(pageActionId, |
| 37 pageActionInfo) { |
| 37 chrome.windows.getCurrent(function(window) { | 38 chrome.windows.getCurrent(function(window) { |
| 38 chrome.tabs.get(reply.data.tabId, function(tab) { | 39 chrome.tabs.get(pageActionInfo.tabId, function(tab) { |
| 39 // We need to know if we are the active window, because the tab may | 40 // We need to know if we are the active window, because the tab may |
| 40 // have moved to another window and we don't want to execute this | 41 // have moved to another window and we don't want to execute this |
| 41 // action multiple times. | 42 // action multiple times. |
| 42 if (window.focused) { | 43 if (window.focused) { |
| 43 // Create a new tab showing the subscription page with the right | 44 // Create a new tab showing the subscription page with the right |
| 44 // feed URL. | 45 // feed URL. |
| 45 chrome.tabs.create({url: "subscribe.html?" + | 46 chrome.tabs.create({url: "subscribe.html?" + |
| 46 feedData[reply.data.tabId].feedUrl, | 47 feedData[pageActionInfo.tabId].feedUrl, |
| 47 windowId: window.windowId}); | 48 windowId: window.windowId}); |
| 48 } | 49 } |
| 49 }); | 50 }); |
| 50 }); | 51 }); |
| 51 }); | 52 }); |
| 52 | 53 |
| 53 chrome.tabs.onRemoved.addListener(function(reply) { | 54 chrome.tabs.onRemoved.addListener(function(reply) { |
| 54 feedData[reply.tabId] = null; | 55 feedData[reply.tabId] = null; |
| 55 }); | 56 }); |
| 56 </script> | 57 </script> |
| 57 </head> | 58 </head> |
| 58 </html> | 59 </html> |
| OLD | NEW |