| 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 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 // The first time we show suggestions on this page, log the number of | 523 // The first time we show suggestions on this page, log the number of |
| 524 // suggestions shown. | 524 // suggestions shown. |
| 525 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { | 525 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { |
| 526 metric_logger_->LogAddressSuggestionsCount(values.size()); | 526 metric_logger_->LogAddressSuggestionsCount(values.size()); |
| 527 has_logged_address_suggestions_count_ = true; | 527 has_logged_address_suggestions_count_ = true; |
| 528 } | 528 } |
| 529 } | 529 } |
| 530 } | 530 } |
| 531 } | 531 } |
| 532 | 532 |
| 533 // Add the results from AutoComplete. They come back asynchronously, so we | 533 if (field.should_autocomplete) { |
| 534 // hand off what we generated and they will send the results back to the | 534 // Add the results from AutoComplete. They come back asynchronously, so we |
| 535 // renderer. | 535 // hand off what we generated and they will send the results back to the |
| 536 autocomplete_history_manager_->OnGetAutocompleteSuggestions( | 536 // renderer. |
| 537 query_id, field.name, field.value, field.form_control_type, values, | 537 autocomplete_history_manager_->OnGetAutocompleteSuggestions( |
| 538 labels, icons, unique_ids); | 538 query_id, field.name, field.value, field.form_control_type, values, |
| 539 labels, icons, unique_ids); |
| 540 } else { |
| 541 // Autocomplete is disabled for this field; only pass back Autofill |
| 542 // suggestions. |
| 543 autocomplete_history_manager_->CancelPendingQuery(); |
| 544 external_delegate_->OnSuggestionsReturned( |
| 545 query_id, values, labels, icons, unique_ids); |
| 546 } |
| 539 } | 547 } |
| 540 | 548 |
| 541 void AutofillManager::FillOrPreviewForm( | 549 void AutofillManager::FillOrPreviewForm( |
| 542 AutofillDriver::RendererFormDataAction action, | 550 AutofillDriver::RendererFormDataAction action, |
| 543 int query_id, | 551 int query_id, |
| 544 const FormData& form, | 552 const FormData& form, |
| 545 const FormFieldData& field, | 553 const FormFieldData& field, |
| 546 int unique_id) { | 554 int unique_id) { |
| 547 if (!IsValidFormData(form) || !IsValidFormFieldData(field)) | 555 if (!IsValidFormData(form) || !IsValidFormFieldData(field)) |
| 548 return; | 556 return; |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 return false; | 1250 return false; |
| 1243 | 1251 |
| 1244 // Disregard forms that we wouldn't ever autofill in the first place. | 1252 // Disregard forms that we wouldn't ever autofill in the first place. |
| 1245 if (!form.ShouldBeParsed()) | 1253 if (!form.ShouldBeParsed()) |
| 1246 return false; | 1254 return false; |
| 1247 | 1255 |
| 1248 return true; | 1256 return true; |
| 1249 } | 1257 } |
| 1250 | 1258 |
| 1251 } // namespace autofill | 1259 } // namespace autofill |
| OLD | NEW |