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

Side by Side Diff: chrome/browser/ui/autofill/data_model_wrapper.cc

Issue 15697010: Autofill:requestAutocomplete: Enable prompting for complete address when instrument being used does… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to head instead of using lkgr Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
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 "base/callback.h" 7 #include "base/callback.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" 10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 WalletAddressWrapper::WalletAddressWrapper( 156 WalletAddressWrapper::WalletAddressWrapper(
157 const wallet::Address* address) : address_(address) {} 157 const wallet::Address* address) : address_(address) {}
158 158
159 WalletAddressWrapper::~WalletAddressWrapper() {} 159 WalletAddressWrapper::~WalletAddressWrapper() {}
160 160
161 string16 WalletAddressWrapper::GetInfo(AutofillFieldType type) { 161 string16 WalletAddressWrapper::GetInfo(AutofillFieldType type) {
162 return address_->GetInfo(type, g_browser_process->GetApplicationLocale()); 162 return address_->GetInfo(type, g_browser_process->GetApplicationLocale());
163 } 163 }
164 164
165 string16 WalletAddressWrapper::GetDisplayText() {
166 if (!address_->is_complete_address())
167 return string16();
168
169 return DataModelWrapper::GetDisplayText();
170 }
171
165 // WalletInstrumentWrapper 172 // WalletInstrumentWrapper
166 173
167 WalletInstrumentWrapper::WalletInstrumentWrapper( 174 WalletInstrumentWrapper::WalletInstrumentWrapper(
168 const wallet::WalletItems::MaskedInstrument* instrument) 175 const wallet::WalletItems::MaskedInstrument* instrument)
169 : instrument_(instrument) {} 176 : instrument_(instrument) {}
170 177
171 WalletInstrumentWrapper::~WalletInstrumentWrapper() {} 178 WalletInstrumentWrapper::~WalletInstrumentWrapper() {}
172 179
173 string16 WalletInstrumentWrapper::GetInfo(AutofillFieldType type) { 180 string16 WalletInstrumentWrapper::GetInfo(AutofillFieldType type) {
174 if (type == CREDIT_CARD_EXP_MONTH) 181 if (type == CREDIT_CARD_EXP_MONTH)
175 return MonthComboboxModel::FormatMonth(instrument_->expiration_month()); 182 return MonthComboboxModel::FormatMonth(instrument_->expiration_month());
176 183
177 return instrument_->GetInfo(type, g_browser_process->GetApplicationLocale()); 184 return instrument_->GetInfo(type, g_browser_process->GetApplicationLocale());
178 } 185 }
179 186
180 gfx::Image WalletInstrumentWrapper::GetIcon() { 187 gfx::Image WalletInstrumentWrapper::GetIcon() {
181 return instrument_->CardIcon(); 188 return instrument_->CardIcon();
182 } 189 }
183 190
184 string16 WalletInstrumentWrapper::GetDisplayText() { 191 string16 WalletInstrumentWrapper::GetDisplayText() {
185 // TODO(dbeam): handle other instrument statuses? http://crbug.com/233048 192 // TODO(dbeam): handle other instrument statuses? http://crbug.com/233048
186 if (instrument_->status() == wallet::WalletItems::MaskedInstrument::EXPIRED) 193 if (instrument_->status() == wallet::WalletItems::MaskedInstrument::EXPIRED ||
194 !instrument_->address().is_complete_address()) {
187 return string16(); 195 return string16();
196 }
188 197
189 // TODO(estade): descriptive_name() is user-provided. Should we use it or 198 // TODO(estade): descriptive_name() is user-provided. Should we use it or
190 // just type + last 4 digits? 199 // just type + last 4 digits?
191 string16 line1 = instrument_->descriptive_name(); 200 string16 line1 = instrument_->descriptive_name();
192 return line1 + ASCIIToUTF16("\n") + DataModelWrapper::GetDisplayText(); 201 return line1 + ASCIIToUTF16("\n") + DataModelWrapper::GetDisplayText();
193 } 202 }
194 203
195 // FullWalletBillingWrapper 204 // FullWalletBillingWrapper
196 205
197 FullWalletBillingWrapper::FullWalletBillingWrapper( 206 FullWalletBillingWrapper::FullWalletBillingWrapper(
(...skipping 29 matching lines...) Expand all
227 } 236 }
228 237
229 FullWalletShippingWrapper::~FullWalletShippingWrapper() {} 238 FullWalletShippingWrapper::~FullWalletShippingWrapper() {}
230 239
231 string16 FullWalletShippingWrapper::GetInfo(AutofillFieldType type) { 240 string16 FullWalletShippingWrapper::GetInfo(AutofillFieldType type) {
232 return full_wallet_->shipping_address()->GetInfo( 241 return full_wallet_->shipping_address()->GetInfo(
233 type, g_browser_process->GetApplicationLocale()); 242 type, g_browser_process->GetApplicationLocale());
234 } 243 }
235 244
236 } // namespace autofill 245 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/data_model_wrapper.h ('k') | components/autofill/browser/wallet/wallet_address.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698