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

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

Issue 6673079: Reduce boxing and unboxing of AutofillFieldType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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/credit_card.cc ('k') | chrome/browser/autofill/form_group.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 #ifndef CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_
6 #define CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ 6 #define CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "chrome/browser/autofill/autofill_type.h"
14 #include "chrome/browser/autofill/field_types.h" 13 #include "chrome/browser/autofill/field_types.h"
15 14
16 // This class is an interface for collections of form fields, grouped by type. 15 // This class is an interface for collections of form fields, grouped by type.
17 // The information in objects of this class is managed by the 16 // The information in objects of this class is managed by the
18 // PersonalDataManager. 17 // PersonalDataManager.
19 class FormGroup { 18 class FormGroup {
20 public: 19 public:
21 virtual ~FormGroup() {} 20 virtual ~FormGroup() {}
22 21
23 // 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
24 // into the field. The field types can then be reported back to the server. 23 // into the field. The field types can then be reported back to the server.
25 // This method is additive on |possible_types|. 24 // This method is additive on |possible_types|.
26 virtual void GetPossibleFieldTypes(const string16& text, 25 virtual void GetPossibleFieldTypes(const string16& text,
27 FieldTypeSet* possible_types) const = 0; 26 FieldTypeSet* possible_types) const = 0;
28 27
29 // Returns a set of AutofillFieldTypes for which this FormGroup has non-empty 28 // Returns a set of AutofillFieldTypes for which this FormGroup has non-empty
30 // data. 29 // data.
31 virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const = 0; 30 virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const = 0;
32 31
33 // Returns the string that should be auto-filled into a text field given the 32 // Returns the string that should be auto-filled into a text field given the
34 // type of that field. 33 // type of that field.
35 virtual string16 GetFieldText(const AutofillType& type) const = 0; 34 virtual string16 GetFieldText(AutofillFieldType type) const = 0;
36 35
37 // Returns the text for preview. 36 // Returns the text for preview.
38 virtual string16 GetPreviewText(const AutofillType& type) const; 37 virtual string16 GetPreviewText(AutofillFieldType type) const;
39 38
40 // Used to determine if the text being typed into a field matches the 39 // Used to determine if the text being typed into a field matches the
41 // information in this FormGroup object. This is used by the preview 40 // information in this FormGroup object. This is used by the preview
42 // functionality. |matched_text| will be populated with all of the possible 41 // functionality. |matched_text| will be populated with all of the possible
43 // matches given the type. This method is additive on |matched_text|. 42 // matches given the type. This method is additive on |matched_text|.
44 virtual void FindInfoMatches(const AutofillType& type, 43 virtual void FindInfoMatches(AutofillFieldType type,
45 const string16& info, 44 const string16& info,
46 std::vector<string16>* matched_text) const = 0; 45 std::vector<string16>* matched_text) const = 0;
47 46
48 // Used to populate this FormGroup object with data. 47 // Used to populate this FormGroup object with data.
49 virtual void SetInfo(const AutofillType& type, const string16& value) = 0; 48 virtual void SetInfo(AutofillFieldType type, const string16& value) = 0;
50 49
51 // Returns the label for this FormGroup item. This should be overridden for 50 // Returns the label for this FormGroup item. This should be overridden for
52 // form group items that implement a label. 51 // form group items that implement a label.
53 virtual const string16 Label() const; 52 virtual const string16 Label() const;
54 53
55 // Returns true if the field data in |form_group| does not match the field 54 // Returns true if the field data in |form_group| does not match the field
56 // data in this FormGroup. 55 // data in this FormGroup.
57 virtual bool operator!=(const FormGroup& form_group) const; 56 virtual bool operator!=(const FormGroup& form_group) const;
58 57
59 // Returns true if the data in this FormGroup is a subset of the data in 58 // Returns true if the data in this FormGroup is a subset of the data in
60 // |form_group|. 59 // |form_group|.
61 bool IsSubsetOf(const FormGroup& form_group) const; 60 bool IsSubsetOf(const FormGroup& form_group) const;
62 61
63 // Returns true if the values of the intersection of the available field types 62 // Returns true if the values of the intersection of the available field types
64 // are equal. If the intersection is empty, the method returns false. 63 // are equal. If the intersection is empty, the method returns false.
65 bool IntersectionOfTypesHasEqualValues(const FormGroup& form_group) const; 64 bool IntersectionOfTypesHasEqualValues(const FormGroup& form_group) const;
66 65
67 // Merges the field data in |form_group| with this FormGroup. 66 // Merges the field data in |form_group| with this FormGroup.
68 void MergeWith(const FormGroup& form_group); 67 void MergeWith(const FormGroup& form_group);
69 68
70 // Overwrites the field data in |form_group| with this FormGroup. 69 // Overwrites the field data in |form_group| with this FormGroup.
71 void OverwriteWith(const FormGroup& form_group); 70 void OverwriteWith(const FormGroup& form_group);
72 }; 71 };
73 72
74 #endif // CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ 73 #endif // CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/credit_card.cc ('k') | chrome/browser/autofill/form_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698