Commit caf14779 authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Chromium LUCI CQ

[Autofill] Introduce AutofillClient::ConfirmSaveAddressProfile

This CL introduces a method in Autofill client that opens the Save
Address bubble.

No implementation is added in this CL. The method is currently empty.
Follow up CLs will add implementation for this on various platforms.

Bug: 1135178
Change-Id: I8d67a4a097013785eddc28a0981da71e3fc10ba6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2632587Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Reviewed-by: default avatarMatthias Körber <koerber@google.com>
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844866}
parent fa1e4cd1
......@@ -165,6 +165,12 @@ void AwAutofillClient::ConfirmCreditCardFillAssist(
NOTIMPLEMENTED();
}
void AwAutofillClient::ConfirmSaveAddressProfile(
const autofill::AutofillProfile& profile,
AddressProfileSavePromptCallback callback) {
NOTIMPLEMENTED();
}
bool AwAutofillClient::HasCreditCardScanFeature() {
return false;
}
......
......@@ -99,6 +99,9 @@ class AwAutofillClient : public autofill::AutofillClient,
void CreditCardUploadCompleted(bool card_saved) override;
void ConfirmCreditCardFillAssist(const autofill::CreditCard& card,
base::OnceClosure callback) override;
void ConfirmSaveAddressProfile(
const autofill::AutofillProfile& profile,
AddressProfileSavePromptCallback callback) override;
bool HasCreditCardScanFeature() override;
void ScanCreditCard(CreditCardScanCallback callback) override;
void ShowAutofillPopup(
......
......@@ -497,6 +497,16 @@ void ChromeAutofillClient::ConfirmCreditCardFillAssist(
#endif
}
void ChromeAutofillClient::ConfirmSaveAddressProfile(
const AutofillProfile& profile,
AddressProfileSavePromptCallback callback) {
#if defined(OS_ANDROID)
// TODO(crbug.com/1167061): Implement.
#else
// TODO(crbug.com/1167060): Implement.
#endif
}
bool ChromeAutofillClient::HasCreditCardScanFeature() {
return CreditCardScannerController::HasCreditCardScanFeature();
}
......
......@@ -125,6 +125,9 @@ class ChromeAutofillClient
void CreditCardUploadCompleted(bool card_saved) override;
void ConfirmCreditCardFillAssist(const CreditCard& card,
base::OnceClosure callback) override;
void ConfirmSaveAddressProfile(
const AutofillProfile& profile,
AddressProfileSavePromptCallback callback) override;
bool HasCreditCardScanFeature() override;
void ScanCreditCard(CreditCardScanCallback callback) override;
void ShowAutofillPopup(
......
......@@ -58,6 +58,7 @@ enum class Channel;
namespace autofill {
class AddressNormalizer;
class AutofillProfile;
class AutocompleteHistoryManager;
class AutofillOfferManager;
class AutofillPopupDelegate;
......@@ -134,6 +135,12 @@ class AutofillClient : public RiskDataLoader {
FIDO = 2,
};
enum class SaveAddressProfileOfferUserDecision {
kAccepted,
kDeclined,
kIgnored,
};
// Used for explicitly requesting the user to enter/confirm cardholder name,
// expiration date month and year.
struct UserProvidedCardDetails {
......@@ -235,6 +242,10 @@ class AutofillClient : public RiskDataLoader {
typedef base::RepeatingCallback<void(WebauthnDialogCallbackType)>
WebauthnDialogCallback;
using AddressProfileSavePromptCallback =
base::OnceCallback<void(SaveAddressProfileOfferUserDecision,
autofill::AutofillProfile profile)>;
~AutofillClient() override = default;
// Returns the channel for the installation. In branded builds, this will be
......@@ -434,6 +445,12 @@ class AutofillClient : public RiskDataLoader {
virtual void ConfirmCreditCardFillAssist(const CreditCard& card,
base::OnceClosure callback) = 0;
// Shows the offer-to-save address profile bubble. Runs |callback| once the
// user makes a decision with respect to the offer-to-save prompt.
virtual void ConfirmSaveAddressProfile(
const AutofillProfile& profile,
AddressProfileSavePromptCallback callback) = 0;
// Returns true if both the platform and the device support scanning credit
// cards. Should be called before ScanCreditCard().
virtual bool HasCreditCardScanFeature() = 0;
......
......@@ -211,6 +211,10 @@ void TestAutofillClient::ConfirmCreditCardFillAssist(
std::move(callback).Run();
}
void TestAutofillClient::ConfirmSaveAddressProfile(
const AutofillProfile& profile,
AddressProfileSavePromptCallback callback) {}
bool TestAutofillClient::HasCreditCardScanFeature() {
return false;
}
......
......@@ -120,6 +120,9 @@ class TestAutofillClient : public AutofillClient {
void CreditCardUploadCompleted(bool card_saved) override;
void ConfirmCreditCardFillAssist(const CreditCard& card,
base::OnceClosure callback) override;
void ConfirmSaveAddressProfile(
const AutofillProfile& profile,
AddressProfileSavePromptCallback callback) override;
bool HasCreditCardScanFeature() override;
void ScanCreditCard(CreditCardScanCallback callback) override;
void ShowAutofillPopup(
......
......@@ -90,6 +90,9 @@ class ChromeAutofillClientIOS : public AutofillClient {
void CreditCardUploadCompleted(bool card_saved) override;
void ConfirmCreditCardFillAssist(const CreditCard& card,
base::OnceClosure callback) override;
void ConfirmSaveAddressProfile(
const AutofillProfile& profile,
AddressProfileSavePromptCallback callback) override;
bool HasCreditCardScanFeature() override;
void ScanCreditCard(CreditCardScanCallback callback) override;
void ShowAutofillPopup(
......
......@@ -311,6 +311,12 @@ void ChromeAutofillClientIOS::ConfirmCreditCardFillAssist(
}
}
void ChromeAutofillClientIOS::ConfirmSaveAddressProfile(
const AutofillProfile& profile,
AddressProfileSavePromptCallback callback) {
// TODO(crbug.com/1167062): Implement.
}
bool ChromeAutofillClientIOS::HasCreditCardScanFeature() {
return false;
}
......
......@@ -83,6 +83,9 @@ class WebViewAutofillClientIOS : public AutofillClient {
void CreditCardUploadCompleted(bool card_saved) override;
void ConfirmCreditCardFillAssist(const CreditCard& card,
base::OnceClosure callback) override;
void ConfirmSaveAddressProfile(
const AutofillProfile& profile,
AddressProfileSavePromptCallback callback) override;
bool HasCreditCardScanFeature() override;
void ScanCreditCard(CreditCardScanCallback callback) override;
void ShowAutofillPopup(
......
......@@ -219,6 +219,10 @@ void WebViewAutofillClientIOS::ConfirmCreditCardFillAssist(
const CreditCard& card,
base::OnceClosure callback) {}
void WebViewAutofillClientIOS::ConfirmSaveAddressProfile(
const AutofillProfile& profile,
AddressProfileSavePromptCallback callback) {}
bool WebViewAutofillClientIOS::HasCreditCardScanFeature() {
return false;
}
......
......@@ -203,6 +203,12 @@ void AutofillClientImpl::ConfirmCreditCardFillAssist(
NOTREACHED();
}
void AutofillClientImpl::ConfirmSaveAddressProfile(
const autofill::AutofillProfile& profile,
AddressProfileSavePromptCallback callback) {
NOTREACHED();
}
bool AutofillClientImpl::HasCreditCardScanFeature() {
NOTREACHED();
return false;
......
......@@ -96,6 +96,9 @@ class AutofillClientImpl
void CreditCardUploadCompleted(bool card_saved) override;
void ConfirmCreditCardFillAssist(const autofill::CreditCard& card,
base::OnceClosure callback) override;
void ConfirmSaveAddressProfile(
const autofill::AutofillProfile& profile,
AddressProfileSavePromptCallback callback) override;
bool HasCreditCardScanFeature() override;
void ScanCreditCard(CreditCardScanCallback callback) override;
void ShowAutofillPopup(
......
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