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

Unified Diff: components/autofill/core/browser/autofill_external_delegate.cc

Issue 286243002: Mac: Autofill should not immediately request access to address book. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup. Created 6 years, 7 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
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..5c203c7c25550bb00ed5aebd88c69f0959323d07 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)
+ // TODO(erikchen): Get real asset.
+ if (manager_->ShouldShowAccessMacContacts(query_form_, query_field_)) {
+ values.push_back(
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_ACCESS_MAC_CONTACTS));
+ labels.push_back(base::ASCIIToUTF16(""));
Ilya Sherman 2014/05/16 22:54:02 nit: "base::ASCIIToUTF16("")" -> "base::string16()
erikchen 2014/05/19 20:58:32 Done.
+ icons.push_back(base::ASCIIToUTF16("americanExpressCC"));
Ilya Sherman 2014/05/16 22:54:02 I'd rather have no icon than a bizarre one for now
erikchen 2014/05/19 20:58:32 Done.
+ ids.push_back(POPUP_ITEM_ID_MAC_ACCESS_CONTACTS);
+ }
+#endif
+
if (values.empty()) {
// No suggestions, any popup currently showing is obsolete.
manager_->delegate()->HideAutofillPopup();
@@ -157,6 +168,9 @@ 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) {
+ // User wants to give Chromium access to user's address book.
+ manager_->AccessMacContacts();
} else {
FillAutofillFormData(identifier, false);
}

Powered by Google App Engine
This is Rietveld 408576698