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

Side by Side Diff: components/autofill/core/browser/phone_number.cc

Issue 2110563002: Use AutofillProfileComparator in place of ad-hoc merge logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@merge
Patch Set: Rebase Created 4 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/phone_number.h" 5 #include "components/autofill/core/browser/phone_number.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/autofill/core/browser/autofill_country.h" 10 #include "components/autofill/core/browser/autofill_country.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 PhoneNumber& PhoneNumber::operator=(const PhoneNumber& number) { 45 PhoneNumber& PhoneNumber::operator=(const PhoneNumber& number) {
46 if (this == &number) 46 if (this == &number)
47 return *this; 47 return *this;
48 48
49 number_ = number.number_; 49 number_ = number.number_;
50 profile_ = number.profile_; 50 profile_ = number.profile_;
51 cached_parsed_phone_ = number.cached_parsed_phone_; 51 cached_parsed_phone_ = number.cached_parsed_phone_;
52 return *this; 52 return *this;
53 } 53 }
54 54
55 bool PhoneNumber::operator==(const PhoneNumber& other) const {
56 if (this == &other)
57 return true;
58
59 return number_ == other.number_ && profile_ == other.profile_;
60 }
61
55 void PhoneNumber::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { 62 void PhoneNumber::GetSupportedTypes(ServerFieldTypeSet* supported_types) const {
56 supported_types->insert(PHONE_HOME_WHOLE_NUMBER); 63 supported_types->insert(PHONE_HOME_WHOLE_NUMBER);
57 supported_types->insert(PHONE_HOME_NUMBER); 64 supported_types->insert(PHONE_HOME_NUMBER);
58 supported_types->insert(PHONE_HOME_CITY_CODE); 65 supported_types->insert(PHONE_HOME_CITY_CODE);
59 supported_types->insert(PHONE_HOME_CITY_AND_NUMBER); 66 supported_types->insert(PHONE_HOME_CITY_AND_NUMBER);
60 supported_types->insert(PHONE_HOME_COUNTRY_CODE); 67 supported_types->insert(PHONE_HOME_COUNTRY_CODE);
61 } 68 }
62 69
63 base::string16 PhoneNumber::GetRawInfo(ServerFieldType type) const { 70 base::string16 PhoneNumber::GetRawInfo(ServerFieldType type) const {
64 DCHECK_EQ(PHONE_HOME, AutofillType(type).group()); 71 DCHECK_EQ(PHONE_HOME, AutofillType(type).group());
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 255
249 return i18n::ConstructPhoneNumber( 256 return i18n::ConstructPhoneNumber(
250 country_, city_, phone_, GetRegion(profile, app_locale), value); 257 country_, city_, phone_, GetRegion(profile, app_locale), value);
251 } 258 }
252 259
253 bool PhoneNumber::PhoneCombineHelper::IsEmpty() const { 260 bool PhoneNumber::PhoneCombineHelper::IsEmpty() const {
254 return phone_.empty() && whole_number_.empty(); 261 return phone_.empty() && whole_number_.empty();
255 } 262 }
256 263
257 } // namespace autofill 264 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698