Bug 1562328 - Hook up the enable and options Sync buttons to their respective sites. r=MattN,lina

Differential Revision: https://phabricator.services.mozilla.com/D38736

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jared Wein 2019-07-30 22:44:27 +00:00
Родитель 0f2338c828
Коммит a8360e85b5
4 изменённых файлов: 48 добавлений и 3 удалений

Просмотреть файл

@ -136,6 +136,8 @@ let LEGACY_ACTORS = {
AboutLoginsOpenPreferences: { wantUntrusted: true },
AboutLoginsOpenSite: { wantUntrusted: true },
AboutLoginsRecordTelemetryEvent: { wantUntrusted: true },
AboutLoginsSyncEnable: { wantUntrusted: true },
AboutLoginsSyncOptions: { wantUntrusted: true },
AboutLoginsUpdateLogin: { wantUntrusted: true },
},
messages: [
@ -632,6 +634,8 @@ const listeners = {
"AboutLogins:OpenMobileIos": ["AboutLoginsParent"],
"AboutLogins:OpenSite": ["AboutLoginsParent"],
"AboutLogins:Subscribe": ["AboutLoginsParent"],
"AboutLogins:SyncEnable": ["AboutLoginsParent"],
"AboutLogins:SyncOptions": ["AboutLoginsParent"],
"AboutLogins:UpdateLogin": ["AboutLoginsParent"],
"Content:Click": ["ContentClick"],
ContentSearch: ["ContentSearch"],

Просмотреть файл

@ -132,6 +132,14 @@ class AboutLoginsChild extends ActorChild {
}
break;
}
case "AboutLoginsSyncEnable": {
this.mm.sendAsyncMessage("AboutLogins:SyncEnable");
break;
}
case "AboutLoginsSyncOptions": {
this.mm.sendAsyncMessage("AboutLogins:SyncOptions");
break;
}
case "AboutLoginsUpdateLogin": {
this.mm.sendAsyncMessage("AboutLogins:UpdateLogin", {
login: event.detail,

Просмотреть файл

@ -116,6 +116,16 @@ var AboutLoginsParent = {
Services.logins.removeLogin(login);
break;
}
case "AboutLogins:SyncEnable": {
message.target.ownerGlobal.gSync.openFxAEmailFirstPage(
"password-manager"
);
break;
}
case "AboutLogins:SyncOptions": {
message.target.ownerGlobal.gSync.openFxAManagePage("password-manager");
break;
}
case "AboutLogins:Import": {
try {
MigrationUtils.showMigrationWizard(message.target.ownerGlobal, [
@ -246,6 +256,11 @@ var AboutLoginsParent = {
const logins = await this.getAllLogins();
try {
messageManager.sendAsyncMessage("AboutLogins:AllLogins", logins);
let syncState = this.getSyncState();
messageManager.sendAsyncMessage("AboutLogins:SyncState", syncState);
this.updatePasswordSyncNotificationState();
if (!BREACH_ALERTS_ENABLED) {
return;
}
@ -257,9 +272,6 @@ var AboutLoginsParent = {
"AboutLogins:UpdateBreaches",
breachesByLoginGUID
);
let syncState = this.getSyncState();
messageManager.sendAsyncMessage("AboutLogins:SyncState", syncState);
this.updatePasswordSyncNotificationState();
} catch (ex) {
if (ex.result != Cr.NS_ERROR_NOT_INITIALIZED) {
throw ex;

Просмотреть файл

@ -20,9 +20,30 @@ export default class FxAccountsButton extends HTMLElement {
this._loggedInView = shadowRoot.querySelector(".logged-in-view");
this._emailText = shadowRoot.querySelector(".fxaccount-email");
this._avatarButton.addEventListener("click", this);
this._enableButton.addEventListener("click", this);
this.render();
}
handleEvent(event) {
if (event.target == this._avatarButton) {
document.dispatchEvent(
new CustomEvent("AboutLoginsSyncOptions", {
bubbles: true,
})
);
return;
}
if (event.target == this._enableButton) {
document.dispatchEvent(
new CustomEvent("AboutLoginsSyncEnable", {
bubbles: true,
})
);
}
}
render() {
this._loggedOutView.hidden = !!this._loggedIn;
this._loggedInView.hidden = !this._loggedIn;