| OLD | NEW |
| 1 <script> | 1 <script> |
| 2 var windowId = null; // the browser window this toolstrip is in | 2 var windowId = null; // the browser window this toolstrip is in |
| 3 var currentPort = null; // the port of the currently focused tab | 3 var currentPort = null; // the port of the currently focused tab |
| 4 | 4 |
| 5 chrome.windows.getCurrent(function(win) { | 5 chrome.windows.getCurrent(function(win) { |
| 6 // I think this is guaranteed to be called before our onConnect handler, | 6 // I think this is guaranteed to be called before our onConnect handler, |
| 7 // because we asked for it first. | 7 // because we asked for it first. |
| 8 windowId = win.id; | 8 windowId = win.id; |
| 9 }); | 9 }); |
| 10 | 10 |
| 11 chrome.self.onConnect.addListener(function (port) { | 11 chrome.extension.onConnect.addListener(function (port) { |
| 12 if (port.tab.windowId != windowId) | 12 if (port.tab.windowId != windowId) |
| 13 return; | 13 return; |
| 14 port.onMessage.addListener(function (msg, port) { | 14 port.onMessage.addListener(function (msg, port) { |
| 15 if (msg.queryPassword) { | 15 if (msg.queryPassword) { |
| 16 // A page is requesting a site password. | 16 // A page is requesting a site password. |
| 17 openDialog(port); | 17 openDialog(port); |
| 18 } else if (typeof(msg.canQueryPassword) != "undefined") { | 18 } else if (typeof(msg.canQueryPassword) != "undefined") { |
| 19 currentPort = port; | 19 currentPort = port; |
| 20 setHasPassword(msg.canQueryPassword); | 20 setHasPassword(msg.canQueryPassword); |
| 21 } | 21 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 </script> | 62 </script> |
| 63 | 63 |
| 64 <body> | 64 <body> |
| 65 <div class="toolstrip-button" onclick="onClick()"> | 65 <div class="toolstrip-button" onclick="onClick()"> |
| 66 <img src="favicon.ico"> | 66 <img src="favicon.ico"> |
| 67 <span id="hasPassword" style="display:none;">Fill Password</span> | 67 <span id="hasPassword" style="display:none;">Fill Password</span> |
| 68 <span id="notHasPassword">PasswordMaker</span> | 68 <span id="notHasPassword">PasswordMaker</span> |
| 69 </div> | 69 </div> |
| 70 </body> | 70 </body> |
| OLD | NEW |