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

Unified Diff: chrome/browser/extensions/api/autofill_private/autofill_private_api.cc

Issue 1957043002: Separate the listeners and getters for the Autofill Private API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill-lists.gitbr
Patch Set: update histogram.xml and test Created 4 years, 7 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: chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc b/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
index e3b92654f2a5d3eed7159ee5a0b80fe57d7b8432..ce3ab6460e1c5437b1c33fd2769bf15154289f4e 100644
--- a/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
+++ b/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
@@ -12,6 +12,7 @@
#include "base/values.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/extensions/api/autofill_private/autofill_util.h"
#include "chrome/common/extensions/api/autofill_private.h"
#include "chrome/grit/generated_resources.h"
#include "components/autofill/core/browser/autofill_profile.h"
@@ -300,6 +301,29 @@ ExtensionFunction::ResponseAction
}
////////////////////////////////////////////////////////////////////////////////
+// AutofillPrivateGetAddressListFunction
+
+AutofillPrivateGetAddressListFunction::AutofillPrivateGetAddressListFunction()
+ : chrome_details_(this) {}
+
+AutofillPrivateGetAddressListFunction::
+ ~AutofillPrivateGetAddressListFunction() {}
+
+ExtensionFunction::ResponseAction AutofillPrivateGetAddressListFunction::Run() {
+ autofill::PersonalDataManager* personal_data =
+ autofill::PersonalDataManagerFactory::GetForProfile(
+ chrome_details_.GetProfile());
+
+ DCHECK(personal_data && personal_data->IsDataLoaded());
+
+ autofill_util::AddressEntryList addressList =
+ extensions::autofill_util::GenerateAddressList(*personal_data);
+
+ return RespondNow(ArgumentList(
+ api::autofill_private::GetAddressList::Results::Create(addressList)));
+}
+
+////////////////////////////////////////////////////////////////////////////////
// AutofillPrivateSaveCreditCardFunction
AutofillPrivateSaveCreditCardFunction::AutofillPrivateSaveCreditCardFunction()
@@ -437,4 +461,30 @@ ExtensionFunction::ResponseAction AutofillPrivateMaskCreditCardFunction::Run() {
return RespondNow(NoArguments());
}
+////////////////////////////////////////////////////////////////////////////////
+// AutofillPrivateGetCreditCardListFunction
+
+AutofillPrivateGetCreditCardListFunction::
+ AutofillPrivateGetCreditCardListFunction()
+ : chrome_details_(this) {}
+
+AutofillPrivateGetCreditCardListFunction::
+ ~AutofillPrivateGetCreditCardListFunction() {}
+
+ExtensionFunction::ResponseAction
+AutofillPrivateGetCreditCardListFunction::Run() {
+ autofill::PersonalDataManager* personal_data =
+ autofill::PersonalDataManagerFactory::GetForProfile(
+ chrome_details_.GetProfile());
+
+ DCHECK(personal_data && personal_data->IsDataLoaded());
+
+ autofill_util::CreditCardEntryList creditCardList =
+ extensions::autofill_util::GenerateCreditCardList(*personal_data);
+
+ return RespondNow(
+ ArgumentList(api::autofill_private::GetCreditCardList::Results::Create(
+ creditCardList)));
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698