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 17 matching lines...) Expand all Loading... | |
28 } | 28 } |
29 | 29 |
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 // Street address (all lines) is matched to the first input address line. |
39 // street address blob. | 39 if (server_type == ADDRESS_HOME_STREET_ADDRESS || |
Ilya Sherman
2014/05/07 01:19:19
This line seems redundant with line 44. Also, wha
Evan Stade
2014/05/09 22:14:59
woopsies, this is the result of a bad merge (I sta
| |
40 if (server_type == ADDRESS_HOME_LINE1 || server_type == ADDRESS_HOME_LINE2) | 40 field_type.html_type() == HTML_TYPE_FULL_ADDRESS) { |
41 return autofill_type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS; | 41 return autofill_type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS; |
42 } | |
42 | 43 |
43 return autofill_type.GetStorableType() == server_type; | 44 return autofill_type.GetStorableType() == server_type; |
44 } | 45 } |
45 | 46 |
46 bool ServerTypeMatchesField(DialogSection section, | 47 bool ServerTypeMatchesField(DialogSection section, |
47 ServerFieldType type, | 48 ServerFieldType type, |
48 const AutofillField& field) { | 49 const AutofillField& field) { |
49 AutofillType field_type = field.Type(); | 50 AutofillType field_type = field.Type(); |
50 | 51 |
51 // The credit card name is filled from the billing section's data. | 52 // 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) { | 114 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) { |
114 std::vector<ServerFieldType> types; | 115 std::vector<ServerFieldType> types; |
115 for (size_t i = 0; i < inputs.size(); ++i) { | 116 for (size_t i = 0; i < inputs.size(); ++i) { |
116 types.push_back(inputs[i].type); | 117 types.push_back(inputs[i].type); |
117 } | 118 } |
118 return types; | 119 return types; |
119 } | 120 } |
120 | 121 |
121 } // namespace common | 122 } // namespace common |
122 } // namespace autofill | 123 } // namespace autofill |
OLD | NEW |