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

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: Ditch ternary operator Created 5 years, 7 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 <vector> 8 #include <vector>
9 9
10 #include "components/autofill/core/browser/webdata/autofill_entry.h" 10 #include "components/autofill/core/browser/webdata/autofill_entry.h"
11 11
12 namespace autofill { 12 namespace autofill {
13 13
14 class AutofillProfile; 14 class AutofillProfile;
15 class CreditCard;
15 16
16 // For classic Autofill form fields, the KeyType is AutofillKey. 17 // For classic Autofill form fields, the KeyType is AutofillKey.
17 // Autofill++ types such as AutofillProfile and CreditCard simply use an int. 18 // Autofill++ types such as AutofillProfile and CreditCard simply use a string.
18 template <typename KeyType> 19 template <typename KeyType>
19 class GenericAutofillChange { 20 class GenericAutofillChange {
20 public: 21 public:
21 enum Type { 22 enum Type {
22 ADD, 23 ADD,
23 UPDATE, 24 UPDATE,
24 REMOVE 25 REMOVE
25 }; 26 };
26 27
27 virtual ~GenericAutofillChange() {} 28 virtual ~GenericAutofillChange() {}
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 ~AutofillProfileChange() override; 64 ~AutofillProfileChange() override;
64 65
65 const AutofillProfile* profile() const { return profile_; } 66 const AutofillProfile* profile() const { return profile_; }
66 bool operator==(const AutofillProfileChange& change) const; 67 bool operator==(const AutofillProfileChange& change) const;
67 68
68 private: 69 private:
69 // Weak reference, can be NULL. 70 // Weak reference, can be NULL.
70 const AutofillProfile* profile_; 71 const AutofillProfile* profile_;
71 }; 72 };
72 73
74 // Change notification details for credit card changes.
75 class CreditCardChange : public GenericAutofillChange<std::string> {
76 public:
77 // The |type| input specifies the change type. The |key| input is the key,
78 // which is expected to be the GUID identifying the |card|.
79 // When |type| == ADD, |card| should be non-NULL.
80 // When |type| == UPDATE, |card| should be non-NULL.
81 // When |type| == REMOVE, |card| should be NULL.
82 CreditCardChange(Type type, const std::string& key, const CreditCard* card);
83 ~CreditCardChange() override;
84
85 const CreditCard* card() const { return card_; }
86 bool operator==(const CreditCardChange& change) const;
87
88 private:
89 // Weak reference, can be NULL.
90 const CreditCard* card_;
91 };
92
73 } // namespace autofill 93 } // namespace autofill
74 94
75 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ 95 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698