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

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

Issue 772253003: Create an autofill Suggestion class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years 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 33a41b1ffa7f7796c2d57e073dba17937750a126..20d2dd30fd0c535f1566504e78c5e8e3875a970b 100644
--- a/components/autofill/core/browser/autofill_manager.h
+++ b/components/autofill/core/browser/autofill_manager.h
@@ -197,18 +197,19 @@ class AutofillManager : public AutofillDownloadManager::Observer {
const base::TimeTicks& interaction_time,
const base::TimeTicks& submission_time);
- // Maps GUIDs to and from IDs that are used to identify profiles and credit
- // cards sent to and from the renderer process.
- virtual int GUIDToID(const PersonalDataManager::GUIDPair& guid) const;
- virtual const PersonalDataManager::GUIDPair IDToGUID(int id) const;
+ // Maps SuggestionBackendID to and from an integer identifying it. Two of
+ // these intermediate integers are packed by MakeFrontendID to make the IDs
+ // that this class generates for the UI and for IPC.
+ virtual int BackendIDToInt(const SuggestionBackendID& backend_id) const;
+ virtual SuggestionBackendID IntToBackendID(int int_id) const;
// Methods for packing and unpacking credit card and profile IDs for sending
// and receiving to and from the renderer process.
- int PackGUIDs(const PersonalDataManager::GUIDPair& cc_guid,
- const PersonalDataManager::GUIDPair& profile_guid) const;
- void UnpackGUIDs(int id,
- PersonalDataManager::GUIDPair* cc_guid,
- PersonalDataManager::GUIDPair* profile_guid) const;
+ int MakeFrontendID(const SuggestionBackendID& cc_backend_id,
+ const SuggestionBackendID& profile_backend_id) const;
+ void SplitFrontendID(int frontend_id,
+ SuggestionBackendID* cc_backend_id,
+ SuggestionBackendID* profile_backend_id) const;
const AutofillMetrics* metric_logger() const { return metric_logger_.get(); }
void set_metric_logger(const AutofillMetrics* metric_logger);
@@ -277,22 +278,16 @@ class AutofillManager : public AutofillDownloadManager::Observer {
// Returns a list of values from the stored profiles that match |type| and the
// value of |field| and returns the labels of the matching profiles. |labels|
// is filled with the Profile label.
- void GetProfileSuggestions(const FormStructure& form,
- const FormFieldData& field,
- const AutofillField& autofill_field,
- std::vector<base::string16>* values,
- std::vector<base::string16>* labels,
- std::vector<base::string16>* icons,
- std::vector<int>* unique_ids) const;
+ std::vector<Suggestion> GetProfileSuggestions(
+ const FormStructure& form,
+ const FormFieldData& field,
+ const AutofillField& autofill_field) const;
// Returns a list of values from the stored credit cards that match |type| and
// the value of |field| and returns the labels of the matching credit cards.
- void GetCreditCardSuggestions(const FormFieldData& field,
- const AutofillType& type,
- std::vector<base::string16>* values,
- std::vector<base::string16>* labels,
- std::vector<base::string16>* icons,
- std::vector<int>* unique_ids) const;
+ std::vector<Suggestion> GetCreditCardSuggestions(
+ const FormFieldData& field,
+ const AutofillType& type) const;
// Parses the forms using heuristic matching and querying the Autofill server.
void ParseForms(const std::vector<FormData>& forms);
@@ -356,9 +351,11 @@ class AutofillManager : public AutofillDownloadManager::Observer {
// Our copy of the form data.
ScopedVector<FormStructure> form_structures_;
- // GUID to ID mapping. We keep two maps to convert back and forth.
- mutable std::map<PersonalDataManager::GUIDPair, int> guid_id_map_;
- mutable std::map<int, PersonalDataManager::GUIDPair> id_guid_map_;
+ // SuggestionBackendID to ID mapping. We keep two maps to convert back and
+ // forth. These should be used only by BackendIDToInt and IntToBackendID.
+ // Note that the integers are not frontend IDs.
+ mutable std::map<SuggestionBackendID, int> backend_to_int_map_;
+ mutable std::map<int, SuggestionBackendID> int_to_backend_map_;
// Delegate to perform external processing (display, selection) on
// our behalf. Weak.

Powered by Google App Engine
This is Rietveld 408576698