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

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: Remove duplicate code. 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 // anyway, only don't de-dup credit card suggestions. 501 // anyway, only don't de-dup credit card suggestions.
502 if (!is_filling_credit_card) 502 if (!is_filling_credit_card)
503 RemoveDuplicateSuggestions(&values, &labels, &icons, &unique_ids); 503 RemoveDuplicateSuggestions(&values, &labels, &icons, &unique_ids);
504 504
505 // The first time we show suggestions on this page, log the number of 505 // The first time we show suggestions on this page, log the number of
506 // suggestions shown. 506 // suggestions shown.
507 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { 507 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) {
508 metric_logger_->LogAddressSuggestionsCount(values.size()); 508 metric_logger_->LogAddressSuggestionsCount(values.size());
509 has_logged_address_suggestions_count_ = true; 509 has_logged_address_suggestions_count_ = true;
510 } 510 }
511
512 // Adjust phone number to display in prefix/suffix case.
513 FormData result = form;
514 if (type.GetStorableType() == PHONE_HOME_NUMBER) {
515 for (std::vector<FormFieldData>::iterator iter =
516 result.fields.begin();
517 iter != result.fields.end();
518 ++iter) {
519 if ((*iter) == field) {
520 for (size_t i = 0; i < values.size(); ++i) {
521 base::string16 value;
522 AutofillField::GetPhoneNumberValue(
523 *autofill_field, values[i], &(*iter), &value);
524 values[i] = value;
525 }
526 }
527 }
528 }
Ilya Sherman 2014/09/03 00:55:49 Can all of this be done in the method that assigns
ziran.sun 2014/09/04 13:10:25 I'm not sure this change is related to phone numbe
Ilya Sherman 2014/09/11 05:32:14 Sorry, you're right that I got labels and values s
ziran.sun 2014/09/22 13:46:33 Done.
511 } 529 }
512 } 530 }
513 } 531 }
514 532
515 // Add the results from AutoComplete. They come back asynchronously, so we 533 // Add the results from AutoComplete. They come back asynchronously, so we
516 // 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
517 // renderer. 535 // renderer.
518 autocomplete_history_manager_->OnGetAutocompleteSuggestions( 536 autocomplete_history_manager_->OnGetAutocompleteSuggestions(
519 query_id, field.name, field.value, field.form_control_type, values, 537 query_id, field.name, field.value, field.form_control_type, values,
520 labels, icons, unique_ids); 538 labels, icons, unique_ids);
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 return false; 1238 return false;
1221 1239
1222 // Disregard forms that we wouldn't ever autofill in the first place. 1240 // Disregard forms that we wouldn't ever autofill in the first place.
1223 if (!form.ShouldBeParsed()) 1241 if (!form.ShouldBeParsed())
1224 return false; 1242 return false;
1225 1243
1226 return true; 1244 return true;
1227 } 1245 }
1228 1246
1229 } // namespace autofill 1247 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698