Commit 6373716f authored by Liquan (Max) Gu's avatar Liquan (Max) Gu Committed by Chromium LUCI CQ

[WebLayer] Encapsulate SettingsAutofillAndPaymentsObserver in Ui

Context:
Since SettingsAutofillAndPaymentsObserver is autofill logic and
PaymentUiService is in charge of the autofill service, the observer
class should go into PaymentUiService.

Changes:
Moved SettingsAutofillAndPaymentsObserver from:
* CPRService#notifyPaymentUiOfPendingApps to PUiService#setPaymentApps
* CPRService#close to PUiService#close

Bug: 1025619
Change-Id: I224cf06276b26857775c26d2a030fd5fcc7d3295
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2574602Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834449}
parent 8d07f500
......@@ -557,7 +557,6 @@ public class ChromePaymentRequestService
}
mPaymentUiService.close();
SettingsAutofillAndPaymentsObserver.getInstance().unregisterObserver(mPaymentUiService);
if (mPaymentHandlerHost != null) {
mPaymentHandlerHost.destroy();
......@@ -620,8 +619,6 @@ public class ChromePaymentRequestService
RecordHistogram.recordSparseHistogram(
"PaymentRequest.MissingPaymentFields", missingFields);
}
SettingsAutofillAndPaymentsObserver.getInstance().registerObserver(mPaymentUiService);
}
// Implements BrowserPaymentRequest:
......
......@@ -34,7 +34,7 @@ public class SettingsAutofillAndPaymentsObserver {
void onAddressDeleted(String guid);
/**
* Called when user updates or addes a credit card.
* Called when user updates or adds a credit card.
*
* @param card The updated or added card.
*/
......
......@@ -382,6 +382,8 @@ public class PaymentUiService implements SettingsAutofillAndPaymentsObserver.Obs
Section.PAYMENT_METHOD, apps.size(), !apps.isEmpty() && apps.get(0).isComplete());
updateAppModifiedTotals();
SettingsAutofillAndPaymentsObserver.getInstance().registerObserver(this);
}
/** Set the AutofillPaymentAppCreator. */
......@@ -1691,6 +1693,8 @@ public class PaymentUiService implements SettingsAutofillAndPaymentsObserver.Obs
mPaymentMethodsSection = null;
}
SettingsAutofillAndPaymentsObserver.getInstance().unregisterObserver(this);
removeLeavingTabObservers();
destroyCurrencyFormatters();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment