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

Side by Side Diff: components/autofill/core/browser/autofill_manager.cc

Issue 442403002: Adjust displayed phone number for prefix/suffix case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Upload code as per review comments. 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 unified diff | Download patch
OLDNEW
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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // anyway, only don't de-dup credit card suggestions. 503 // anyway, only don't de-dup credit card suggestions.
504 if (!is_filling_credit_card) 504 if (!is_filling_credit_card)
505 RemoveDuplicateSuggestions(&values, &labels, &icons, &unique_ids); 505 RemoveDuplicateSuggestions(&values, &labels, &icons, &unique_ids);
506 506
507 // The first time we show suggestions on this page, log the number of 507 // The first time we show suggestions on this page, log the number of
508 // suggestions shown. 508 // suggestions shown.
509 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { 509 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) {
510 metric_logger_->LogAddressSuggestionsCount(values.size()); 510 metric_logger_->LogAddressSuggestionsCount(values.size());
511 has_logged_address_suggestions_count_ = true; 511 has_logged_address_suggestions_count_ = true;
512 } 512 }
513
514 // Adjust phone number to display in prefix/suffix case.
515 FormData result = form;
516 if (type.GetStorableType() == PHONE_HOME_NUMBER) {
517 for (std::vector<FormFieldData>::iterator iter =
518 result.fields.begin();
519 iter != result.fields.end();
520 ++iter) {
521 if ((*iter) == field) {
522 for (size_t i = 0; i < values.size(); ++i) {
523 values[i] = AutofillField::GetPhoneNumberValue(
524 *autofill_field, values[i], *iter);
525 }
526 }
527 }
528 }
513 } 529 }
514 } 530 }
515 } 531 }
516 532
517 // Add the results from AutoComplete. They come back asynchronously, so we 533 // Add the results from AutoComplete. They come back asynchronously, so we
518 // hand off what we generated and they will send the results back to the 534 // hand off what we generated and they will send the results back to the
519 // renderer. 535 // renderer.
520 autocomplete_history_manager_->OnGetAutocompleteSuggestions( 536 autocomplete_history_manager_->OnGetAutocompleteSuggestions(
521 query_id, field.name, field.value, field.form_control_type, values, 537 query_id, field.name, field.value, field.form_control_type, values,
522 labels, icons, unique_ids); 538 labels, icons, unique_ids);
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 return false; 1239 return false;
1224 1240
1225 // Disregard forms that we wouldn't ever autofill in the first place. 1241 // Disregard forms that we wouldn't ever autofill in the first place.
1226 if (!form.ShouldBeParsed()) 1242 if (!form.ShouldBeParsed())
1227 return false; 1243 return false;
1228 1244
1229 return true; 1245 return true;
1230 } 1246 }
1231 1247
1232 } // namespace autofill 1248 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698