1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-26 22:01:32 +01:00

[PM-5189] Refactoring implementation

This commit is contained in:
Cesar Gonzalez 2024-05-02 17:24:18 -05:00
parent 8ae427c60d
commit e82766c3f5
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
5 changed files with 16 additions and 14 deletions

View File

@ -109,8 +109,8 @@ type OverlayBackgroundExtensionMessageHandlers = {
checkIsFieldCurrentlyFocused: () => boolean;
updateIsFieldCurrentlyFilling: ({ message }: BackgroundMessageParam) => void;
checkIsFieldCurrentlyFilling: () => boolean;
checkIsInlineMenuButtonVisible: ({ sender }: BackgroundSenderParam) => void;
checkIsInlineMenuListVisible: ({ sender }: BackgroundSenderParam) => void;
checkIsAutofillInlineMenuButtonVisible: ({ sender }: BackgroundSenderParam) => void;
checkIsAutofillInlineMenuListVisible: ({ sender }: BackgroundSenderParam) => void;
checkIsOverlayLoginCiphersPopulated: ({ sender }: BackgroundSenderParam) => void;
updateSubFrameData: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
rebuildSubFrameOffsets: ({ sender }: BackgroundSenderParam) => void;

View File

@ -80,8 +80,10 @@ class OverlayBackground implements OverlayBackgroundInterface {
checkIsFieldCurrentlyFocused: () => this.checkIsFieldCurrentlyFocused(),
updateIsFieldCurrentlyFilling: ({ message }) => this.updateIsFieldCurrentlyFilling(message),
checkIsFieldCurrentlyFilling: () => this.checkIsFieldCurrentlyFilling(),
checkIsInlineMenuButtonVisible: ({ sender }) => this.checkIsInlineMenuButtonVisible(sender),
checkIsInlineMenuListVisible: ({ sender }) => this.checkIsInlineMenuListVisible(sender),
checkIsAutofillInlineMenuButtonVisible: ({ sender }) =>
this.checkIsAutofillInlineMenuButtonVisible(sender),
checkIsAutofillInlineMenuListVisible: ({ sender }) =>
this.checkIsAutofillInlineMenuListVisible(sender),
checkIsOverlayLoginCiphersPopulated: ({ sender }) =>
this.checkIsOverlayLoginCiphersPopulated(sender),
updateSubFrameData: ({ message, sender }) => this.updateSubFrameData(message, sender),
@ -873,18 +875,18 @@ class OverlayBackground implements OverlayBackgroundInterface {
return this.isFieldCurrentlyFilling;
}
private async checkIsInlineMenuButtonVisible(sender: chrome.runtime.MessageSender) {
private async checkIsAutofillInlineMenuButtonVisible(sender: chrome.runtime.MessageSender) {
return await BrowserApi.tabSendMessage(
sender.tab,
{ command: "checkIsInlineMenuButtonVisible" },
{ command: "checkIsAutofillInlineMenuButtonVisible" },
{ frameId: 0 },
);
}
private async checkIsInlineMenuListVisible(sender: chrome.runtime.MessageSender) {
private async checkIsAutofillInlineMenuListVisible(sender: chrome.runtime.MessageSender) {
return await BrowserApi.tabSendMessage(
sender.tab,
{ command: "checkIsInlineMenuListVisible" },
{ command: "checkIsAutofillInlineMenuListVisible" },
{ frameId: 0 },
);
}

View File

@ -5,8 +5,8 @@ export type InlineMenuExtensionMessageHandlers = {
closeInlineMenu: ({ message }: AutofillExtensionMessageParam) => void;
appendInlineMenuElementsToDom: ({ message }: AutofillExtensionMessageParam) => Promise<void>;
toggleInlineMenuHidden: ({ message }: AutofillExtensionMessageParam) => void;
checkIsInlineMenuButtonVisible: () => boolean;
checkIsInlineMenuListVisible: () => boolean;
checkIsAutofillInlineMenuButtonVisible: () => boolean;
checkIsAutofillInlineMenuListVisible: () => boolean;
};
export interface AutofillOverlayInlineMenuElements {

View File

@ -39,8 +39,8 @@ export class AutofillOverlayInlineMenuElements implements InlineMenuElementsInte
appendInlineMenuElementsToDom: ({ message }) => this.appendInlineMenuElements(message),
toggleInlineMenuHidden: ({ message }) =>
this.toggleInlineMenuHidden(message.isInlineMenuHidden),
checkIsInlineMenuButtonVisible: () => this.isInlineMenuButtonVisible(),
checkIsInlineMenuListVisible: () => this.isInlineMenuListVisible(),
checkIsAutofillInlineMenuButtonVisible: () => this.isInlineMenuButtonVisible(),
checkIsAutofillInlineMenuListVisible: () => this.isInlineMenuListVisible(),
};
constructor() {

View File

@ -1002,11 +1002,11 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
}
private async isInlineMenuButtonVisible() {
return (await this.sendExtensionMessage("checkIsInlineMenuButtonVisible")) === true;
return (await this.sendExtensionMessage("checkIsAutofillInlineMenuButtonVisible")) === true;
}
private async isInlineMenuListVisible() {
return (await this.sendExtensionMessage("checkIsInlineMenuListVisible")) === true;
return (await this.sendExtensionMessage("checkIsAutofillInlineMenuListVisible")) === true;
}
private async isInlineMenuCiphersPopulated() {