diff -bcr gkndfifopckmhdkohjeoljlbfnjhekfg/0.6.2/onepassword_background.html /Volumes/gb/Documents/workspace/OnePasswordChrome-0.6.2/onepassword_background.html *** gkndfifopckmhdkohjeoljlbfnjhekfg/0.6.2/onepassword_background.html Thu May 13 23:37:43 2010 --- /Volumes/gb/Documents/workspace/OnePasswordChrome-0.6.2/onepassword_background.html Thu May 13 23:40:15 2010 *************** *** 18,23 **** --- 18,24 ---- alert(s); } + var parentWindowId = null; chrome.extension.onRequest.addListener( function(request, sender, sendResponse) { *************** *** 27,32 **** --- 28,49 ---- plugin.autosave(request.login); } } + else if (request.name == "openPopUp") { + chrome.windows.getCurrent(function(w) { + parentWindowId = w.id; + var url = chrome.extension.getURL('popup.html'); + var width = 300; + var height = 300; + var left = (screen.width / 2) - (width / 2); + var top = (screen.height / 2) - (height / 2); + if (window.popUpWindow) { + window.popUpWindow.close(); + } + var options = 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left; + window.popUpWindow = window.open(url, "1Password for Chrome", options); + window.popUpWindow.focus(); + }); + } sendResponse({}); } diff -bcr gkndfifopckmhdkohjeoljlbfnjhekfg/0.6.2/onepassword_loader.js /Volumes/gb/Documents/workspace/OnePasswordChrome-0.6.2/onepassword_loader.js *** gkndfifopckmhdkohjeoljlbfnjhekfg/0.6.2/onepassword_loader.js Thu May 13 23:37:43 2010 --- /Volumes/gb/Documents/workspace/OnePasswordChrome-0.6.2/onepassword_loader.js Thu May 13 23:20:42 2010 *************** *** 120,122 **** --- 120,134 ---- HTMLFormElement.prototype._submit = HTMLFormElement.prototype.submit; HTMLFormElement.prototype.submit = ws_agile_onepassword_submit; + if (window == top) { + window.addEventListener("keyup", keyListener, false); + } + + // Keyboard keyup listener callback. + function keyListener(e) { + if (e.ctrlKey && e.keyCode) { + if (e.keyCode == 220 || e.keyCode == 191) { + chrome.extension.sendRequest({name: "openPopUp"}); + } + } + } diff -bcr gkndfifopckmhdkohjeoljlbfnjhekfg/0.6.2/popup.html /Volumes/gb/Documents/workspace/OnePasswordChrome-0.6.2/popup.html *** gkndfifopckmhdkohjeoljlbfnjhekfg/0.6.2/popup.html Thu May 13 23:37:43 2010 --- /Volumes/gb/Documents/workspace/OnePasswordChrome-0.6.2/popup.html Thu May 13 23:34:49 2010 *************** *** 28,39 **** var plugin = chrome.extension.getBackgroundPage().getPlugin(); var loginJson = plugin.loginForUuid(uuid); ! chrome.tabs.getSelected(null, function(tab) { chrome.tabs.sendRequest(tab.id, {action:"fillLoginAction", loginObject: loginJson}, function(response) { }); }); ! window.close(); } function showLoginsForCurrentTab(tab) { --- 28,39 ---- var plugin = chrome.extension.getBackgroundPage().getPlugin(); var loginJson = plugin.loginForUuid(uuid); ! chrome.tabs.getSelected(thisParentWindowId, function(tab) { chrome.tabs.sendRequest(tab.id, {action:"fillLoginAction", loginObject: loginJson}, function(response) { }); }); ! setTimeout(function(){window.close()}, 300); } function showLoginsForCurrentTab(tab) { *************** *** 71,82 **** $('#logins').html(s); } function showLogins() { console.log("showLogins"); $('#logins_header').text(chrome.i18n.getMessage("Logins")); var plugin = chrome.extension.getBackgroundPage().getPlugin(); if (plugin.showUnlockScreenIfNeeded()) { ! chrome.tabs.getSelected(null, showLoginsForCurrentTab); } } --- 71,85 ---- $('#logins').html(s); } + var thisParentWindowId = null; function showLogins() { console.log("showLogins"); $('#logins_header').text(chrome.i18n.getMessage("Logins")); var plugin = chrome.extension.getBackgroundPage().getPlugin(); if (plugin.showUnlockScreenIfNeeded()) { ! thisParentWindowId = chrome.extension.getBackgroundPage().parentWindowId; ! chrome.tabs.getSelected(chrome.extension.getBackgroundPage().parentWindowId, showLoginsForCurrentTab); ! chrome.extension.getBackgroundPage().parentWindowId = null; } }