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

Side by Side Diff: components/autofill/core/browser/webdata/autofill_change.h

Issue 1110833002: [autofill] Sync server card and address metadata. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Class comment and one more expectation in test. Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__
7 7
8 #include <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "components/autofill/core/browser/webdata/autofill_entry.h" 11 #include "components/autofill/core/browser/webdata/autofill_entry.h"
11 12
12 namespace autofill { 13 namespace autofill {
13 14
14 class AutofillProfile; 15 class AutofillProfile;
16 class CreditCard;
15 17
16 // For classic Autofill form fields, the KeyType is AutofillKey. 18 // For classic Autofill form fields, the KeyType is AutofillKey.
17 // Autofill++ types such as AutofillProfile and CreditCard simply use an int. 19 // Autofill++ types such as AutofillProfile and CreditCard simply use a string.
18 template <typename KeyType> 20 template <typename KeyType>
19 class GenericAutofillChange { 21 class GenericAutofillChange {
20 public: 22 public:
21 enum Type { 23 enum Type {
22 ADD, 24 ADD,
23 UPDATE, 25 UPDATE,
24 REMOVE 26 REMOVE
25 }; 27 };
26 28
27 virtual ~GenericAutofillChange() {} 29 virtual ~GenericAutofillChange() {}
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 ~AutofillProfileChange() override; 65 ~AutofillProfileChange() override;
64 66
65 const AutofillProfile* profile() const { return profile_; } 67 const AutofillProfile* profile() const { return profile_; }
66 bool operator==(const AutofillProfileChange& change) const; 68 bool operator==(const AutofillProfileChange& change) const;
67 69
68 private: 70 private:
69 // Weak reference, can be NULL. 71 // Weak reference, can be NULL.
70 const AutofillProfile* profile_; 72 const AutofillProfile* profile_;
71 }; 73 };
72 74
75 // Change notification details for credit card changes.
76 class CreditCardChange : public GenericAutofillChange<std::string> {
77 public:
78 // The |type| input specifies the change type. The |key| input is the key,
79 // which is expected to be the GUID identifying the |card|.
80 // When |type| == ADD, |card| should be non-NULL.
81 // When |type| == UPDATE, |card| should be non-NULL.
82 // When |type| == REMOVE, |card| should be NULL.
83 CreditCardChange(Type type, const std::string& key, const CreditCard* card);
84 ~CreditCardChange() override;
85
86 const CreditCard* card() const { return card_; }
87 bool operator==(const CreditCardChange& change) const;
88
89 private:
90 // Weak reference, can be NULL.
91 const CreditCard* card_;
92 };
93
73 } // namespace autofill 94 } // namespace autofill
74 95
75 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ 96 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__
OLDNEW
« no previous file with comments | « components/autofill/core/browser/BUILD.gn ('k') | components/autofill/core/browser/webdata/autofill_change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698