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); |