added hotkey commands to launch browser action popup and generate new password

This commit is contained in:
Kyle Spearrin 2016-10-08 16:37:50 -04:00
parent 71e92d83f8
commit 691d2625d7
2 changed files with 24 additions and 0 deletions

View File

@ -11,6 +11,15 @@ var autofillService = new AutofillService();
var passwordGenerationService = new PasswordGenerationService(); var passwordGenerationService = new PasswordGenerationService();
var appIdService = new AppIdService(); var appIdService = new AppIdService();
chrome.commands.onCommand.addListener(function (command) {
if (command === 'generate_password') {
passwordGenerationService.getOptions().then(function (options) {
var password = passwordGenerationService.generatePassword(options);
copyToClipboard(password);
});
}
});
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) { chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.command === 'loggedOut') { if (msg.command === 'loggedOut') {
setIcon(true); setIcon(true);

View File

@ -65,6 +65,21 @@
"http://*/*", "http://*/*",
"https://*/*" "https://*/*"
], ],
"commands": {
"generate_password": {
"suggested_key": {
"default": "Ctrl+Shift+O",
"mac": "Command+Shift+O"
},
"description": "Generate and copy a new random password to the clipboard."
},
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+Y",
"mac": "Command+Shift+Y"
}
}
},
"web_accessible_resources": [ "web_accessible_resources": [
"overlay/popup.html" "overlay/popup.html"
] ]