diff --git a/apps/browser/src/autofill/popup/settings/autofill.component.ts b/apps/browser/src/autofill/popup/settings/autofill.component.ts
index 341f5b9d63..d9038b0eb2 100644
--- a/apps/browser/src/autofill/popup/settings/autofill.component.ts
+++ b/apps/browser/src/autofill/popup/settings/autofill.component.ts
@@ -7,7 +7,6 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { UriMatchType } from "@bitwarden/common/vault/enums";
-import { DialogService } from "@bitwarden/components";
import { BrowserApi } from "../../../platform/browser/browser-api";
import { flagEnabled } from "../../../platform/flags";
@@ -18,11 +17,10 @@ import { AutofillOverlayVisibility } from "../../utils/autofill-overlay.enum";
templateUrl: "autofill.component.html",
})
export class AutofillComponent implements OnInit {
- protected canOverrideBrowserAutofillSetting = false;
- protected defaultBrowserAutofillDisabled = false;
protected isAutoFillOverlayFlagEnabled = false;
protected autoFillOverlayVisibility: number;
protected autoFillOverlayVisibilityOptions: any[];
+ protected disablePasswordManagerLink: string;
enableAutoFillOnPageLoad = false;
autoFillOnPageLoadDefault = false;
autoFillOnPageLoadOptions: any[];
@@ -37,7 +35,6 @@ export class AutofillComponent implements OnInit {
private platformUtilsService: PlatformUtilsService,
private configService: ConfigServiceAbstraction,
private settingsService: SettingsService,
- private dialogService: DialogService,
) {
this.autoFillOverlayVisibilityOptions = [
{
@@ -67,13 +64,10 @@ export class AutofillComponent implements OnInit {
];
this.accountSwitcherEnabled = flagEnabled("accountSwitching");
+ this.disablePasswordManagerLink = this.getDisablePasswordManagerLink();
}
async ngOnInit() {
- this.canOverrideBrowserAutofillSetting = this.platformUtilsService.isChrome();
-
- this.defaultBrowserAutofillDisabled = await this.browserAutofillSettingCurrentlyOverridden();
-
this.isAutoFillOverlayFlagEnabled = await this.configService.getFeatureFlag(
FeatureFlag.AutofillOverlay,
);
@@ -91,54 +85,8 @@ export class AutofillComponent implements OnInit {
await this.setAutofillKeyboardHelperText(command);
}
- async updateDefaultBrowserAutofillDisabled() {
- const privacyPermissionGranted = await this.privacyPermissionGranted();
- if (!this.defaultBrowserAutofillDisabled && !privacyPermissionGranted) {
- return;
- }
-
- if (
- !privacyPermissionGranted &&
- !(await BrowserApi.requestPermission({ permissions: ["privacy"] }))
- ) {
- await this.dialogService.openSimpleDialog({
- title: { key: "extensionPrivacyPermissionNotGrantedTitle" },
- content: { key: "extensionPrivacyPermissionNotGrantedDescription" },
- acceptButtonText: { key: "ok" },
- cancelButtonText: null,
- type: "warning",
- });
- this.defaultBrowserAutofillDisabled = false;
-
- return;
- }
-
- await BrowserApi.updateDefaultBrowserAutofillSettings(!this.defaultBrowserAutofillDisabled);
- }
-
async updateAutoFillOverlayVisibility() {
await this.settingsService.setAutoFillOverlayVisibility(this.autoFillOverlayVisibility);
-
- if (
- this.autoFillOverlayVisibility === AutofillOverlayVisibility.Off ||
- !this.canOverrideBrowserAutofillSetting ||
- (await this.browserAutofillSettingCurrentlyOverridden())
- ) {
- return;
- }
-
- const permissionGranted = await this.privacyPermissionGranted();
- const contentKey = permissionGranted
- ? "overrideBrowserAutofillDescription"
- : "overrideBrowserAutofillPrivacyRequiredDescription";
- await this.dialogService.openSimpleDialog({
- title: { key: "overrideBrowserAutofillTitle" },
- content: { key: contentKey },
- acceptButtonText: { key: "turnOn" },
- acceptAction: async () => await this.handleOverrideDialogAccept(),
- cancelButtonText: { key: "ignore" },
- type: "info",
- });
}
async updateAutoFillOnPageLoad() {
@@ -175,24 +123,25 @@ export class AutofillComponent implements OnInit {
}
}
- private handleOverrideDialogAccept = async () => {
- this.defaultBrowserAutofillDisabled = true;
- await this.updateDefaultBrowserAutofillDisabled();
- };
-
- async browserAutofillSettingCurrentlyOverridden() {
- if (!this.canOverrideBrowserAutofillSetting) {
- return false;
+ private getDisablePasswordManagerLink(): string {
+ if (this.platformUtilsService.isChrome()) {
+ return "chrome://settings/autofill";
+ }
+ if (this.platformUtilsService.isOpera()) {
+ return "opera://settings/autofill";
+ }
+ if (this.platformUtilsService.isEdge()) {
+ return "edge://settings/passwords";
+ }
+ if (this.platformUtilsService.isVivaldi()) {
+ return "vivaldi://settings/autofill";
}
- if (!(await this.privacyPermissionGranted())) {
- return false;
- }
-
- return await BrowserApi.browserAutofillSettingsOverridden();
+ return "https://bitwarden.com/help/disable-browser-autofill/";
}
- async privacyPermissionGranted(): Promise {
- return await BrowserApi.permissionsGranted(["privacy"]);
+ protected openDisablePasswordManagerLink(event: Event) {
+ event.preventDefault();
+ BrowserApi.createNewTab(this.disablePasswordManagerLink);
}
}
diff --git a/apps/browser/src/manifest.json b/apps/browser/src/manifest.json
index ab56206aa5..2bd032495c 100644
--- a/apps/browser/src/manifest.json
+++ b/apps/browser/src/manifest.json
@@ -59,7 +59,7 @@
"webRequest",
"webRequestBlocking"
],
- "optional_permissions": ["nativeMessaging", "privacy"],
+ "optional_permissions": ["nativeMessaging"],
"content_security_policy": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'",
"sandbox": {
"pages": ["overlay/button.html", "overlay/list.html"],
diff --git a/apps/browser/src/manifest.v3.json b/apps/browser/src/manifest.v3.json
index 937f141190..dba40744e7 100644
--- a/apps/browser/src/manifest.v3.json
+++ b/apps/browser/src/manifest.v3.json
@@ -69,7 +69,7 @@
"alarms",
"scripting"
],
- "optional_permissions": ["nativeMessaging", "privacy"],
+ "optional_permissions": ["nativeMessaging"],
"host_permissions": ["http://*/*", "https://*/*"],
"content_security_policy": {
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'",
diff --git a/apps/browser/src/platform/browser/browser-api.ts b/apps/browser/src/platform/browser/browser-api.ts
index 8330d0797d..aaab7e113a 100644
--- a/apps/browser/src/platform/browser/browser-api.ts
+++ b/apps/browser/src/platform/browser/browser-api.ts
@@ -439,33 +439,4 @@ export class BrowserApi {
});
});
}
-
- /**
- * Identifies if the browser autofill settings are overridden by the extension.
- */
- static async browserAutofillSettingsOverridden(): Promise {
- const autofillAddressOverridden: boolean = await new Promise((resolve) =>
- chrome.privacy.services.autofillAddressEnabled.get({}, (details) =>
- resolve(details.levelOfControl === "controlled_by_this_extension" && !details.value),
- ),
- );
-
- const autofillCreditCardOverridden: boolean = await new Promise((resolve) =>
- chrome.privacy.services.autofillCreditCardEnabled.get({}, (details) =>
- resolve(details.levelOfControl === "controlled_by_this_extension" && !details.value),
- ),
- );
-
- return autofillAddressOverridden && autofillCreditCardOverridden;
- }
-
- /**
- * Updates the browser autofill settings to the given value.
- *
- * @param value - Determines whether to enable or disable the autofill settings.
- */
- static async updateDefaultBrowserAutofillSettings(value: boolean) {
- chrome.privacy.services.autofillAddressEnabled.set({ value });
- chrome.privacy.services.autofillCreditCardEnabled.set({ value });
- }
}