Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #4357 from darkdh/4350
Browse files Browse the repository at this point in the history
Defer setAutofill*Detail to frame.js
  • Loading branch information
bbondy authored Oct 4, 2016
2 parents a9a3f5e + f1b50bc commit 22cca69
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
25 changes: 5 additions & 20 deletions js/about/aboutActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,7 @@ const AboutActions = {
* Open a adding address dialog
*/
addAutofillAddress: function () {
AboutActions.dispatchAction({
actionType: WindowConstants.WINDOW_SET_AUTOFILL_ADDRESS_DETAIL,
currentDetail: {},
originalDetail: {}
})
ipc.sendToHost(messages.AUTOFILL_SET_ADDRESS, {}, {})
},

/**
Expand All @@ -221,22 +217,15 @@ const AboutActions = {
* @param {object} address - address to edit as per doc/state.md's autofillAddressDetail
*/
editAutofillAddress: function (address) {
AboutActions.dispatchAction({
actionType: WindowConstants.WINDOW_SET_AUTOFILL_ADDRESS_DETAIL,
currentDetail: address,
originalDetail: address
})
ipc.sendToHost(messages.AUTOFILL_SET_ADDRESS, address.toJS(), address.toJS())
},

/**
* Open a adding credit card dialog
*/
addAutofillCreditCard: function () {
AboutActions.dispatchAction({
actionType: WindowConstants.WINDOW_SET_AUTOFILL_CREDIT_CARD_DETAIL,
currentDetail: {month: '01', year: new Date().getFullYear().toString()},
originalDetail: {}
})
ipc.sendToHost(messages.AUTOFILL_SET_CREDIT_CARD,
{month: '01', year: new Date().getFullYear().toString()}, {})
},

/**
Expand All @@ -257,11 +246,7 @@ const AboutActions = {
* @param {object} card - credit card to edit as per doc/state.md's autofillCreditCardDetail
*/
editAutofillCreditCard: function (card) {
AboutActions.dispatchAction({
actionType: WindowConstants.WINDOW_SET_AUTOFILL_CREDIT_CARD_DETAIL,
currentDetail: card,
originalDetail: card
})
ipc.sendToHost(messages.AUTOFILL_SET_CREDIT_CARD, card.toJS(), card.toJS())
}
}
module.exports = AboutActions
8 changes: 8 additions & 0 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,14 @@ class Frame extends ImmutableComponent {
method = (clearBrowsingDataDetail) =>
windowActions.setClearBrowsingDataDetail(clearBrowsingDataDetail)
break
case messages.AUTOFILL_SET_ADDRESS:
method = (currentDetail, originalDetail) =>
windowActions.setAutofillAddressDetail(currentDetail, originalDetail)
break
case messages.AUTOFILL_SET_CREDIT_CARD:
method = (currentDetail, originalDetail) =>
windowActions.setAutofillCreditCardDetail(currentDetail, originalDetail)
break
}
method.apply(this, e.args)
})
Expand Down
2 changes: 2 additions & 0 deletions js/constants/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ const messages = {
IMPORT_BROWSER_DATA_NOW: _,
IMPORTER_LIST: _,
// Autofill
AUTOFILL_SET_ADDRESS: _,
AUTOFILL_SET_CREDIT_CARD: _,
AUTOFILL_ADDRESSES_UPDATED: _,
AUTOFILL_CREDIT_CARDS_UPDATED: _,
// HTTPS
Expand Down

0 comments on commit 22cca69

Please sign in to comment.