Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/autofill/core/browser/autofill_manager.h" | 5 #include "components/autofill/core/browser/autofill_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 // TODO(mathp): Differentiate between number of suggestions available | 543 // TODO(mathp): Differentiate between number of suggestions available |
| 544 // (current metric) and number shown to the user. | 544 // (current metric) and number shown to the user. |
| 545 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { | 545 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { |
| 546 AutofillMetrics::LogAddressSuggestionsCount(suggestions.size()); | 546 AutofillMetrics::LogAddressSuggestionsCount(suggestions.size()); |
| 547 has_logged_address_suggestions_count_ = true; | 547 has_logged_address_suggestions_count_ = true; |
| 548 } | 548 } |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 } | 551 } |
| 552 | 552 |
| 553 if (suggestions.empty() && field.should_autocomplete) { | 553 // If there are no Autofill suggestions, consider showing Autocomplete |
| 554 // Show autocomplete. Suggestions come back asynchronously, so the | 554 // suggestions. We will not show Autocomplete suggestions for a field that |
| 555 // autocomplete manager will handle sending the results back to the | 555 // specifies autocomplete=off or a field that we think is a credit card field. |
| 556 // renderer. | 556 if (suggestions.empty() && field.should_autocomplete && |
| 557 !(autofill_field && | |
| 558 autofill_field->Type().group() == CREDIT_CARD)) { | |
|
Justin Donnelly
2016/04/26 21:19:00
How about carving out an exception for Type() == C
Mathieu
2016/04/27 15:31:28
Sure, I went with restricting the exclusion to CVC
| |
| 559 // Suggestions come back asynchronously, so the Autocomplete manager will | |
| 560 // handle sending the results back to the renderer. | |
| 557 autocomplete_history_manager_->OnGetAutocompleteSuggestions( | 561 autocomplete_history_manager_->OnGetAutocompleteSuggestions( |
| 558 query_id, field.name, field.value, field.form_control_type); | 562 query_id, field.name, field.value, field.form_control_type); |
| 559 return; | 563 return; |
| 560 } | 564 } |
| 561 | 565 |
| 562 // Send Autofill suggestions (could be an empty list). | 566 // Send Autofill suggestions (could be an empty list). |
| 563 autocomplete_history_manager_->CancelPendingQuery(); | 567 autocomplete_history_manager_->CancelPendingQuery(); |
| 564 external_delegate_->OnSuggestionsReturned(query_id, suggestions); | 568 external_delegate_->OnSuggestionsReturned(query_id, suggestions); |
| 565 } | 569 } |
| 566 | 570 |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1997 if (i > 0) | 2001 if (i > 0) |
| 1998 fputs("Next oldest form:\n", file); | 2002 fputs("Next oldest form:\n", file); |
| 1999 } | 2003 } |
| 2000 fputs("\n", file); | 2004 fputs("\n", file); |
| 2001 | 2005 |
| 2002 fclose(file); | 2006 fclose(file); |
| 2003 } | 2007 } |
| 2004 #endif // ENABLE_FORM_DEBUG_DUMP | 2008 #endif // ENABLE_FORM_DEBUG_DUMP |
| 2005 | 2009 |
| 2006 } // namespace autofill | 2010 } // namespace autofill |
| OLD | NEW |