Index: components/autofill/core/browser/autofill_external_delegate.cc |
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc |
index 95cf8a14a1aff8ea0f06f75969d6685ee4919d12..cab1e81a8a25b95893ec2d1a79a925c9d2a67920 100644 |
--- a/components/autofill/core/browser/autofill_external_delegate.cc |
+++ b/components/autofill/core/browser/autofill_external_delegate.cc |
@@ -91,6 +91,17 @@ void AutofillExternalDelegate::OnSuggestionsReturned( |
// updated to match. |
InsertDataListValues(&values, &labels, &icons, &ids); |
+#if defined(OS_MACOSX) |
+ if (values.empty() && !manager_->HasPromptedForAccessToAddressBook() && |
+ manager_->FieldSupportsAddressBookAutofill(query_form_, query_field_)) { |
+ values.push_back( |
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_ACCESS_MAC_CONTACTS)); |
+ labels.push_back(base::string16()); |
+ icons.push_back(base::string16()); |
+ ids.push_back(POPUP_ITEM_ID_MAC_ACCESS_CONTACTS); |
+ } |
Ilya Sherman
2014/05/21 11:29:15
Sorry, I think I gave you bad advice earlier about
erikchen
2014/05/21 22:00:54
I don't think that your suggestion will work as yo
|
+#endif |
+ |
if (values.empty()) { |
// No suggestions, any popup currently showing is obsolete. |
manager_->delegate()->HideAutofillPopup(); |
@@ -157,6 +168,13 @@ void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, |
} else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) { |
// User selected an Autocomplete, so we fill directly. |
driver_->RendererShouldFillFieldWithValue(value); |
+ } else if (identifier == POPUP_ITEM_ID_MAC_ACCESS_CONTACTS) { |
+#if defined(OS_MACOSX) |
+ // User wants to give Chromium access to user's address book. |
+ manager_->AccessAddressBook(); |
Ilya Sherman
2014/05/21 11:29:15
This should also re-issue the Autofill query, sinc
erikchen
2014/05/21 22:00:54
Good point. I've updated the logic to do this.
|
+#else |
+ NOTREACHED(); |
+#endif |
} else { |
FillAutofillFormData(identifier, false); |
} |