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

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

Issue 578383002: mac: Only show the access Address Book prompt a fixed number of times. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill-contacts
Patch Set: Created 6 years, 3 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 80ad335a44a0e4c50f92eb406bdb0d6884ee5045..f4b91e08df96cb52d67f4da07374c13ce048ec30 100644
--- a/components/autofill/core/browser/autofill_external_delegate.cc
+++ b/components/autofill/core/browser/autofill_external_delegate.cc
@@ -49,7 +49,11 @@ AutofillExternalDelegate::AutofillExternalDelegate(AutofillManager* manager,
display_warning_if_disabled_(false),
has_suggestion_(false),
has_shown_popup_for_current_edit_(false),
- weak_ptr_factory_(this) {
+ weak_ptr_factory_(this)
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ , has_shown_address_book_prompt(false)
+#endif // defined(OS_MACOSX) && !defined(OS_IOS)
+{
DCHECK(manager);
}
@@ -60,6 +64,11 @@ void AutofillExternalDelegate::OnQuery(int query_id,
const FormFieldData& field,
const gfx::RectF& element_bounds,
bool display_warning_if_disabled) {
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ if (query_form_ != form)
+ has_shown_address_book_prompt = false;
+#endif // defined(OS_MACOSX) && !defined(OS_IOS)
+
query_form_ = form;
query_field_ = field;
display_warning_if_disabled_ = display_warning_if_disabled;
@@ -117,8 +126,6 @@ void AutofillExternalDelegate::OnSuggestionsReturned(
// updated to match.
InsertDataListValues(&values, &labels, &icons, &ids);
-// Temporarily disabled. See http://crbug.com/408695
-#if 0
#if defined(OS_MACOSX) && !defined(OS_IOS)
if (values.empty() &&
manager_->ShouldShowAccessAddressBookSuggestion(query_form_,
@@ -129,10 +136,13 @@ void AutofillExternalDelegate::OnSuggestionsReturned(
icons.push_back(base::ASCIIToUTF16("macContactsIcon"));
ids.push_back(POPUP_ITEM_ID_MAC_ACCESS_CONTACTS);
- EmitHistogram(SHOWED_ACCESS_ADDRESS_BOOK_ENTRY);
+ if (!has_shown_address_book_prompt) {
+ has_shown_address_book_prompt = true;
+ EmitHistogram(SHOWED_ACCESS_ADDRESS_BOOK_ENTRY);
+ manager_->ShowedAccessAddressBookPrompt();
+ }
}
#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-#endif
if (values.empty()) {
// No suggestions, any popup currently showing is obsolete.

Powered by Google App Engine
This is Rietveld 408576698