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

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

Issue 6650014: Autofill extend profiles to include multi-valued fields, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit 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
« no previous file with comments | « chrome/browser/autofill/address.h ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 5 #include "chrome/browser/autofill/address.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/autofill/autofill_country.h" 9 #include "chrome/browser/autofill/autofill_country.h"
10 #include "chrome/browser/autofill/autofill_type.h" 10 #include "chrome/browser/autofill/autofill_type.h"
(...skipping 11 matching lines...) Expand all
22 AutofillType::ADDRESS_ZIP, 22 AutofillType::ADDRESS_ZIP,
23 AutofillType::ADDRESS_COUNTRY, 23 AutofillType::ADDRESS_COUNTRY,
24 }; 24 };
25 25
26 const int kAutoFillAddressLength = arraysize(kAutoFillAddressTypes); 26 const int kAutoFillAddressLength = arraysize(kAutoFillAddressTypes);
27 27
28 } // namespace 28 } // namespace
29 29
30 Address::Address() {} 30 Address::Address() {}
31 31
32 Address::Address(const Address& address) : FormGroup() {
33 *this = address;
34 }
35
32 Address::~Address() {} 36 Address::~Address() {}
33 37
34 FormGroup* Address::Clone() const { 38 Address& Address::operator=(const Address& address) {
35 return new Address(*this); 39 if (this == &address)
40 return *this;
41
42 line1_tokens_ = address.line1_tokens_;
43 line2_tokens_= address.line2_tokens_;
44 line1_ = address.line1_;
45 line2_ = address.line2_;
46 city_ = address.city_;
47 state_ = address.state_;
48 country_code_ = address.country_code_;
49 zip_code_ = address.zip_code_;
50 return *this;
36 } 51 }
37 52
38 void Address::GetPossibleFieldTypes(const string16& text, 53 void Address::GetPossibleFieldTypes(const string16& text,
39 FieldTypeSet* possible_types) const { 54 FieldTypeSet* possible_types) const {
40 DCHECK(possible_types); 55 DCHECK(possible_types);
41 56
42 // If the text to match against the field types is empty, then no results will 57 // If the text to match against the field types is empty, then no results will
43 // match. 58 // match.
44 if (text.empty()) 59 if (text.empty())
45 return; 60 return;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 line1_tokens_.clear(); 162 line1_tokens_.clear();
148 line1_.clear(); 163 line1_.clear();
149 line2_tokens_.clear(); 164 line2_tokens_.clear();
150 line2_.clear(); 165 line2_.clear();
151 city_.clear(); 166 city_.clear();
152 state_.clear(); 167 state_.clear();
153 country_code_.clear(); 168 country_code_.clear();
154 zip_code_.clear(); 169 zip_code_.clear();
155 } 170 }
156 171
157 Address::Address(const Address& address)
158 : FormGroup(),
159 line1_tokens_(address.line1_tokens_),
160 line2_tokens_(address.line2_tokens_),
161 line1_(address.line1_),
162 line2_(address.line2_),
163 city_(address.city_),
164 state_(address.state_),
165 country_code_(address.country_code_),
166 zip_code_(address.zip_code_) {
167 }
168
169 string16 Address::Country() const { 172 string16 Address::Country() const {
170 if (country_code().empty()) 173 if (country_code().empty())
171 return string16(); 174 return string16();
172 175
173 std::string app_locale = AutofillCountry::ApplicationLocale(); 176 std::string app_locale = AutofillCountry::ApplicationLocale();
174 return AutofillCountry(country_code(), app_locale).name(); 177 return AutofillCountry(country_code(), app_locale).name();
175 } 178 }
176 179
177 void Address::set_line1(const string16& line1) { 180 void Address::set_line1(const string16& line1) {
178 line1_ = line1; 181 line1_ = line1;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 bool Address::IsWordInLine(const string16& word, 284 bool Address::IsWordInLine(const string16& word,
282 const LineTokens& line_tokens) const { 285 const LineTokens& line_tokens) const {
283 LineTokens::const_iterator iter; 286 LineTokens::const_iterator iter;
284 for (iter = line_tokens.begin(); iter != line_tokens.end(); ++iter) { 287 for (iter = line_tokens.begin(); iter != line_tokens.end(); ++iter) {
285 if (StringToLowerASCII(word) == *iter) 288 if (StringToLowerASCII(word) == *iter)
286 return true; 289 return true;
287 } 290 }
288 291
289 return false; 292 return false;
290 } 293 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/address.h ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698