OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autofill/address.h" | 5 #include "chrome/browser/autofill/address.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 void Address::GetSupportedTypes(FieldTypeSet* supported_types) const { | 50 void Address::GetSupportedTypes(FieldTypeSet* supported_types) const { |
51 supported_types->insert(ADDRESS_HOME_LINE1); | 51 supported_types->insert(ADDRESS_HOME_LINE1); |
52 supported_types->insert(ADDRESS_HOME_LINE2); | 52 supported_types->insert(ADDRESS_HOME_LINE2); |
53 supported_types->insert(ADDRESS_HOME_CITY); | 53 supported_types->insert(ADDRESS_HOME_CITY); |
54 supported_types->insert(ADDRESS_HOME_STATE); | 54 supported_types->insert(ADDRESS_HOME_STATE); |
55 supported_types->insert(ADDRESS_HOME_ZIP); | 55 supported_types->insert(ADDRESS_HOME_ZIP); |
56 supported_types->insert(ADDRESS_HOME_COUNTRY); | 56 supported_types->insert(ADDRESS_HOME_COUNTRY); |
57 } | 57 } |
58 | 58 |
59 string16 Address::GetInfo(AutofillFieldType type) const { | 59 string16 Address::GetRawInfo(AutofillFieldType type) const { |
60 if (type == ADDRESS_HOME_LINE1) | 60 if (type == ADDRESS_HOME_LINE1) |
61 return line1_; | 61 return line1_; |
62 | 62 |
63 if (type == ADDRESS_HOME_LINE2) | 63 if (type == ADDRESS_HOME_LINE2) |
64 return line2_; | 64 return line2_; |
65 | 65 |
66 if (type == ADDRESS_HOME_CITY) | 66 if (type == ADDRESS_HOME_CITY) |
67 return city_; | 67 return city_; |
68 | 68 |
69 if (type == ADDRESS_HOME_STATE) | 69 if (type == ADDRESS_HOME_STATE) |
70 return state_; | 70 return state_; |
71 | 71 |
72 if (type == ADDRESS_HOME_ZIP) | 72 if (type == ADDRESS_HOME_ZIP) |
73 return zip_code_; | 73 return zip_code_; |
74 | 74 |
75 if (type == ADDRESS_HOME_COUNTRY) | 75 if (type == ADDRESS_HOME_COUNTRY) |
76 return Country(); | 76 return Country(); |
77 | 77 |
78 return string16(); | 78 return string16(); |
79 } | 79 } |
80 | 80 |
81 void Address::SetInfo(AutofillFieldType type, const string16& value) { | 81 void Address::SetRawInfo(AutofillFieldType type, const string16& value) { |
82 type = AutofillType::GetEquivalentFieldType(type); | 82 type = AutofillType::GetEquivalentFieldType(type); |
83 if (type == ADDRESS_HOME_LINE1) | 83 if (type == ADDRESS_HOME_LINE1) |
84 line1_ = value; | 84 line1_ = value; |
85 else if (type == ADDRESS_HOME_LINE2) | 85 else if (type == ADDRESS_HOME_LINE2) |
86 line2_ = value; | 86 line2_ = value; |
87 else if (type == ADDRESS_HOME_CITY) | 87 else if (type == ADDRESS_HOME_CITY) |
88 city_ = value; | 88 city_ = value; |
89 else if (type == ADDRESS_HOME_STATE) | 89 else if (type == ADDRESS_HOME_STATE) |
90 state_ = value; | 90 state_ = value; |
91 else if (type == ADDRESS_HOME_COUNTRY) | 91 else if (type == ADDRESS_HOME_COUNTRY) |
(...skipping 14 matching lines...) Expand all Loading... |
106 matching_types->insert(ADDRESS_HOME_COUNTRY); | 106 matching_types->insert(ADDRESS_HOME_COUNTRY); |
107 } | 107 } |
108 | 108 |
109 string16 Address::Country() const { | 109 string16 Address::Country() const { |
110 if (country_code().empty()) | 110 if (country_code().empty()) |
111 return string16(); | 111 return string16(); |
112 | 112 |
113 std::string app_locale = AutofillCountry::ApplicationLocale(); | 113 std::string app_locale = AutofillCountry::ApplicationLocale(); |
114 return AutofillCountry(country_code(), app_locale).name(); | 114 return AutofillCountry(country_code(), app_locale).name(); |
115 } | 115 } |
OLD | NEW |