OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/data_model_wrapper.h" | 5 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 AutofillProfileWrapper::AutofillProfileWrapper(const AutofillProfile* profile) | 103 AutofillProfileWrapper::AutofillProfileWrapper(const AutofillProfile* profile) |
104 : profile_(profile) {} | 104 : profile_(profile) {} |
105 | 105 |
106 AutofillProfileWrapper::~AutofillProfileWrapper() {} | 106 AutofillProfileWrapper::~AutofillProfileWrapper() {} |
107 | 107 |
108 base::string16 AutofillProfileWrapper::GetInfo(const AutofillType& type) const { | 108 base::string16 AutofillProfileWrapper::GetInfo(const AutofillType& type) const { |
109 // Requests for the user's credit card are filled from the billing address, | 109 // Requests for the user's credit card are filled from the billing address, |
110 // but the AutofillProfile class doesn't know how to fill credit card | 110 // but the AutofillProfile class doesn't know how to fill credit card |
111 // fields. So, request for the corresponding profile type instead. | 111 // fields. So, request for the corresponding profile type instead. |
112 AutofillType effective_type = type; | 112 AutofillType effective_type = type; |
113 if (type.GetStorableType() == CREDIT_CARD_NAME) | 113 if (type.GetStorableType() == CREDIT_CARD_NAME_FULL) |
114 effective_type = AutofillType(NAME_BILLING_FULL); | 114 effective_type = AutofillType(NAME_BILLING_FULL); |
115 | 115 |
116 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 116 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
117 return profile_->GetInfo(effective_type, app_locale); | 117 return profile_->GetInfo(effective_type, app_locale); |
118 } | 118 } |
119 | 119 |
120 base::string16 AutofillProfileWrapper::GetInfoForDisplay( | 120 base::string16 AutofillProfileWrapper::GetInfoForDisplay( |
121 const AutofillType& type) const { | 121 const AutofillType& type) const { |
122 // We display the "raw" phone number which contains user-defined formatting. | 122 // We display the "raw" phone number which contains user-defined formatting. |
123 if (type.GetStorableType() == PHONE_HOME_WHOLE_NUMBER) { | 123 if (type.GetStorableType() == PHONE_HOME_WHOLE_NUMBER) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 223 } |
224 | 224 |
225 return base::UTF8ToUTF16(address_->GetFieldValue(field)); | 225 return base::UTF8ToUTF16(address_->GetFieldValue(field)); |
226 } | 226 } |
227 | 227 |
228 const std::string& I18nAddressDataWrapper::GetLanguageCode() const { | 228 const std::string& I18nAddressDataWrapper::GetLanguageCode() const { |
229 return address_->language_code; | 229 return address_->language_code; |
230 } | 230 } |
231 | 231 |
232 } // namespace autofill | 232 } // namespace autofill |
OLD | NEW |