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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller.cc

Issue 11742033: requestAutocomplete: only menu-suggest "complete" profiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review feedback Created 7 years, 12 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
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_dialog_controller.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller.cc b/chrome/browser/ui/autofill/autofill_dialog_controller.cc
index ed1f8aeaf8105241e56b0b73195b37b40db0521a..a6f74c4a1928838ba2a18006e7ae0d0c1f4d4e43 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller.cc
@@ -192,10 +192,7 @@ void AutofillDialogController::Show() {
arraysize(kShippingInputs),
&requested_shipping_fields_);
- // TODO(estade): make this actually check if it's a first run.
- bool first_run = true;
- if (!first_run)
- GenerateComboboxModels();
+ GenerateComboboxModels();
// TODO(estade): don't show the dialog if the site didn't specify the right
// fields. First we must figure out what the "right" fields are.
@@ -442,6 +439,10 @@ void AutofillDialogController::GenerateComboboxModels() {
const std::vector<AutofillProfile*>& profiles = manager->GetProfiles();
const std::string app_locale = AutofillCountry::ApplicationLocale();
for (size_t i = 0; i < profiles.size(); ++i) {
+ // TODO(estade): deal with variants.
+ if (!IsCompleteProfile(*profiles[i]))
+ continue;
+
string16 email = profiles[i]->GetInfo(EMAIL_ADDRESS, app_locale);
if (!email.empty())
suggested_email_.AddItem(profiles[i]->guid(), email);
@@ -453,6 +454,20 @@ void AutofillDialogController::GenerateComboboxModels() {
suggested_shipping_.AddItem("", ASCIIToUTF16("Enter new shipping"));
}
+
+bool AutofillDialogController::IsCompleteProfile(
+ const AutofillProfile& profile) {
+ const std::string app_locale = AutofillCountry::ApplicationLocale();
+ for (size_t i = 0; i < requested_shipping_fields_.size(); ++i) {
+ if (profile.GetInfo(requested_shipping_fields_[i].type,
+ app_locale).empty()) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
void AutofillDialogController::FillOutputForSectionWithComparator(
DialogSection section, const InputFieldComparator& compare) {
int suggestion_selection = view_->GetSuggestionSelection(section);
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698