1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-29 17:38:04 +01:00

browser api for closing popup

This commit is contained in:
Kyle Spearrin 2018-01-12 16:42:47 -05:00
parent c15a2f5747
commit 4fc21767be
4 changed files with 11 additions and 3 deletions

View File

@ -170,6 +170,14 @@ class BrowserApi {
}
}
static closePopup(win: Window) {
if (BrowserApi.isChromeApi) {
win.close();
} else if (BrowserApi.isSafariApi && safari.extension.popovers && safari.extension.popovers.length > 0) {
safari.extension.popovers[0].hide();
}
}
private static makeTabObject(tab: any) {
if (BrowserApi.isChromeApi) {
return tab;

View File

@ -27,7 +27,7 @@ export class ActionButtonsController implements ng.IController {
self.$analytics.eventTrack('Launched Website From Listing');
BrowserApi.createNewTab(self.cipher.login.uri);
if (PopupUtilsService.inPopup(self.$window)) {
self.$window.close();
BrowserApi.closePopup(self.$window);
}
}
});

View File

@ -42,7 +42,7 @@ export class PopOutController implements ng.IController {
});
if (PopupUtilsService.inPopup(this.$window)) {
this.$window.close();
BrowserApi.closePopup(this.$window);
}
} else if ((typeof chrome !== 'undefined') && chrome.tabs && chrome.tabs.create) {
href = href.replace('uilocation=popup', 'uilocation=tab')

View File

@ -90,7 +90,7 @@ export class CurrentController {
this.utilsService.copyToClipboard(totpCode, document);
}
if (PopupUtilsService.inPopup(this.$window)) {
this.$window.close();
BrowserApi.closePopup(this.$window);
}
}).catch(() => {
this.$analytics.eventTrack('Autofilled Error');