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

Side by Side Diff: components/autofill/browser/form_group.h

Issue 13973004: Convert string16 -> base::string16 in components/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 #ifndef COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_ 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_
6 #define COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_ 6 #define COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 12 matching lines...) Expand all
23 virtual ~FormGroup() {} 23 virtual ~FormGroup() {}
24 24
25 // Returns a globally unique ID for this object. It is an error to call the 25 // Returns a globally unique ID for this object. It is an error to call the
26 // default implementation. 26 // default implementation.
27 virtual std::string GetGUID() const; 27 virtual std::string GetGUID() const;
28 28
29 // Used to determine the type of a field based on the text that a user enters 29 // Used to determine the type of a field based on the text that a user enters
30 // into the field, interpreted in the given |app_locale| if appropriate. The 30 // into the field, interpreted in the given |app_locale| if appropriate. The
31 // field types can then be reported back to the server. This method is 31 // field types can then be reported back to the server. This method is
32 // additive on |matching_types|. 32 // additive on |matching_types|.
33 virtual void GetMatchingTypes(const string16& text, 33 virtual void GetMatchingTypes(const base::string16& text,
34 const std::string& app_locale, 34 const std::string& app_locale,
35 FieldTypeSet* matching_types) const; 35 FieldTypeSet* matching_types) const;
36 36
37 // Returns a set of AutofillFieldTypes for which this FormGroup has non-empty 37 // Returns a set of AutofillFieldTypes for which this FormGroup has non-empty
38 // data. This method is additive on |non_empty_types|. 38 // data. This method is additive on |non_empty_types|.
39 virtual void GetNonEmptyTypes(const std::string& app_locale, 39 virtual void GetNonEmptyTypes(const std::string& app_locale,
40 FieldTypeSet* non_empty_types) const; 40 FieldTypeSet* non_empty_types) const;
41 41
42 // Returns the string associated with |type|, without canonicalizing the 42 // Returns the string associated with |type|, without canonicalizing the
43 // returned value. For user-visible strings, use GetInfo() instead. 43 // returned value. For user-visible strings, use GetInfo() instead.
44 virtual string16 GetRawInfo(AutofillFieldType type) const = 0; 44 virtual base::string16 GetRawInfo(AutofillFieldType type) const = 0;
45 45
46 // Sets this FormGroup object's data for |type| to |value|, without 46 // Sets this FormGroup object's data for |type| to |value|, without
47 // canonicalizing the |value|. For data that has not already been 47 // canonicalizing the |value|. For data that has not already been
48 // canonicalized, use SetInfo() instead. 48 // canonicalized, use SetInfo() instead.
49 virtual void SetRawInfo(AutofillFieldType type, const string16& value) = 0; 49 virtual void SetRawInfo(AutofillFieldType type,
50 const base::string16& value) = 0;
50 51
51 // Returns the string that should be auto-filled into a text field given the 52 // Returns the string that should be auto-filled into a text field given the
52 // type of that field, localized to the given |app_locale| if appropriate. 53 // type of that field, localized to the given |app_locale| if appropriate.
53 virtual string16 GetInfo(AutofillFieldType type, 54 virtual base::string16 GetInfo(AutofillFieldType type,
54 const std::string& app_locale) const; 55 const std::string& app_locale) const;
55 56
56 // Used to populate this FormGroup object with data. Canonicalizes the data 57 // Used to populate this FormGroup object with data. Canonicalizes the data
57 // according to the specified |app_locale| prior to storing, if appropriate. 58 // according to the specified |app_locale| prior to storing, if appropriate.
58 virtual bool SetInfo(AutofillFieldType type, 59 virtual bool SetInfo(AutofillFieldType type,
59 const string16& value, 60 const base::string16& value,
60 const std::string& app_locale); 61 const std::string& app_locale);
61 62
62 // Set |field_data|'s value based on |field| and contents of |this| (using 63 // Set |field_data|'s value based on |field| and contents of |this| (using
63 // data variant |variant|). It is an error to call the default implementation. 64 // data variant |variant|). It is an error to call the default implementation.
64 virtual void FillFormField(const AutofillField& field, 65 virtual void FillFormField(const AutofillField& field,
65 size_t variant, 66 size_t variant,
66 const std::string& app_locale, 67 const std::string& app_locale,
67 FormFieldData* field_data) const; 68 FormFieldData* field_data) const;
68 69
69 // Fills in select control with data matching |type| from |this|. 70 // Fills in select control with data matching |type| from |this|.
70 // Public for testing purposes. 71 // Public for testing purposes.
71 void FillSelectControl(AutofillFieldType type, 72 void FillSelectControl(AutofillFieldType type,
72 const std::string& app_locale, 73 const std::string& app_locale,
73 FormFieldData* field_data) const; 74 FormFieldData* field_data) const;
74 75
75 // Returns true if |value| is a valid US state name or abbreviation. It is 76 // Returns true if |value| is a valid US state name or abbreviation. It is
76 // case insensitive. Valid for US states only. 77 // case insensitive. Valid for US states only.
77 // TODO(estade): this is a crappy place for this function. 78 // TODO(estade): this is a crappy place for this function.
78 static bool IsValidState(const string16& value); 79 static bool IsValidState(const base::string16& value);
79 80
80 protected: 81 protected:
81 // AutofillProfile needs to call into GetSupportedTypes() for objects of 82 // AutofillProfile needs to call into GetSupportedTypes() for objects of
82 // non-AutofillProfile type, for which mere inheritance is insufficient. 83 // non-AutofillProfile type, for which mere inheritance is insufficient.
83 friend class AutofillProfile; 84 friend class AutofillProfile;
84 85
85 // Returns a set of AutofillFieldTypes for which this FormGroup can store 86 // Returns a set of AutofillFieldTypes for which this FormGroup can store
86 // data. This method is additive on |supported_types|. 87 // data. This method is additive on |supported_types|.
87 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const = 0; 88 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const = 0;
88 89
89 // Fills in a select control for a country from data in |this|. Returns true 90 // Fills in a select control for a country from data in |this|. Returns true
90 // for success. 91 // for success.
91 virtual bool FillCountrySelectControl(const std::string& app_locale, 92 virtual bool FillCountrySelectControl(const std::string& app_locale,
92 FormFieldData* field_data) const; 93 FormFieldData* field_data) const;
93 }; 94 };
94 95
95 #endif // COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_ 96 #endif // COMPONENTS_AUTOFILL_BROWSER_FORM_GROUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698