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

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

Issue 8143007: Move a bunch of non-shared methods out of the FormGroup class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | 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 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/field_types.h" 13 #include "chrome/browser/autofill/field_types.h"
14 14
15 // 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.
16 // The information in objects of this class is managed by the 16 // The information in objects of this class is managed by the
17 // PersonalDataManager. 17 // PersonalDataManager.
18 class FormGroup { 18 class FormGroup {
19 public: 19 public:
20 virtual ~FormGroup() {} 20 virtual ~FormGroup() {}
21 21
22 // 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
23 // 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.
24 // This method is additive on |matching_types|. 24 // This method is additive on |matching_types|.
25 virtual void GetMatchingTypes(const string16& text, 25 virtual void GetMatchingTypes(const string16& text,
26 FieldTypeSet* matching_types) const; 26 FieldTypeSet* matching_types) const;
27 27
28 // 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
29 // data. This method is additive on |non_empty_types|. 29 // data. This method is additive on |non_empty_types|.
30 virtual void GetNonEmptyTypes(FieldTypeSet* non_empty_types) const; 30 virtual void GetNonEmptyTypes(FieldTypeSet* non_empty_types) const;
31 31
32 // Returns the literal string associated with |type|. 32 // Returns the literal string associated with |type|.
33 virtual string16 GetInfo(AutofillFieldType type) const = 0; 33 virtual string16 GetInfo(AutofillFieldType type) const = 0;
34 34
35 // Used to populate this FormGroup object with data. 35 // Used to populate this FormGroup object with data.
36 virtual void SetInfo(AutofillFieldType type, const string16& value) = 0; 36 virtual void SetInfo(AutofillFieldType type, const string16& value) = 0;
37 37
38 // Returns the string that should be auto-filled into a text field given the 38 // Returns the string that should be auto-filled into a text field given the
39 // type of that field. 39 // type of that field.
40 virtual string16 GetCanonicalizedInfo(AutofillFieldType type) const; 40 virtual string16 GetCanonicalizedInfo(AutofillFieldType type) const;
41 41
42 // Used to populate this FormGroup object with data. Canonicalizes the data 42 // Used to populate this FormGroup object with data. Canonicalizes the data
43 // prior to storing, if appropriate. 43 // prior to storing, if appropriate.
44 virtual bool SetCanonicalizedInfo(AutofillFieldType type, 44 virtual bool SetCanonicalizedInfo(AutofillFieldType type,
45 const string16& value); 45 const string16& value);
46 46
47 // Returns the label for this FormGroup item. This should be overridden for
48 // form group items that implement a label.
49 virtual const string16 Label() const;
50
51 // Returns true if the field data in |form_group| does not match the field
52 // data in this FormGroup.
53 virtual bool operator!=(const FormGroup& form_group) const;
54
55 // Returns true if the data in this FormGroup is a subset of the data in
56 // |form_group|.
57 bool IsSubsetOf(const FormGroup& form_group) const;
58
59 // Returns true if the values of the intersection of the available field types
60 // are equal. If the intersection is empty, the method returns false.
61 bool IntersectionOfTypesHasEqualValues(const FormGroup& form_group) const;
62
63 // Merges the field data in |form_group| with this FormGroup.
64 void MergeWith(const FormGroup& form_group);
65
66 protected: 47 protected:
67 // AutofillProfile needs to call into GetSupportedTypes() for objects of 48 // AutofillProfile needs to call into GetSupportedTypes() for objects of
68 // non-AutofillProfile type, for which mere inheritance is insufficient. 49 // non-AutofillProfile type, for which mere inheritance is insufficient.
69 friend class AutofillProfile; 50 friend class AutofillProfile;
70 51
71 // Returns a set of AutofillFieldTypes for which this FormGroup can store 52 // Returns a set of AutofillFieldTypes for which this FormGroup can store
72 // data. This method is additive on |supported_types|. 53 // data. This method is additive on |supported_types|.
73 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const = 0; 54 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const = 0;
74 }; 55 };
75 56
76 #endif // CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_ 57 #endif // CHROME_BROWSER_AUTOFILL_FORM_GROUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698