| 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> | |
| 9 #include <vector> | 8 #include <vector> |
| 10 | 9 |
| 11 #include "components/autofill/core/browser/webdata/autofill_entry.h" | 10 #include "components/autofill/core/browser/webdata/autofill_entry.h" |
| 12 | 11 |
| 13 namespace autofill { | 12 namespace autofill { |
| 14 | 13 |
| 15 class AutofillProfile; | 14 class AutofillProfile; |
| 16 class CreditCard; | |
| 17 | 15 |
| 18 // For classic Autofill form fields, the KeyType is AutofillKey. | 16 // For classic Autofill form fields, the KeyType is AutofillKey. |
| 19 // Autofill++ types such as AutofillProfile and CreditCard simply use a string. | 17 // Autofill++ types such as AutofillProfile and CreditCard simply use an int. |
| 20 template <typename KeyType> | 18 template <typename KeyType> |
| 21 class GenericAutofillChange { | 19 class GenericAutofillChange { |
| 22 public: | 20 public: |
| 23 enum Type { | 21 enum Type { |
| 24 ADD, | 22 ADD, |
| 25 UPDATE, | 23 UPDATE, |
| 26 REMOVE | 24 REMOVE |
| 27 }; | 25 }; |
| 28 | 26 |
| 29 virtual ~GenericAutofillChange() {} | 27 virtual ~GenericAutofillChange() {} |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 ~AutofillProfileChange() override; | 63 ~AutofillProfileChange() override; |
| 66 | 64 |
| 67 const AutofillProfile* profile() const { return profile_; } | 65 const AutofillProfile* profile() const { return profile_; } |
| 68 bool operator==(const AutofillProfileChange& change) const; | 66 bool operator==(const AutofillProfileChange& change) const; |
| 69 | 67 |
| 70 private: | 68 private: |
| 71 // Weak reference, can be NULL. | 69 // Weak reference, can be NULL. |
| 72 const AutofillProfile* profile_; | 70 const AutofillProfile* profile_; |
| 73 }; | 71 }; |
| 74 | 72 |
| 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 | |
| 94 } // namespace autofill | 73 } // namespace autofill |
| 95 | 74 |
| 96 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ | 75 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__ |
| OLD | NEW |