OLD | NEW |
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 Loading... |
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__ |
OLD | NEW |