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

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

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "components/autofill/core/browser/form_group.h" 13 #include "components/autofill/core/browser/form_group.h"
14 #include "components/autofill/core/browser/phone_number_i18n.h" 14 #include "components/autofill/core/browser/phone_number_i18n.h"
15 15
16 namespace autofill { 16 namespace autofill {
17 17
18 class AutofillProfile; 18 class AutofillProfile;
19 19
20 // A form group that stores phone number information. 20 // A form group that stores phone number information.
21 class PhoneNumber : public FormGroup { 21 class PhoneNumber : public FormGroup {
22 public: 22 public:
23 explicit PhoneNumber(AutofillProfile* profile); 23 explicit PhoneNumber(AutofillProfile* profile);
24 PhoneNumber(const PhoneNumber& number); 24 PhoneNumber(const PhoneNumber& number);
25 virtual ~PhoneNumber(); 25 ~PhoneNumber() override;
26 26
27 PhoneNumber& operator=(const PhoneNumber& number); 27 PhoneNumber& operator=(const PhoneNumber& number);
28 28
29 void set_profile(AutofillProfile* profile) { profile_ = profile; } 29 void set_profile(AutofillProfile* profile) { profile_ = profile; }
30 30
31 // FormGroup implementation: 31 // FormGroup implementation:
32 virtual void GetMatchingTypes( 32 void GetMatchingTypes(const base::string16& text,
33 const base::string16& text, 33 const std::string& app_locale,
34 const std::string& app_locale, 34 ServerFieldTypeSet* matching_types) const override;
35 ServerFieldTypeSet* matching_types) const override; 35 base::string16 GetRawInfo(ServerFieldType type) const override;
36 virtual base::string16 GetRawInfo(ServerFieldType type) const override; 36 void SetRawInfo(ServerFieldType type, const base::string16& value) override;
37 virtual void SetRawInfo(ServerFieldType type, 37 base::string16 GetInfo(const AutofillType& type,
38 const base::string16& value) override; 38 const std::string& app_locale) const override;
39 virtual base::string16 GetInfo(const AutofillType& type, 39 bool SetInfo(const AutofillType& type,
40 const std::string& app_locale) const override; 40 const base::string16& value,
41 virtual bool SetInfo(const AutofillType& type, 41 const std::string& app_locale) override;
42 const base::string16& value,
43 const std::string& app_locale) override;
44 42
45 // Size and offset of the prefix and suffix portions of phone numbers. 43 // Size and offset of the prefix and suffix portions of phone numbers.
46 static const size_t kPrefixOffset = 0; 44 static const size_t kPrefixOffset = 0;
47 static const size_t kPrefixLength = 3; 45 static const size_t kPrefixLength = 3;
48 static const size_t kSuffixOffset = 3; 46 static const size_t kSuffixOffset = 3;
49 static const size_t kSuffixLength = 4; 47 static const size_t kSuffixLength = 4;
50 48
51 // The class used to combine home phone parts into a whole number. 49 // The class used to combine home phone parts into a whole number.
52 class PhoneCombineHelper { 50 class PhoneCombineHelper {
53 public: 51 public:
(...skipping 17 matching lines...) Expand all
71 69
72 private: 70 private:
73 base::string16 country_; 71 base::string16 country_;
74 base::string16 city_; 72 base::string16 city_;
75 base::string16 phone_; 73 base::string16 phone_;
76 base::string16 whole_number_; 74 base::string16 whole_number_;
77 }; 75 };
78 76
79 private: 77 private:
80 // FormGroup: 78 // FormGroup:
81 virtual void GetSupportedTypes( 79 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override;
82 ServerFieldTypeSet* supported_types) const override;
83 80
84 // Updates the cached parsed number if the profile's region has changed 81 // Updates the cached parsed number if the profile's region has changed
85 // since the last time the cache was updated. 82 // since the last time the cache was updated.
86 void UpdateCacheIfNeeded(const std::string& app_locale) const; 83 void UpdateCacheIfNeeded(const std::string& app_locale) const;
87 84
88 // The phone number. 85 // The phone number.
89 base::string16 number_; 86 base::string16 number_;
90 // Profile which stores the region used as hint when normalizing the number. 87 // Profile which stores the region used as hint when normalizing the number.
91 const AutofillProfile* profile_; // WEAK 88 const AutofillProfile* profile_; // WEAK
92 89
93 // Cached number. 90 // Cached number.
94 mutable i18n::PhoneObject cached_parsed_phone_; 91 mutable i18n::PhoneObject cached_parsed_phone_;
95 }; 92 };
96 93
97 } // namespace autofill 94 } // namespace autofill
98 95
99 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_ 96 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_NUMBER_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/phone_field.h ('k') | components/autofill/core/browser/test_autofill_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698