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

Side by Side Diff: components/autofill/core/browser/personal_data_manager.h

Issue 2033323003: Revert of [Autofill] Sort profiles and credit cards by frecency in PaymentRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 virtual const std::vector<AutofillProfile*>& GetProfiles() const; 173 virtual const std::vector<AutofillProfile*>& GetProfiles() const;
174 virtual const std::vector<AutofillProfile*>& web_profiles() const; 174 virtual const std::vector<AutofillProfile*>& web_profiles() const;
175 // Returns just LOCAL_CARD cards. 175 // Returns just LOCAL_CARD cards.
176 virtual const std::vector<CreditCard*>& GetLocalCreditCards() const; 176 virtual const std::vector<CreditCard*>& GetLocalCreditCards() const;
177 // Returns all credit cards, server and local. 177 // Returns all credit cards, server and local.
178 virtual const std::vector<CreditCard*>& GetCreditCards() const; 178 virtual const std::vector<CreditCard*>& GetCreditCards() const;
179 179
180 // Returns true if there is some data synced from Wallet. 180 // Returns true if there is some data synced from Wallet.
181 bool HasServerData() const; 181 bool HasServerData() const;
182 182
183 // Returns the profiles to suggest to the user, ordered by frecency.
184 const std::vector<AutofillProfile*> GetProfilesToSuggest() const;
185
186 // Loads profiles that can suggest data for |type|. |field_contents| is the 183 // Loads profiles that can suggest data for |type|. |field_contents| is the
187 // part the user has already typed. |field_is_autofilled| is true if the field 184 // part the user has already typed. |field_is_autofilled| is true if the field
188 // has already been autofilled. |other_field_types| represents the rest of 185 // has already been autofilled. |other_field_types| represents the rest of
189 // form. 186 // form.
190 std::vector<Suggestion> GetProfileSuggestions( 187 std::vector<Suggestion> GetProfileSuggestions(
191 const AutofillType& type, 188 const AutofillType& type,
192 const base::string16& field_contents, 189 const base::string16& field_contents,
193 bool field_is_autofilled, 190 bool field_is_autofilled,
194 const std::vector<ServerFieldType>& other_field_types); 191 const std::vector<ServerFieldType>& other_field_types);
195 192
196 // Returns the credit cards to suggest to the user. Those have been deduped
197 // and ordered by frecency with the expired cards put at the end of the
198 // vector.
199 const std::vector<CreditCard*> GetCreditCardsToSuggest() const;
200
201 // Gets credit cards that can suggest data for |type|. See 193 // Gets credit cards that can suggest data for |type|. See
202 // GetProfileSuggestions for argument descriptions. The variant in each 194 // GetProfileSuggestions for argument descriptions. The variant in each
203 // GUID pair should be ignored. 195 // GUID pair should be ignored.
204 std::vector<Suggestion> GetCreditCardSuggestions( 196 std::vector<Suggestion> GetCreditCardSuggestions(
205 const AutofillType& type, 197 const AutofillType& type,
206 const base::string16& field_contents); 198 const base::string16& field_contents);
207 199
208 // Re-loads profiles and credit cards from the WebDatabase asynchronously. 200 // Re-loads profiles and credit cards from the WebDatabase asynchronously.
209 // In the general case, this is a no-op and will re-create the same 201 // In the general case, this is a no-op and will re-create the same
210 // in-memory model as existed prior to the call. If any change occurred to 202 // in-memory model as existed prior to the call. If any change occurred to
(...skipping 28 matching lines...) Expand all
239 231
240 // Returns our best guess for the country a user is likely to use when 232 // Returns our best guess for the country a user is likely to use when
241 // inputting a new address. The value is calculated once and cached, so it 233 // inputting a new address. The value is calculated once and cached, so it
242 // will only update when Chrome is restarted. 234 // will only update when Chrome is restarted.
243 virtual const std::string& GetDefaultCountryCodeForNewAddress() const; 235 virtual const std::string& GetDefaultCountryCodeForNewAddress() const;
244 236
245 // De-dupe credit card to suggest. Full server cards are prefered over their 237 // De-dupe credit card to suggest. Full server cards are prefered over their
246 // local duplicates, and local cards are preferred over their masked server 238 // local duplicates, and local cards are preferred over their masked server
247 // card duplicate. 239 // card duplicate.
248 static void DedupeCreditCardToSuggest( 240 static void DedupeCreditCardToSuggest(
249 std::list<CreditCard*>* cards_to_suggest); 241 std::list<const CreditCard*>* cards_to_suggest);
250 242
251 protected: 243 protected:
252 // Only PersonalDataManagerFactory and certain tests can create instances of 244 // Only PersonalDataManagerFactory and certain tests can create instances of
253 // PersonalDataManager. 245 // PersonalDataManager.
254 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); 246 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast);
255 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); 247 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup);
256 friend class autofill::AutofillInteractiveTest; 248 friend class autofill::AutofillInteractiveTest;
257 friend class autofill::AutofillTest; 249 friend class autofill::AutofillTest;
258 friend class autofill::PersonalDataManagerFactory; 250 friend class autofill::PersonalDataManagerFactory;
259 friend class PersonalDataManagerTest; 251 friend class PersonalDataManagerTest;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 // |record_metrics| is true. Metrics should be recorded when the returned 391 // |record_metrics| is true. Metrics should be recorded when the returned
400 // profiles will be used to populate the fields shown in an Autofill popup. 392 // profiles will be used to populate the fields shown in an Autofill popup.
401 const std::vector<AutofillProfile*>& GetProfiles( 393 const std::vector<AutofillProfile*>& GetProfiles(
402 bool record_metrics) const; 394 bool record_metrics) const;
403 395
404 // Returns credit card suggestions based on the |cards_to_suggest| and the 396 // Returns credit card suggestions based on the |cards_to_suggest| and the
405 // |type| and |field_contents| of the credit card field. 397 // |type| and |field_contents| of the credit card field.
406 std::vector<Suggestion> GetSuggestionsForCards( 398 std::vector<Suggestion> GetSuggestionsForCards(
407 const AutofillType& type, 399 const AutofillType& type,
408 const base::string16& field_contents, 400 const base::string16& field_contents,
409 const std::vector<CreditCard*>& cards_to_suggest) const; 401 const std::list<const CreditCard*>& cards_to_suggest) const;
410 402
411 const std::string app_locale_; 403 const std::string app_locale_;
412 404
413 // The default country code for new addresses. 405 // The default country code for new addresses.
414 mutable std::string default_country_code_; 406 mutable std::string default_country_code_;
415 407
416 // The PrefService that this instance uses. Must outlive this instance. 408 // The PrefService that this instance uses. Must outlive this instance.
417 PrefService* pref_service_; 409 PrefService* pref_service_;
418 410
419 // The AccountTrackerService that this instance uses. Must outlive this 411 // The AccountTrackerService that this instance uses. Must outlive this
(...skipping 19 matching lines...) Expand all
439 431
440 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled. 432 // An observer to listen for changes to prefs::kAutofillWalletImportEnabled.
441 std::unique_ptr<BooleanPrefMember> wallet_enabled_pref_; 433 std::unique_ptr<BooleanPrefMember> wallet_enabled_pref_;
442 434
443 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); 435 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager);
444 }; 436 };
445 437
446 } // namespace autofill 438 } // namespace autofill
447 439
448 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ 440 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698