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

Side by Side Diff: components/autofill/browser/autofill_data_model.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 2013 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_AUTOFILL_DATA_MODEL_H_
6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_DATA_MODEL_H_
7
8 #include <string>
9
10 #include "components/autofill/browser/field_types.h"
11 #include "components/autofill/browser/form_group.h"
12
13 namespace autofill {
14
15 class AutofillField;
16 struct FormFieldData;
17
18 // This class is an interface for the primary data models that back Autofill.
19 // The information in objects of this class is managed by the
20 // PersonalDataManager.
21 class AutofillDataModel : public FormGroup {
22 public:
23 AutofillDataModel(const std::string& guid, const std::string& origin);
24 virtual ~AutofillDataModel();
25
26 // Set |field_data|'s value based on |field| and contents of |this| (using
27 // data variant |variant|).
28 virtual void FillFormField(const AutofillField& field,
29 size_t variant,
30 const std::string& app_locale,
31 FormFieldData* field_data) const = 0;
32
33 // Fills in select control with data matching |type| from |this|.
34 // Public for testing purposes.
35 void FillSelectControl(AutofillFieldType type,
36 const std::string& app_locale,
37 FormFieldData* field_data) const;
38
39 // Returns true if the data in this model was entered directly by the user,
40 // rather than automatically aggregated.
41 bool IsVerified() const;
42
43 std::string guid() const { return guid_; }
44 void set_guid(const std::string& guid) { guid_ = guid; }
45
46 std::string origin() const { return origin_; }
47 void set_origin(const std::string& origin) { origin_ = origin; }
48
49 protected:
50 // Fills in a select control for a country from data in |this|. Returns true
51 // for success.
52 virtual bool FillCountrySelectControl(const std::string& app_locale,
53 FormFieldData* field_data) const;
54
55 private:
56 // A globally unique ID for this object.
57 std::string guid_;
58
59 // The origin of this data. This should be
60 // (a) a web URL for the domain of the form from which the data was
61 // automatically aggregated, e.g. https://www.example.com/register,
62 // (b) some other non-empty string, which cannot be interpreted as a web
63 // URL, identifying the origin for non-aggregated data, or
64 // (c) an empty string, indicating that the origin for this data is unknown.
65 std::string origin_;
66 };
67
68 } // namespace autofill
69
70 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_DATA_MODEL_H_
OLDNEW
« no previous file with comments | « components/autofill/browser/autofill_country_unittest.cc ('k') | components/autofill/browser/autofill_data_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698