Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: components/autofill/core/browser/autofill_manager.h

Issue 1899893002: Card unmasking without form filling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_manager.h
diff --git a/components/autofill/core/browser/autofill_manager.h b/components/autofill/core/browser/autofill_manager.h
index a364c5a481733b2d082e7b73e003e07974bdaf92..8646413dd5b17b85e8cfebdc9ca68698c8e98be2 100644
--- a/components/autofill/core/browser/autofill_manager.h
+++ b/components/autofill/core/browser/autofill_manager.h
@@ -64,6 +64,13 @@ class FormStructureBrowserTest;
struct FormData;
struct FormFieldData;
+// The signature for the callback to be invoked when a card is unmasked.
+using UnmaskCallback = base::Callback<void(
+ bool, // success
+ const CreditCard&, // original card
+ const CreditCard&, // unmasked card
+ const base::string16&)>; // the cvc for the card
+
// Manages saving and restoring the user's personal information entered into web
// forms. One per frame; owned by the AutofillDriver.
class AutofillManager : public AutofillDownloadManager::Observer,
@@ -89,6 +96,14 @@ class AutofillManager : public AutofillDownloadManager::Observer,
void ShowAutofillSettings();
+ // Prompts the user for the CVC, uses the CVC to unmask the
+ // |maybe_masked_card| (if it's masked), and invokes |callback| with the
+ // unmasked card and the CVC. Only one unmask request should be active at a
+ // time. If there's already a pending unmask request, this |callback| is
+ // invoked immediately to indicate failure to the caller.
+ void UnmaskCardForPayment(const CreditCard& maybe_masked_card,
+ const UnmaskCallback& callback);
+
// Whether the |field| should show an entry to scan a credit card.
virtual bool ShouldShowScanCreditCard(const FormData& form,
const FormFieldData& field);
@@ -281,6 +296,12 @@ class AutofillManager : public AutofillDownloadManager::Observer,
std::unique_ptr<base::DictionaryValue> legal_message) override;
void OnDidUploadCard(AutofillClient::PaymentsRpcResult result) override;
+ // UnmaskCallback:
Mathieu 2016/04/19 13:24:25 Mention here or elsewhere why you are not using th
+ void OnCardUnmasked(bool success,
+ const CreditCard& original_card,
+ const CreditCard& unmasked_card,
+ const base::string16& unused_cvc);
+
// Saves risk data in |unmasking_risk_data_| and calls UnmaskCard if the user
// has accepted the prompt.
void OnDidGetUnmaskRiskData(const std::string& risk_data);
@@ -497,6 +518,7 @@ class AutofillManager : public AutofillDownloadManager::Observer,
// Collected information about a pending unmask request, and data about the
// form.
+ std::unique_ptr<UnmaskCallback> unmask_callback_;
payments::PaymentsClient::UnmaskRequestDetails unmask_request_;
int unmasking_query_id_;
FormData unmasking_form_;

Powered by Google App Engine
This is Rietveld 408576698