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

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

Issue 22009003: [Autofill] Distinguish between native field types and potentially HTML field types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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 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_FORM_GROUP_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_GROUP_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_GROUP_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_GROUP_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "components/autofill/core/browser/field_types.h" 11 #include "components/autofill/core/browser/field_types.h"
12 12
13 namespace autofill { 13 namespace autofill {
14 14
15 class AutofillType;
16
15 // This class is an interface for collections of form fields, grouped by type. 17 // This class is an interface for collections of form fields, grouped by type.
16 class FormGroup { 18 class FormGroup {
17 public: 19 public:
18 virtual ~FormGroup() {} 20 virtual ~FormGroup() {}
19 21
20 // Used to determine the type of a field based on the text that a user enters 22 // Used to determine the type of a field based on the text that a user enters
21 // into the field, interpreted in the given |app_locale| if appropriate. The 23 // into the field, interpreted in the given |app_locale| if appropriate. The
22 // field types can then be reported back to the server. This method is 24 // field types can then be reported back to the server. This method is
23 // additive on |matching_types|. 25 // additive on |matching_types|.
24 virtual void GetMatchingTypes(const base::string16& text, 26 virtual void GetMatchingTypes(const base::string16& text,
25 const std::string& app_locale, 27 const std::string& app_locale,
26 FieldTypeSet* matching_types) const; 28 ServerFieldTypeSet* matching_types) const;
27 29
28 // Returns a set of AutofillFieldTypes for which this FormGroup has non-empty 30 // Returns a set of server field types for which this FormGroup has non-empty
29 // data. This method is additive on |non_empty_types|. 31 // data. This method is additive on |non_empty_types|.
30 virtual void GetNonEmptyTypes(const std::string& app_locale, 32 virtual void GetNonEmptyTypes(const std::string& app_locale,
31 FieldTypeSet* non_empty_types) const; 33 ServerFieldTypeSet* non_empty_types) const;
32 34
33 // Returns the string associated with |type|, without canonicalizing the 35 // Returns the string associated with |type|, without canonicalizing the
34 // returned value. For user-visible strings, use GetInfo() instead. 36 // returned value. For user-visible strings, use GetInfo() instead.
35 virtual base::string16 GetRawInfo(AutofillFieldType type) const = 0; 37 virtual base::string16 GetRawInfo(ServerFieldType type) const = 0;
36 38
37 // Sets this FormGroup object's data for |type| to |value|, without 39 // Sets this FormGroup object's data for |type| to |value|, without
38 // canonicalizing the |value|. For data that has not already been 40 // canonicalizing the |value|. For data that has not already been
39 // canonicalized, use SetInfo() instead. 41 // canonicalized, use SetInfo() instead.
40 virtual void SetRawInfo(AutofillFieldType type, 42 virtual void SetRawInfo(ServerFieldType type,
41 const base::string16& value) = 0; 43 const base::string16& value) = 0;
42 44
43 // Returns the string that should be auto-filled into a text field given the 45 // Returns the string that should be auto-filled into a text field given the
44 // type of that field, localized to the given |app_locale| if appropriate. 46 // type of that field, localized to the given |app_locale| if appropriate.
45 virtual base::string16 GetInfo(AutofillFieldType type, 47 virtual base::string16 GetInfo(const AutofillType& type,
46 const std::string& app_locale) const; 48 const std::string& app_locale) const;
47 49
48 // Used to populate this FormGroup object with data. Canonicalizes the data 50 // Used to populate this FormGroup object with data. Canonicalizes the data
49 // according to the specified |app_locale| prior to storing, if appropriate. 51 // according to the specified |app_locale| prior to storing, if appropriate.
50 virtual bool SetInfo(AutofillFieldType type, 52 virtual bool SetInfo(const AutofillType& type,
51 const base::string16& value, 53 const base::string16& value,
52 const std::string& app_locale); 54 const std::string& app_locale);
53 55
54 protected: 56 protected:
55 // AutofillProfile needs to call into GetSupportedTypes() for objects of 57 // AutofillProfile needs to call into GetSupportedTypes() for objects of
56 // non-AutofillProfile type, for which mere inheritance is insufficient. 58 // non-AutofillProfile type, for which mere inheritance is insufficient.
57 friend class AutofillProfile; 59 friend class AutofillProfile;
58 60
59 // Returns a set of AutofillFieldTypes for which this FormGroup can store 61 // Returns a set of server field types for which this FormGroup can store
60 // data. This method is additive on |supported_types|. 62 // data. This method is additive on |supported_types|.
61 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const = 0; 63 virtual void GetSupportedTypes(ServerFieldTypeSet* supported_types) const = 0;
62 }; 64 };
63 65
64 } // namespace autofill 66 } // namespace autofill
65 67
66 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_GROUP_H_ 68 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_GROUP_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/form_field_unittest.cc ('k') | components/autofill/core/browser/form_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698