| 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 |
| 556 // renderer. | 556 // expiration, cvc or number. |
| 557 if (suggestions.empty() && field.should_autocomplete && |
| 558 !(autofill_field && |
| 559 (IsCreditCardExpirationType(autofill_field->Type().GetStorableType()) || |
| 560 autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER || |
| 561 autofill_field->Type().GetStorableType() == |
| 562 CREDIT_CARD_VERIFICATION_CODE))) { |
| 563 // Suggestions come back asynchronously, so the Autocomplete manager will |
| 564 // handle sending the results back to the renderer. |
| 557 autocomplete_history_manager_->OnGetAutocompleteSuggestions( | 565 autocomplete_history_manager_->OnGetAutocompleteSuggestions( |
| 558 query_id, field.name, field.value, field.form_control_type); | 566 query_id, field.name, field.value, field.form_control_type); |
| 559 return; | 567 return; |
| 560 } | 568 } |
| 561 | 569 |
| 562 // Send Autofill suggestions (could be an empty list). | 570 // Send Autofill suggestions (could be an empty list). |
| 563 autocomplete_history_manager_->CancelPendingQuery(); | 571 autocomplete_history_manager_->CancelPendingQuery(); |
| 564 external_delegate_->OnSuggestionsReturned(query_id, suggestions); | 572 external_delegate_->OnSuggestionsReturned(query_id, suggestions); |
| 565 } | 573 } |
| 566 | 574 |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 if (i > 0) | 2005 if (i > 0) |
| 1998 fputs("Next oldest form:\n", file); | 2006 fputs("Next oldest form:\n", file); |
| 1999 } | 2007 } |
| 2000 fputs("\n", file); | 2008 fputs("\n", file); |
| 2001 | 2009 |
| 2002 fclose(file); | 2010 fclose(file); |
| 2003 } | 2011 } |
| 2004 #endif // ENABLE_FORM_DEBUG_DUMP | 2012 #endif // ENABLE_FORM_DEBUG_DUMP |
| 2005 | 2013 |
| 2006 } // namespace autofill | 2014 } // namespace autofill |
| OLD | NEW |