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

Side by Side Diff: components/autofill/browser/webdata/autofill_change.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_WEBDATA_AUTOFILL_CHANGE_H__
6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__
7
8 #include <vector>
9
10 #include "components/autofill/browser/webdata/autofill_entry.h"
11
12 namespace autofill {
13
14 class AutofillProfile;
15 class CreditCard;
16
17 // For classic Autofill form fields, the KeyType is AutofillKey.
18 // Autofill++ types such as AutofillProfile and CreditCard simply use an int.
19 template <typename KeyType>
20 class GenericAutofillChange {
21 public:
22 typedef enum {
23 ADD,
24 UPDATE,
25 REMOVE
26 } Type;
27
28 virtual ~GenericAutofillChange() {}
29
30 Type type() const { return type_; }
31 const KeyType& key() const { return key_; }
32
33 protected:
34 GenericAutofillChange(Type type, const KeyType& key)
35 : type_(type),
36 key_(key) {}
37 private:
38 Type type_;
39 KeyType key_;
40 };
41
42 class AutofillChange : public GenericAutofillChange<AutofillKey> {
43 public:
44 AutofillChange(Type type, const AutofillKey& key);
45 virtual ~AutofillChange();
46 bool operator==(const AutofillChange& change) const {
47 return type() == change.type() && key() == change.key();
48 }
49 };
50
51 typedef std::vector<AutofillChange> AutofillChangeList;
52
53 // Change notification details for Autofill profile changes.
54 class AutofillProfileChange : public GenericAutofillChange<std::string> {
55 public:
56 // The |type| input specifies the change type. The |key| input is the key,
57 // which is expected to be the GUID identifying the |profile|.
58 // When |type| == ADD, |profile| should be non-NULL.
59 // When |type| == UPDATE, |profile| should be non-NULL.
60 // When |type| == REMOVE, |profile| should be NULL.
61 AutofillProfileChange(Type type,
62 const std::string& key,
63 const AutofillProfile* profile);
64 virtual ~AutofillProfileChange();
65
66 const AutofillProfile* profile() const { return profile_; }
67 bool operator==(const AutofillProfileChange& change) const;
68
69 private:
70 // Weak reference, can be NULL.
71 const AutofillProfile* profile_;
72 };
73
74 } // namespace autofill
75
76 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__
OLDNEW
« no previous file with comments | « components/autofill/browser/validation_unittest.cc ('k') | components/autofill/browser/webdata/autofill_change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698