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

Side by Side Diff: chrome/browser/autofill/address_field.cc

Issue 6625087: Convert autofill messages to use the new IPC macros (again). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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) 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_field.h" 5 #include "chrome/browser/autofill/address_field.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 AddressType AddressField::FindType() const { 141 AddressType AddressField::FindType() const {
142 // This is not a full address, so don't even bother trying to figure 142 // This is not a full address, so don't even bother trying to figure
143 // out its type. 143 // out its type.
144 if (address1_ == NULL) 144 if (address1_ == NULL)
145 return kGenericAddress; 145 return kGenericAddress;
146 146
147 // First look at the field name, which itself will sometimes contain 147 // First look at the field name, which itself will sometimes contain
148 // "bill" or "ship". We could check for the ECML type prefixes 148 // "bill" or "ship". We could check for the ECML type prefixes
149 // here, but there's no need to since ECML's prefixes Ecom_BillTo 149 // here, but there's no need to since ECML's prefixes Ecom_BillTo
150 // and Ecom_ShipTo contain "bill" and "ship" anyway. 150 // and Ecom_ShipTo contain "bill" and "ship" anyway.
151 string16 name = StringToLowerASCII(address1_->name()); 151 string16 name = StringToLowerASCII(address1_->name);
152 return AddressTypeFromText(name); 152 return AddressTypeFromText(name);
153 } 153 }
154 154
155 AddressField::AddressField() 155 AddressField::AddressField()
156 : company_(NULL), 156 : company_(NULL),
157 address1_(NULL), 157 address1_(NULL),
158 address2_(NULL), 158 address2_(NULL),
159 city_(NULL), 159 city_(NULL),
160 state_(NULL), 160 state_(NULL),
161 zip_(NULL), 161 zip_(NULL),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 return false; 287 return false;
288 288
289 string16 pattern; 289 string16 pattern;
290 if (is_ecml) { 290 if (is_ecml) {
291 pattern = GetEcmlPattern(kEcmlShipToPostalCode, kEcmlBillToPostalCode, '|'); 291 pattern = GetEcmlPattern(kEcmlShipToPostalCode, kEcmlBillToPostalCode, '|');
292 } else { 292 } else {
293 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_ZIP_CODE_RE); 293 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_ZIP_CODE_RE);
294 } 294 }
295 295
296 AddressType tempType; 296 AddressType tempType;
297 string16 name = (**iter)->name(); 297 string16 name = (**iter)->name;
298 298
299 // Note: comparisons using the ecml compliant name as a prefix must be used in 299 // Note: comparisons using the ecml compliant name as a prefix must be used in
300 // order to accommodate Google Checkout. See FormFieldSet::GetEcmlPattern for 300 // order to accommodate Google Checkout. See FormFieldSet::GetEcmlPattern for
301 // more detail. 301 // more detail.
302 string16 bill_to_postal_code_field(ASCIIToUTF16(kEcmlBillToPostalCode)); 302 string16 bill_to_postal_code_field(ASCIIToUTF16(kEcmlBillToPostalCode));
303 if (StartsWith(name, bill_to_postal_code_field, false)) { 303 if (StartsWith(name, bill_to_postal_code_field, false)) {
304 tempType = kBillingAddress; 304 tempType = kBillingAddress;
305 } else if (StartsWith(name, bill_to_postal_code_field, false)) { 305 } else if (StartsWith(name, bill_to_postal_code_field, false)) {
306 tempType = kShippingAddress; 306 tempType = kShippingAddress;
307 } else { 307 } else {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return kBillingAddress; 389 return kBillingAddress;
390 390
391 if (bill == string16::npos && ship != string16::npos) 391 if (bill == string16::npos && ship != string16::npos)
392 return kShippingAddress; 392 return kShippingAddress;
393 393
394 if (bill > ship) 394 if (bill > ship)
395 return kBillingAddress; 395 return kBillingAddress;
396 396
397 return kShippingAddress; 397 return kShippingAddress;
398 } 398 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete_history_manager.cc ('k') | chrome/browser/autofill/autofill_common_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698