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

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

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

Powered by Google App Engine
This is Rietveld 408576698