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 "chrome/browser/ui/autofill/autofill_dialog_common.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "components/autofill/core/browser/autofill_country.h" | 9 #include "components/autofill/core/browser/autofill_country.h" |
10 #include "components/autofill/core/browser/autofill_field.h" | 10 #include "components/autofill/core/browser/autofill_field.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 if (server_type == CREDIT_CARD_TYPE) | 30 if (server_type == CREDIT_CARD_TYPE) |
31 return type == CREDIT_CARD_NUMBER; | 31 return type == CREDIT_CARD_NUMBER; |
32 | 32 |
33 // Check the groups to distinguish billing types from shipping ones. | 33 // Check the groups to distinguish billing types from shipping ones. |
34 AutofillType autofill_type = AutofillType(type); | 34 AutofillType autofill_type = AutofillType(type); |
35 if (autofill_type.group() != field_type.group()) | 35 if (autofill_type.group() != field_type.group()) |
36 return false; | 36 return false; |
37 | 37 |
38 // The page may ask for individual address lines; this roughly matches the | 38 // The page may ask for individual address lines; this roughly matches the |
39 // street address blob. | 39 // street address blob. |
40 if (server_type == ADDRESS_HOME_LINE1 || server_type == ADDRESS_HOME_LINE2) | 40 if (server_type == ADDRESS_HOME_LINE1 || server_type == ADDRESS_HOME_LINE2 || |
| 41 field_type.html_type() == HTML_TYPE_FULL_ADDRESS) { |
41 return autofill_type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS; | 42 return autofill_type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS; |
| 43 } |
42 | 44 |
43 return autofill_type.GetStorableType() == server_type; | 45 return autofill_type.GetStorableType() == server_type; |
44 } | 46 } |
45 | 47 |
46 bool ServerTypeMatchesField(DialogSection section, | 48 bool ServerTypeMatchesField(DialogSection section, |
47 ServerFieldType type, | 49 ServerFieldType type, |
48 const AutofillField& field) { | 50 const AutofillField& field) { |
49 AutofillType field_type = field.Type(); | 51 AutofillType field_type = field.Type(); |
50 | 52 |
51 // The credit card name is filled from the billing section's data. | 53 // The credit card name is filled from the billing section's data. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) { | 115 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) { |
114 std::vector<ServerFieldType> types; | 116 std::vector<ServerFieldType> types; |
115 for (size_t i = 0; i < inputs.size(); ++i) { | 117 for (size_t i = 0; i < inputs.size(); ++i) { |
116 types.push_back(inputs[i].type); | 118 types.push_back(inputs[i].type); |
117 } | 119 } |
118 return types; | 120 return types; |
119 } | 121 } |
120 | 122 |
121 } // namespace common | 123 } // namespace common |
122 } // namespace autofill | 124 } // namespace autofill |
OLD | NEW |